diff --git a/discount/init.py b/discount/init.py index 5624b37..531e363 100644 --- a/discount/init.py +++ b/discount/init.py @@ -65,7 +65,7 @@ async def set_promote_discount(request, params_kw): need_new_discount = await disable_old_discount(sor, recs[0].resellerid, customerid, biz_date, recs[0].discount) if not need_new_discount: - return + return await sor_get_customer_discount(sor, recs[0].resellerid, customerid) ret = { 'id': getID(), 'resellerid': recs[0].resellerid, @@ -75,7 +75,7 @@ async def set_promote_discount(request, params_kw): 'expired_date': expired_date } await sor.C('discount', ret.copy()) - return DictObject(**ret) + return recs[0].discount return None 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}) if not recs: return True - if new_discount > news[0].discount: + if new_discount > recs[0].discount: return False await sor.U('discount', {'id': recs[0].id, 'expired_date': biz_date}) return True diff --git a/wwwroot/promote/index.dspy b/wwwroot/promote/index.dspy index 583deae..83520ca 100644 --- a/wwwroot/promote/index.dspy +++ b/wwwroot/promote/index.dspy @@ -3,3 +3,4 @@ if orgid is None: return UiError(title='Error', message='You need login') ret = await set_promote_discount(request, params_kw) +return UiMessage(title="Succeeded", message=f'获得{ret}折扣')