fix : coupon date

This commit is contained in:
2025-08-06 12:44:58 +08:00
parent edf270a6ce
commit eb0ce8a347

View File

@@ -13,6 +13,7 @@ namespace App\Cron\Coupon;
use App\Constants\Common\CouponCode; use App\Constants\Common\CouponCode;
use App\Lib\Log; use App\Lib\Log;
use App\Model\UserCoupon; use App\Model\UserCoupon;
use Exception;
use Hyperf\Crontab\Annotation\Crontab; use Hyperf\Crontab\Annotation\Crontab;
use Hyperf\Di\Annotation\Inject; use Hyperf\Di\Annotation\Inject;
@@ -35,7 +36,7 @@ class UserCouponTask
{ {
try { try {
$this->userCouponModel $this->userCouponModel
->whereTime('validity_end_time', '<', date('Y-m-d H:i:s')) ->whereTime('validity_end_time', '>', date('Y-m-d H:i:s'))
->where('status', CouponCode::COUPON_STATUS_UNUSED) ->where('status', CouponCode::COUPON_STATUS_UNUSED)
->update(['status' => CouponCode::COUPON_STATUS_EXPIRE]); ->update(['status' => CouponCode::COUPON_STATUS_EXPIRE]);
}catch (Exception $e){ }catch (Exception $e){