From 240f58c43ef79907cd7696efe83d9f20fe4fe782 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GG6FIN9\\Administrator" <15040771@qq.com> Date: Thu, 6 Aug 2020 11:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=A2=9E=E6=88=96=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponRebateService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Service/CouponRebateService.php b/app/Service/CouponRebateService.php index 48d8596..78213ae 100644 --- a/app/Service/CouponRebateService.php +++ b/app/Service/CouponRebateService.php @@ -174,7 +174,6 @@ class CouponRebateService implements CouponRebateServiceInterface */ public function couponRebate($order_id) { - /* 判断优惠券类型是否为转发活动优惠券 */ $coupon = Db::table('ims_system_coupon_user_receive as r') ->leftjoin('ims_system_coupon_user_use as u', 'u.user_receive_id', '=', 'r.id') @@ -212,7 +211,7 @@ class CouponRebateService implements CouponRebateServiceInterface * 否则新增一条返券记录 */ $nowTime = time(); - $res = Db::table('ims_system_coupon_user_receive')->updateOrInsert( + $res = Db::table('ims_system_coupon_user_receive')->updateOrIncrement( [ 'system_coupon_user_id' => $coupon->system_coupon_id, 'user_id' => $coupon->send_user_id, @@ -222,11 +221,13 @@ class CouponRebateService implements CouponRebateServiceInterface [ 'order_main_id' => $order_id, 'receive_time' => $nowTime, - 'number' => 1, - 'number_remain' => 1, 'update_time' => $nowTime, 'created_at' => $nowTime, 'updated_at' => $nowTime, + ], + [ + 'number' => 1, + 'number_remain' => 1, ] ); // if ($res) {