update
This commit is contained in:
parent
2a58fcc52d
commit
c713ec9a50
@ -185,17 +185,7 @@ async def list_merchants(
|
||||
|
||||
merchants = query.offset(skip).limit(limit).all()
|
||||
|
||||
# 获取商家在线买单数量
|
||||
merchant_ids = [m[0].id for m in merchants]
|
||||
pay_order_counts = dict(
|
||||
db.query(
|
||||
MerchantPayOrderDB.merchant_id,
|
||||
func.count(MerchantPayOrderDB.id).label('count')
|
||||
).filter(
|
||||
MerchantPayOrderDB.merchant_id.in_(merchant_ids)
|
||||
).group_by(MerchantPayOrderDB.merchant_id).all()
|
||||
)
|
||||
|
||||
# 获取商家最新或限购商品
|
||||
merchant_products = {}
|
||||
for merchant_id in merchant_ids:
|
||||
@ -233,7 +223,7 @@ async def list_merchants(
|
||||
"category_name": m[1],
|
||||
"user_phone": m[2],
|
||||
"user_nickname": m[3],
|
||||
"online_pay_count": pay_order_counts.get(m[0].id, 0),
|
||||
"gift_points_rate_text": f"赠送蜂蜜 {m[0].pay_gift_points_rate * 10}%",
|
||||
"featured_product": merchant_products.get(m[0].id),
|
||||
"distance": round(m[4]) if longitude is not None and latitude is not None else None
|
||||
} for m in merchants]
|
||||
|
||||
@ -249,10 +249,10 @@ async def payment_notify(
|
||||
|
||||
if trade_state_desc == "支付成功":
|
||||
|
||||
if order.gift_points > 0:
|
||||
# 添加积分
|
||||
point_manager = PointManager(db)
|
||||
point_manager.add_points(order.user_id, order.gift_points, PointRecordType.CONSUME_RETURN, f"团购订单奖励", order.order_id)
|
||||
# if order.gift_points > 0:
|
||||
# # 添加积分
|
||||
# point_manager = PointManager(db)
|
||||
# point_manager.add_points(order.user_id, order.gift_points, PointRecordType.CONSUME_RETURN, f"团购订单奖励", order.order_id)
|
||||
|
||||
# 更新订单状态
|
||||
order.pay_status = True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user