From 15a47946394a8f8b94488bd21309a5057305b4bf Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 9 Nov 2023 14:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=8D=B7=E5=8D=B3=E5=B0=86=E8=BF=87=E6=9C=9F=E6=8F=90?= =?UTF-8?q?=E9=86=92=E9=98=9F=E5=88=97=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/CouponService.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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);