diff --git a/app/Services/CouponService.php b/app/Services/CouponService.php index 8cdd3ab..d7d98e8 100644 --- a/app/Services/CouponService.php +++ b/app/Services/CouponService.php @@ -154,20 +154,18 @@ class CouponService extends BaseService try { // 添加优惠卷即将过期提醒队列 - if ($time > 60 * 60 * 24 * 2) { - $time = 60 * 60 * 24 * 2; - } else { - if ($time > 60 * 60 * 5){ - $time = $time - 60 * 60 * 5; + $time = floor($time * 0.25); + + // 时间低于5小时,不进行过期提醒 + if ($time > 60 * 60 * 5){ + $message = new UserCouponExpiredNoticeDelayDirectProducer($data); + $message->setDelayMs(1000 * $time); + $producer = $this->container->get(Producer::class); + $res = $producer->produce($message); + if (!$res) { + Log::getInstance("CouponService-GrantUserCoupon")->error("添加优惠卷即将过期提醒队列"); } } - $message = new UserCouponExpiredNoticeDelayDirectProducer($data); - $message->setDelayMs(1000 * $time); - $producer = $this->container->get(Producer::class); - $res = $producer->produce($message); - if (!$res) { - Log::getInstance("CouponService-GrantUserCoupon")->error("添加优惠卷即将过期提醒队列"); - } // 通知-患者-优惠卷发放 $MessagePush = new MessagePush($user_id);