24 lines
946 B
Plaintext
24 lines
946 B
Plaintext
async def chargeback(ns):
|
|
""" 退单
|
|
id:订单的id
|
|
"""
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
await sor.U('bz_order', {'id':ns['id'],'business_op':'BUY_REVERSE','order_status':'0'})
|
|
await order2bill(ns['id'], sor)
|
|
bills = await sor.R('bill', {'orderid':ns.get('id')})
|
|
for i in bills:
|
|
ba = BillAccounting(i)
|
|
r = await ba.accounting(sor)
|
|
order_goods = await sor.R('customer_goods', {'orderid': ns['id']})
|
|
for j in order_goods:
|
|
await sor.U('customer_goods', {'id': j['id'],'del_flg':'1'})
|
|
await sor.U('bz_order', {'id': ns['id'], 'order_status':'3'})
|
|
return {'status': True, 'msg': '成功'}
|
|
except Exception as e:
|
|
raise e
|
|
return {'status': False, 'msg': '失败'}
|
|
|
|
ret = await chargeback(params_kw)
|
|
return ret |