bugfix
This commit is contained in:
parent
950faaab03
commit
a56b15c92c
6
platformbiz/accounting.py
Normal file
6
platformbiz/accounting.py
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
async def get_accounting_orgid(sor, leg):
|
||||
return '0'
|
||||
|
||||
async def get_accountid(sor, leg):
|
||||
|
12
platformbiz/init.py
Normal file
12
platformbiz/init.py
Normal file
@ -0,0 +1,12 @@
|
||||
from ahserver.serverenv import ServerEnv, get_serverenv
|
||||
from platformbiz.recharge import Recharge
|
||||
from platformbiz.pb_acc import PlatformBizAccRecharge, get_owner_orgid
|
||||
from platformbiz.biz_order import change_recharge_status
|
||||
|
||||
def load_platformbiz():
|
||||
g = ServerEnv()
|
||||
g.Recharge = Recharge
|
||||
g.PlatformBizAccRecharge = PlatformBizAccRecharge
|
||||
g.change_recharge_status = change_recharge_status
|
||||
g.get_owner_orgid = get_owner_orgid
|
||||
|
58
platformbiz/pb_acc.py
Normal file
58
platformbiz/pb_acc.py
Normal file
@ -0,0 +1,58 @@
|
||||
import time
|
||||
from appPublic.timeUtils import timestampstr
|
||||
from ahserver.serverenv import get_serverenv
|
||||
from accounting.accounting_config import Accounting
|
||||
from accounting.bill import write_bill
|
||||
|
||||
def get_owner_orgid(sor, orgid):
|
||||
return '0'
|
||||
|
||||
class PlatformBizAcc:
|
||||
async def get_orgid_by_trans_role(self, sor, orgtype):
|
||||
if orgtype== 'customer':
|
||||
return self.customerid
|
||||
if orgtype== 'reseller':
|
||||
return self.resellerid
|
||||
if orgtype== 'provider':
|
||||
return self.providerid
|
||||
if orgtype == 'owner':
|
||||
return '0'
|
||||
return None
|
||||
|
||||
class PlatformBizAccRecharge(PlatformBizAcc):
|
||||
def __init__(self, rlid):
|
||||
self.rlid = rlid
|
||||
|
||||
async def accounting(self, sor):
|
||||
sql = """select * from recharge_log where id=${rlid}$"""
|
||||
recs = await sor.sqlExe(sql, {'rlid':self.rlid})
|
||||
if len(recs) < 1:
|
||||
e = Exception(f'get recharge log err by {rlid=}')
|
||||
exception(f'{e=}')
|
||||
raise e
|
||||
self.recharge = recs[0]
|
||||
self.customerid = self.recharge.customerid
|
||||
self.orderid = self.recharge.orderid
|
||||
self.userid = self.recharge.userid
|
||||
get_business_date = get_serverenv('get_business_date')
|
||||
self.curdate = await get_business_date(sor)
|
||||
self.variable = {
|
||||
"交易金额":self.recharge.recharge_amt,
|
||||
"充值费率":self.recharge.fee_rate,
|
||||
"充值费用":self.recharge.feemat
|
||||
}
|
||||
bill = await write_bill(sor, self.customerid, self.userid,
|
||||
self.recharge.orderid,
|
||||
self.recharge.action,
|
||||
self.recharge.recharge_amt)
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user