This commit is contained in:
hrx 2025-10-21 16:48:36 +08:00
commit 9561a142d9
3 changed files with 14833 additions and 24 deletions

View File

@ -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}$"

View File

@ -2,7 +2,7 @@ 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'):
@ -27,7 +27,8 @@ async def getpromoting(ns):
ns['orgid'] = orgid[0]['orgid']
reacs = await sor.R('promoting', ns)
return {'status': True, 'data': reacs}
return {'status': False, 'msg': '参数不正确'}
# return {'status': False, 'msg': '参数不正确'}
ret = await getpromoting(params_kw)
return ret

14775
docs/API模块文档.md Normal file

File diff suppressed because one or more lines are too long