From 9547d18099c872efa9fe4b543a2c593c27b29100 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GG6FIN9\\Administrator" <15040771@qq.com> Date: Sat, 18 Jul 2020 17:02:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/CouponController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Controller/CouponController.php b/app/Controller/CouponController.php index 0c124c2..6641db1 100644 --- a/app/Controller/CouponController.php +++ b/app/Controller/CouponController.php @@ -159,11 +159,10 @@ class CouponController extends BaseController $expired = []; $couponIds = $couponIds->toArray(); - $coupons = Coupon::orderByRaw('FIELD(id, ' . implode(", ", $couponIds) . ')')->get(); - - + $coupons = Coupon::whereIn('id',$couponIds)->get(); + foreach ($coupons as $key => $coupon) { - if ($coupon->usable_end_time < $nowTime) { + if ($coupon->usable_end_time < $nowTime || $coupon->status != 1) { $expired[] = $coupon; } else { $not_expired[] = $coupon;