fix : coupon date

This commit is contained in:
2025-08-06 11:41:35 +08:00
parent ff36733005
commit c4c154cbb9
2 changed files with 47 additions and 0 deletions

View File

@@ -33,8 +33,10 @@ trait CouponTrait
$couponInfo = $this->userCouponModel->where('id', $orderInfo->coupon_id)->where('user_id',$orderInfo->user_id)->first();
if (empty($couponInfo)) return;
if ($couponInfo->status != CouponCode::COUPON_STATUS_USED) return;
$couponInfo->status = CouponCode::COUPON_STATUS_UNUSED;
$couponInfo->use_time = null;
if (date('Y-m-d H:i:s') > $couponInfo->validity_end_time) $couponInfo->status = CouponCode::COUPON_STATUS_EXPIRE;