Merge branch 'main' of https://git.opencomputing.cn/yumoqing/kboss
This commit is contained in:
commit
9561a142d9
@ -47,6 +47,39 @@ async def getbz_order(ns={}):
|
||||
AND bo.customerid = ${customerid}$
|
||||
"""
|
||||
|
||||
# # 统计全部 累计支付金额和累计优惠金额 不包含各种筛选条件
|
||||
# # 累计支付金额=BUY+RENEW-BUY_REVERSE实际支付金额 累计优惠金额=BUY+RENEW-BUY_REVERSE优惠金额
|
||||
# total_amount_sql = """
|
||||
# SELECT
|
||||
# COALESCE(SUM(
|
||||
# CASE
|
||||
# WHEN bo.business_op IN ('BUY', 'RENEW') THEN og.amount
|
||||
# WHEN bo.business_op = 'BUY_REVERSE' THEN -og.amount
|
||||
# ELSE 0
|
||||
# END
|
||||
# ), 0) AS total_paid_amount,
|
||||
# COALESCE(SUM(
|
||||
# CASE
|
||||
# WHEN bo.business_op IN ('BUY', 'RENEW') THEN (og.list_price * og.quantity - og.amount)
|
||||
# WHEN bo.business_op = 'BUY_REVERSE' THEN -(og.list_price * og.quantity - og.amount)
|
||||
# ELSE 0
|
||||
# END
|
||||
# ), 0) AS total_discount_amount
|
||||
# FROM order_goods og
|
||||
# JOIN bz_order bo ON og.orderid = bo.id
|
||||
# WHERE og.del_flg = '0'
|
||||
# AND bo.del_flg = '0'
|
||||
# AND bo.customerid = ${customerid}$
|
||||
# """
|
||||
# total_amount_result = await sor.sqlExe(total_amount_sql, {'customerid': customerid})
|
||||
# total_paid_amount = float(total_amount_result[0]['total_paid_amount']) if total_amount_result else 0.0
|
||||
# total_discount_amount = float(total_amount_result[0]['total_discount_amount']) if total_amount_result else 0.0
|
||||
# # 将累计支付金额和累计优惠金额添加到返回结果中
|
||||
# ns['total_paid_amount'] = total_paid_amount
|
||||
# ns['total_discount_amount'] = total_discount_amount
|
||||
# ns['total_count'] = total_count[0]['total_count'] if total_count else 0
|
||||
|
||||
|
||||
# 根据订单号搜索
|
||||
if ns.get('id'):
|
||||
sql += " AND bo.id LIKE ${order_id}$"
|
||||
|
||||
@ -2,32 +2,33 @@ async def getpromoting(ns):
|
||||
"""促销展示"""
|
||||
db = DBPools()
|
||||
async with db.sqlorContext('kboss') as sor:
|
||||
if ns:
|
||||
# if ns:
|
||||
# 生成邀请码展示促销活动
|
||||
users_id = await get_user()
|
||||
if ns.get('type'):
|
||||
ns['sort'] = 'create_at desc'
|
||||
users_id = await get_user()
|
||||
if ns.get('type'):
|
||||
ns['sort'] = 'create_at desc'
|
||||
|
||||
orgid = await sor.R('users', {'id': users_id})
|
||||
ns['orgid'] = orgid[0]['orgid']
|
||||
# reacs = await sor.R('promoting', ns)
|
||||
dates = datetime.datetime.now()
|
||||
promoting = """select * from promoting where del_flg = 0 and orgid = ${orgid}$ and end_date > ${dates}$ order by create_at desc"""
|
||||
reacs = await sor.sqlExe(promoting, {'orgid': ns['orgid'],'dates':dates})
|
||||
date = await get_business_date(sor=None)
|
||||
listdata = []
|
||||
for i in reacs:
|
||||
if i['end_date'] > date:
|
||||
listdata.append(i)
|
||||
return {'status': True, 'data': listdata}
|
||||
else:
|
||||
ns['del_flg'] = '0'
|
||||
ns['sort'] = 'create_at desc'
|
||||
orgid = await sor.R('users', {'id': users_id})
|
||||
ns['orgid'] = orgid[0]['orgid']
|
||||
reacs = await sor.R('promoting', ns)
|
||||
return {'status': True, 'data': reacs}
|
||||
return {'status': False, 'msg': '参数不正确'}
|
||||
orgid = await sor.R('users', {'id': users_id})
|
||||
ns['orgid'] = orgid[0]['orgid']
|
||||
# reacs = await sor.R('promoting', ns)
|
||||
dates = datetime.datetime.now()
|
||||
promoting = """select * from promoting where del_flg = 0 and orgid = ${orgid}$ and end_date > ${dates}$ order by create_at desc"""
|
||||
reacs = await sor.sqlExe(promoting, {'orgid': ns['orgid'],'dates':dates})
|
||||
date = await get_business_date(sor=None)
|
||||
listdata = []
|
||||
for i in reacs:
|
||||
if i['end_date'] > date:
|
||||
listdata.append(i)
|
||||
return {'status': True, 'data': listdata}
|
||||
else:
|
||||
ns['del_flg'] = '0'
|
||||
ns['sort'] = 'create_at desc'
|
||||
orgid = await sor.R('users', {'id': users_id})
|
||||
ns['orgid'] = orgid[0]['orgid']
|
||||
reacs = await sor.R('promoting', ns)
|
||||
return {'status': True, 'data': reacs}
|
||||
|
||||
# return {'status': False, 'msg': '参数不正确'}
|
||||
|
||||
ret = await getpromoting(params_kw)
|
||||
return ret
|
||||
14775
docs/API模块文档.md
Normal file
14775
docs/API模块文档.md
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user