35 lines
1.8 KiB
Plaintext
35 lines
1.8 KiB
Plaintext
async def getrechargelog(ns):
|
|
""" 展示我的客户充值记录 """
|
|
db = DBPools()
|
|
users_id = await get_user()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
recharge_log = await sor.R('recharge_log',
|
|
{'sort': 'create_at desc', 'page': ns['page'], 'op_userid': users_id,
|
|
'del_flg': '0'})
|
|
if len(recharge_log['rows']) >= 1:
|
|
billid = await sor.R('bill', {'sort': 'create_at desc','customerid': recharge_log['rows'][0]['customerid']})
|
|
for j in recharge_log['rows']:
|
|
RECHARGE_REVERSE = await sor.R('recharge_log',
|
|
{'sort': 'create_at desc','del_flg': '0', 'op_userid': users_id, 'original_id': j['id']})
|
|
if len(RECHARGE_REVERSE) >= 1:
|
|
j['RECHARGE_REVERSE'] = '冲账'
|
|
org = await sor.R('organization', {'sort': 'create_at desc','id': j['customerid'], 'del_flg': '0'})
|
|
if len(org) >= 1:
|
|
j['customerid'] = org[0]['orgname']
|
|
j['orgid'] = org[0]['id']
|
|
if j['recharge_path'] == '0':
|
|
j['recharge_path'] = '支付宝'
|
|
elif j['recharge_path'] == '1':
|
|
j['recharge_path'] = '微信'
|
|
elif j['recharge_path'] == '2':
|
|
j['recharge_path'] = '线下充值'
|
|
if j['action'] == 'RECHARGE':
|
|
j['action'] = '充值'
|
|
else:
|
|
j['action'] = '充值冲账'
|
|
else:
|
|
continue
|
|
return {'status': True, 'data': recharge_log,'billid':billid}
|
|
|
|
ret = await getrechargelog(params_kw)
|
|
return ret |