This commit is contained in:
aaron 2025-04-01 12:36:14 +08:00
parent 9b2cf46403
commit 53b3f09327
3 changed files with 3 additions and 3 deletions

View File

@ -167,7 +167,7 @@ async def check_activity_can_receive(
return False, "不在领取时间范围内", activity
# 检查总领取次数
total_receive_count = db.query(func.count(CouponReceiveRecordDB.id)).filter(
total_receive_count = db.query(func.sum(CouponReceiveRecordDB.receive_count)).filter(
CouponReceiveRecordDB.activity_id == activity_id
).scalar()
@ -181,7 +181,7 @@ async def check_activity_can_receive(
).first()
if record:
if record.receive_count >= activity.user_limit:
if activity.user_limit > 0 and record.receive_count >= activity.user_limit:
return False, "你已经领过了", activity
return True, "可领取", activity

View File

@ -852,7 +852,7 @@ async def cancel_order(
return error_response(code=404, message="订单不存在")
# 检查订单状态是否可取消
if order.status not in [OrderStatus.CREATED, OrderStatus.RECEIVED]:
if order.status not in [OrderStatus.CREATED, OrderStatus.UNPAID]:
return error_response(code=400, message="当前订单状态不可取消")
try:

Binary file not shown.