From 53b3f093279866f10fbbf18fbdcfd5a4aaf793ac Mon Sep 17 00:00:00 2001 From: aaron <> Date: Tue, 1 Apr 2025 12:36:14 +0800 Subject: [PATCH] update --- app/api/endpoints/coupon_activity.py | 4 ++-- app/api/endpoints/order.py | 2 +- jobs.sqlite | Bin 24576 -> 24576 bytes 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/endpoints/coupon_activity.py b/app/api/endpoints/coupon_activity.py index 81ef7da..45dd7e2 100644 --- a/app/api/endpoints/coupon_activity.py +++ b/app/api/endpoints/coupon_activity.py @@ -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 diff --git a/app/api/endpoints/order.py b/app/api/endpoints/order.py index 147099b..c9da6b4 100644 --- a/app/api/endpoints/order.py +++ b/app/api/endpoints/order.py @@ -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: diff --git a/jobs.sqlite b/jobs.sqlite index 0c998a1b876d1afcd589f87c8badcef25c104ae0..2d9ef7d260180eb1053d402483a2fa3aa118749f 100644 GIT binary patch delta 19 bcmZoTz}Rqrae_4C?TIqZjJG!?EQkjHO+5$Z delta 19 bcmZoTz}Rqrae_4C#fdV`j2Aa1EQkjHOs5CZ