44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
async def huiyong_zibiao_jia(ns={}):
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
if not ns.get('rebate_zhubiao_id'):
|
|
ns_zhubiao = {
|
|
'id': uuid(),
|
|
'protocolid': ns.get('protocolid'),
|
|
'rebate_cycle': ns.get('rebate_cycle'),
|
|
'sette_dp': ns.get('sette_dp')
|
|
}
|
|
ns_zibiao = {
|
|
'id': uuid(),
|
|
'rebatecycleid': ns_zhubiao['id'],
|
|
'sale_amount':ns.get('sale_amount'),
|
|
'rebate_rate': float(ns.get('rebate_rate'))
|
|
}
|
|
await sor.C('rebate_cycle', ns_zhubiao)
|
|
await sor.C('rp_rebate', ns_zibiao)
|
|
return {
|
|
'status': True,
|
|
'msg': '回佣添加成功'
|
|
}
|
|
else:
|
|
ns_zibiao = {
|
|
'id': uuid(),
|
|
'rebatecycleid': ns.get('rebate_zhubiao_id'),
|
|
'sale_amount': ns.get('sale_amount'),
|
|
'rebate_rate': float(ns.get('rebate_rate'))
|
|
}
|
|
await sor.C('rp_rebate', ns_zibiao)
|
|
return {
|
|
'status': True,
|
|
'msg': '回佣内容添加成功'
|
|
}
|
|
except Exception as e:
|
|
raise e
|
|
return {
|
|
'status': False,
|
|
'msg': '回佣添加失败'
|
|
}
|
|
|
|
ret = await huiyong_zibiao_jia(params_kw)
|
|
return ret |