bugfix
This commit is contained in:
parent
c890fdf249
commit
98581b2a37
@ -65,7 +65,7 @@ async def set_promote_discount(request, params_kw):
|
|||||||
need_new_discount = await disable_old_discount(sor, recs[0].resellerid,
|
need_new_discount = await disable_old_discount(sor, recs[0].resellerid,
|
||||||
customerid, biz_date, recs[0].discount)
|
customerid, biz_date, recs[0].discount)
|
||||||
if not need_new_discount:
|
if not need_new_discount:
|
||||||
return
|
return await sor_get_customer_discount(sor, recs[0].resellerid, customerid)
|
||||||
ret = {
|
ret = {
|
||||||
'id': getID(),
|
'id': getID(),
|
||||||
'resellerid': recs[0].resellerid,
|
'resellerid': recs[0].resellerid,
|
||||||
@ -75,7 +75,7 @@ async def set_promote_discount(request, params_kw):
|
|||||||
'expired_date': expired_date
|
'expired_date': expired_date
|
||||||
}
|
}
|
||||||
await sor.C('discount', ret.copy())
|
await sor.C('discount', ret.copy())
|
||||||
return DictObject(**ret)
|
return recs[0].discount
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def disable_old_discount(sor, resellerid, customerid, biz_date, new_discount):
|
async def disable_old_discount(sor, resellerid, customerid, biz_date, new_discount):
|
||||||
@ -87,7 +87,7 @@ where resellerid = ${resellerid}$
|
|||||||
recs = await sor.sqlExe(sql, {'resellerid': resellerid, 'customerid': customerid, 'biz_date': biz_date})
|
recs = await sor.sqlExe(sql, {'resellerid': resellerid, 'customerid': customerid, 'biz_date': biz_date})
|
||||||
if not recs:
|
if not recs:
|
||||||
return True
|
return True
|
||||||
if new_discount > news[0].discount:
|
if new_discount > recs[0].discount:
|
||||||
return False
|
return False
|
||||||
await sor.U('discount', {'id': recs[0].id, 'expired_date': biz_date})
|
await sor.U('discount', {'id': recs[0].id, 'expired_date': biz_date})
|
||||||
return True
|
return True
|
||||||
|
|||||||
@ -3,3 +3,4 @@ if orgid is None:
|
|||||||
return UiError(title='Error', message='You need login')
|
return UiError(title='Error', message='You need login')
|
||||||
|
|
||||||
ret = await set_promote_discount(request, params_kw)
|
ret = await set_promote_discount(request, params_kw)
|
||||||
|
return UiMessage(title="Succeeded", message=f'获得{ret}折扣')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user