kboss/b/promoting/getpromote_discount.dspy
2025-07-16 14:27:17 +08:00

17 lines
710 B
Plaintext

async def getpromote_discount(ns):
"""展示促销产品折扣"""
db = DBPools()
async with db.sqlorContext('kboss') as sor:
if ns:
ns['del_flg'] = '0'
ns['sort'] = 'create_at desc'
promote_discount = await sor.R('promote_discount', ns)
for i in promote_discount['rows']:
product = await sor.R('product', {'id': i['productid'],'del_flg':'0'})
if len(product) >= 1:
i['productid'] = product[0]
continue
return {'status': True, 'data': promote_discount}
return {'status': False, 'msg': '参数错误'}
ret = await getpromote_discount(params_kw)
return ret