diff --git a/app/api/endpoints/coupon_activity.py b/app/api/endpoints/coupon_activity.py index 9ab5a81..c709408 100644 --- a/app/api/endpoints/coupon_activity.py +++ b/app/api/endpoints/coupon_activity.py @@ -171,7 +171,9 @@ async def check_activity_can_receive( CouponReceiveRecordDB.activity_id == activity_id ).scalar() - if activity.total_limit > 0 and total_receive_count >= activity.total_limit: + total = total_receive_count if total_receive_count else 0 + + if activity.total_limit > 0 and total >= activity.total_limit: return False, f"优惠券活动已领完", activity # 检查用户领取次数 diff --git a/jobs.sqlite b/jobs.sqlite index 707156c..2d927b6 100644 Binary files a/jobs.sqlite and b/jobs.sqlite differ