bugfix
This commit is contained in:
commit
26c78373a9
@ -1,6 +1,26 @@
|
|||||||
{
|
{
|
||||||
"tblname":"agreement",
|
"tblname":"agreement",
|
||||||
"params":{
|
"params":{
|
||||||
|
"toolbar":{
|
||||||
|
"tools":[
|
||||||
|
{
|
||||||
|
"name":"prodauth",
|
||||||
|
"selected_row":true,
|
||||||
|
"label":"授权"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"binds":[
|
||||||
|
{
|
||||||
|
"wid":"self",
|
||||||
|
"event":"prodauth",
|
||||||
|
"actiontype":"urlwidget",
|
||||||
|
"target":"PopupWindow",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('../agree_prodclone.dspy')}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"browserfields": {
|
"browserfields": {
|
||||||
"exclouded": ["id"],
|
"exclouded": ["id"],
|
||||||
"alters": {}
|
"alters": {}
|
||||||
|
@ -2,28 +2,6 @@
|
|||||||
"tblname":"agreeproduct",
|
"tblname":"agreeproduct",
|
||||||
"params":{
|
"params":{
|
||||||
"logined_userorgid":"orgid",
|
"logined_userorgid":"orgid",
|
||||||
"toolbar":{
|
|
||||||
"tools":[
|
|
||||||
{
|
|
||||||
"name":"prodauth",
|
|
||||||
"label":"授权"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"binds":[
|
|
||||||
{
|
|
||||||
"wid":"self",
|
|
||||||
"event":"prodauth",
|
|
||||||
"actiontype":"urlwidget",
|
|
||||||
"target":"PopupWindow",
|
|
||||||
"options":{
|
|
||||||
"url":"{{entire_url('platformbiz/agreeproduct_auth.dspy')}}",
|
|
||||||
"params":{
|
|
||||||
"agreedetailid":"{{params_kw.agreedetailid}}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"browserfields": {
|
"browserfields": {
|
||||||
"exclouded": ["id", "agreedetailid"],
|
"exclouded": ["id", "agreedetailid"],
|
||||||
"alters": {}
|
"alters": {}
|
||||||
|
@ -1,9 +1,32 @@
|
|||||||
{
|
{
|
||||||
"treetype":"singlestruct",
|
|
||||||
"tblname":"prodtype",
|
"tblname":"prodtype",
|
||||||
"uitype":"tree",
|
"uitype":"tree",
|
||||||
"alias":"choose_prodtype",
|
"alias":"choose_prodtype",
|
||||||
"params":{
|
"params":{
|
||||||
|
"toolbar":{
|
||||||
|
"bar_cwidth":2,
|
||||||
|
"tools":[
|
||||||
|
{
|
||||||
|
"name":"test",
|
||||||
|
"selected_data":true,
|
||||||
|
"label":"TEST"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"binds":[
|
||||||
|
{
|
||||||
|
"wid":"self",
|
||||||
|
"event":"prodauth",
|
||||||
|
"actiontype":"urlwidget",
|
||||||
|
"target":"PopupWindow",
|
||||||
|
"options":{
|
||||||
|
"url":"{{entire_url('platformbiz/ag.dspy')}}",
|
||||||
|
"params":{
|
||||||
|
"agreedetailid":"{{params_kw.agreedetailid}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"idField":"id",
|
"idField":"id",
|
||||||
"textField":"name",
|
"textField":"name",
|
||||||
"editable":true,
|
"editable":true,
|
||||||
@ -11,12 +34,7 @@
|
|||||||
"alters":{}
|
"alters":{}
|
||||||
},
|
},
|
||||||
"edit_exclouded_fields":["del_flg", "create_at"],
|
"edit_exclouded_fields":["del_flg", "create_at"],
|
||||||
"checkField":"dd",
|
"parentField":"parentid"
|
||||||
"parentField":"parentid",
|
|
||||||
"toolbar":{
|
|
||||||
},
|
|
||||||
"binds":[
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,39 +6,6 @@
|
|||||||
"textField":"name",
|
"textField":"name",
|
||||||
"parentField":"parentid",
|
"parentField":"parentid",
|
||||||
"editable":true,
|
"editable":true,
|
||||||
"toolbar":{
|
|
||||||
"tools":[
|
|
||||||
{
|
|
||||||
"target":"PopupWindow",
|
|
||||||
"name":"spec",
|
|
||||||
"selected_data":true,
|
|
||||||
"label":"规格"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"binds":[
|
|
||||||
{
|
|
||||||
"wid":"self",
|
|
||||||
"event":"spec",
|
|
||||||
"actiontype":"urlwidget",
|
|
||||||
"target":"PopupWindow",
|
|
||||||
"popup_options":{
|
|
||||||
"width":"80%",
|
|
||||||
"height":"80%"
|
|
||||||
},
|
|
||||||
"params_mapping":{
|
|
||||||
"mapping":{
|
|
||||||
"id":"prodtypeid"
|
|
||||||
},
|
|
||||||
"need_others":false
|
|
||||||
},
|
|
||||||
"options":{
|
|
||||||
"params":{
|
|
||||||
},
|
|
||||||
"url":"/platformbiz/prodtypespec"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"browserfields": {
|
"browserfields": {
|
||||||
"exclouded": ["id", "parentid" ],
|
"exclouded": ["id", "parentid" ],
|
||||||
"alters": {}
|
"alters": {}
|
||||||
|
8
platformbiz/getdbname.py
Normal file
8
platformbiz/getdbname.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ifrom ahserver.serverenv import get_serverenv
|
||||||
|
|
||||||
|
def get_dbname():
|
||||||
|
f = get_serverenv('get_module_dbname')
|
||||||
|
if f is None:
|
||||||
|
raise Exception('get_module_dbname() not found')
|
||||||
|
return f('platformbiz')
|
||||||
|
|
@ -5,15 +5,16 @@ from appPublic.registerfunction import rfexe
|
|||||||
from sqlor.dbpools import DBPools
|
from sqlor.dbpools import DBPools
|
||||||
from ahserver.serverenv import get_serverenv
|
from ahserver.serverenv import get_serverenv
|
||||||
from accounting.accounting_config import Accounting
|
from accounting.accounting_config import Accounting
|
||||||
|
from accounting.bizaccount import BizAccounting
|
||||||
from accounting.bill import write_bill
|
from accounting.bill import write_bill
|
||||||
|
from getdbname import get_dbname
|
||||||
|
|
||||||
async def get_owner_orgid(sor, orgid):
|
async def get_owner_orgid(sor, orgid):
|
||||||
return '0'
|
return '0'
|
||||||
|
|
||||||
async def get_balance(orgid):
|
async def get_balance(orgid):
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
dbname = await rfexe('get_module_dbname', 'platformbiz')
|
dbname = get_dbname()
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
f = get_serverenv('getCustomerBalance')
|
f = get_serverenv('getCustomerBalance')
|
||||||
if f:
|
if f:
|
||||||
@ -23,43 +24,42 @@ async def get_balance(orgid):
|
|||||||
class PlatformBizAcc:
|
class PlatformBizAcc:
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
async def accounting(self, sor, biz_orderid):
|
async def build_accountset(self, sor, biz_order, biz_orderdetails):
|
||||||
biz_order = await sor.R('biz_order', {'id':biz_orderid})
|
acconuntset = DictObject()
|
||||||
details = await sor.R('biz_orderdetail',{'orderid':biz_orderid})
|
accountset['action'] = biz_order.business_op
|
||||||
self.customerid = biz_order.customerid
|
accountset['owner'] = get_owner_orgid(sor, '0')
|
||||||
self.resellerid = biz_order.resellerid
|
accountset['reseller'] = biz_order.resellerid
|
||||||
self.orderid = biz_order.id
|
accountset['customer'] = biz_order.customerid
|
||||||
self.userid = biz_order.userid
|
accountset['交易金额'] = biz_order.amount
|
||||||
self.business_op = biz_order.business_op
|
|
||||||
get_business_date = get_serverenv('get_business_date')
|
|
||||||
self.curdate = await get_business_date(sor)
|
|
||||||
self.transamt = biz_order.amount
|
|
||||||
transfee = await get_transfee(sor, self.resellerid, biz_order.amount, self.curdate)
|
transfee = await get_transfee(sor, self.resellerid, biz_order.amount, self.curdate)
|
||||||
self.variable = {
|
accountset['交易费用'] = transfee
|
||||||
"交易金额":biz_order.amount,
|
accountset.subsets = []
|
||||||
"交易费用":transfee
|
for od in biz_orderdetails:
|
||||||
}
|
|
||||||
bill = await write_bill(sor, self.customerid, self.userid,
|
|
||||||
self.orderid,
|
|
||||||
self.business_op,
|
|
||||||
biz_order.amount)
|
|
||||||
|
|
||||||
self.billid = bill.id
|
|
||||||
self.bill = bill
|
|
||||||
self.providerid = None
|
|
||||||
self.resellerid = None
|
|
||||||
self.action = self.recharge.action
|
|
||||||
self.productid = None
|
|
||||||
self.timestamp = timestampstr()
|
|
||||||
a = Accounting(self)
|
|
||||||
r = await a.do_accounting(sor)
|
|
||||||
for detail in details:
|
|
||||||
detail.prod_config = json.loads(detail.prod_config)
|
|
||||||
price_infos = await get_price_infos(sor, self.resellerid,
|
price_infos = await get_price_infos(sor, self.resellerid,
|
||||||
self.customerid,
|
self.customerid,
|
||||||
detail.productid,
|
detail.productid,
|
||||||
detail.prod_config)
|
detail.prod_config)
|
||||||
|
if len(price_infos) > 1:
|
||||||
|
for pi in price_infos[:-1]:
|
||||||
|
actions = biz_order.business_op.split('_')
|
||||||
|
actions[0] = actions[0] + '*'
|
||||||
|
aset = DictObject()
|
||||||
|
aset['action'] = '_'.join(actions)
|
||||||
|
aset['owner'] = get_owner_orgid(sor, '0')
|
||||||
|
aset['reseller'] = pi['buyerid']
|
||||||
|
aset['provider'] = pi['resellerid']
|
||||||
|
aset['采购成本'] = pi['sell_price']
|
||||||
|
accountset.subsets.append(aset)
|
||||||
|
return accountset
|
||||||
|
|
||||||
|
async def accounting(self, sor, biz_orderid):
|
||||||
|
biz_order = await sor.R('biz_order', {'id':biz_orderid})
|
||||||
|
details = await sor.R('biz_orderdetail',{'orderid':biz_orderid})
|
||||||
|
accountset = await self.build_accountset(biz_order, details)
|
||||||
|
self.curdate = await get_business_date(sor)
|
||||||
|
transfee = await get_transfee(sor, self.resellerid, biz_order.amount, self.curdate)
|
||||||
|
a = BizAccounting(self.curdate, biz_order, accountset)
|
||||||
|
r = await a.do_accounting(sor)
|
||||||
|
|
||||||
async def get_orgid_by_trans_role(self, sor, orgtype):
|
async def get_orgid_by_trans_role(self, sor, orgtype):
|
||||||
if orgtype== 'customer':
|
if orgtype== 'customer':
|
||||||
@ -109,5 +109,3 @@ class PlatformBizAccRecharge(PlatformBizAcc):
|
|||||||
a = Accounting(self)
|
a = Accounting(self)
|
||||||
r = await a.do_accounting(sor)
|
r = await a.do_accounting(sor)
|
||||||
|
|
||||||
async def PayAccounting(sor):
|
|
||||||
pass
|
|
||||||
|
@ -18,6 +18,7 @@ a.description,
|
|||||||
a.prod_state,
|
a.prod_state,
|
||||||
a.product_code,
|
a.product_code,
|
||||||
a.spec_note,
|
a.spec_note,
|
||||||
|
b.id as apid,
|
||||||
d.id as agreeid,
|
d.id as agreeid,
|
||||||
d.providerid,
|
d.providerid,
|
||||||
d.resellerid
|
d.resellerid
|
||||||
@ -35,8 +36,9 @@ where a.id = b.providerpid
|
|||||||
return
|
return
|
||||||
|
|
||||||
for rec in recs:
|
for rec in recs:
|
||||||
|
pid = getID()
|
||||||
d = {
|
d = {
|
||||||
"id":getID(),
|
"id":pid,
|
||||||
"name":rec.name,
|
"name":rec.name,
|
||||||
"prodtypeid":rec.prodtypeid,
|
"prodtypeid":rec.prodtypeid,
|
||||||
"orgid":rec.resellerid,
|
"orgid":rec.resellerid,
|
||||||
@ -49,6 +51,7 @@ where a.id = b.providerpid
|
|||||||
"spec_note":rec.spec_note
|
"spec_note":rec.spec_note
|
||||||
}
|
}
|
||||||
await sor.C('product', d)
|
await sor.C('product', d)
|
||||||
|
await sor.U('agreeproduct', {'id':rec.apid, 'resellerpid':pid})
|
||||||
|
|
||||||
async def open_agree_account(sor, providerid, sellerid):
|
async def open_agree_account(sor, providerid, sellerid):
|
||||||
accounting_orgid = await get_accounting_orgid(sor)
|
accounting_orgid = await get_accounting_orgid(sor)
|
||||||
|
@ -3,6 +3,7 @@ from appPublic.registerfunction import rfexe
|
|||||||
from appPublic.log import exception, debug
|
from appPublic.log import exception, debug
|
||||||
from sqlor.dbpools import DBPools
|
from sqlor.dbpools import DBPools
|
||||||
from pf_pay.ali_pay import Zhifubao_Pay
|
from pf_pay.ali_pay import Zhifubao_Pay
|
||||||
|
from getdbname import get_dbname
|
||||||
from platformbiz.biz_order import add_recharge_log, add_recharge_order
|
from platformbiz.biz_order import add_recharge_log, add_recharge_order
|
||||||
|
|
||||||
class Recharge:
|
class Recharge:
|
||||||
@ -23,7 +24,7 @@ class Recharge:
|
|||||||
|
|
||||||
async def start_recharge_action(self, action):
|
async def start_recharge_action(self, action):
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
dbname = await rfexe('get_module_dbname', 'platformbiz')
|
dbname = get_dbname()
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
order = await add_recharge_order(sor, self.customerid,
|
order = await add_recharge_order(sor, self.customerid,
|
||||||
self.userid,
|
self.userid,
|
||||||
|
9
wwwroot/agree_prodclone.dspy
Normal file
9
wwwroot/agree_prodclone.dspy
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
debug(f'{params_kw=}')
|
||||||
|
orgid = await get_userorgid()
|
||||||
|
db = DBPools()
|
||||||
|
dbname = get_module_dbname('platformbiz')
|
||||||
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
await agree_products_clone(sor, orgid, params_kw.id)
|
||||||
|
return UiMessage(title='product clone', message='product clone finished')
|
||||||
|
debug('product clone error')
|
||||||
|
return UiError(title='product clone', message='product clone error')
|
Loading…
Reference in New Issue
Block a user