From 579cd1fd60feba386a43c5fb0011ef9c8ebf58d9 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 26 Aug 2020 16:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20=E4=BF=AE=E6=94=B9=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponService.php | 48 +---------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/app/Service/CouponService.php b/app/Service/CouponService.php index d64b786..10ab91d 100644 --- a/app/Service/CouponService.php +++ b/app/Service/CouponService.php @@ -219,9 +219,8 @@ class CouponService implements CouponServiceInterface ->where('money',0.01) ->exists(); if($shopCarExists){ - var_dump(1111); foreach ($available as $k => $v) { - $v->msg = '特价商品不可使用'; + $v->msg = '不可使用'; $notAvailable[$v->id] = $v; } $available = []; @@ -295,51 +294,6 @@ class CouponService implements CouponServiceInterface return $setRes&&$expireRes; } - /** - * 取消订单返券 - * @param $order_id - * @return bool - */ - public function refundOrderCoupons($global_order_id){ - $order_main = OrderMain::where('global_order_id',$global_order_id) - ->select('id','user_id') - ->first(); - $order_id = $order_main->id; - $coupon = CouponUserUse::where([ - ['order_main_id','=',$order_id], - ['status','=',CouponUserUse::COUPON_USE_STATE_USED], - ]) - ->select('id','user_receive_id','number') - ->first(); - - if (empty($coupon)) { - return ''; - } - - // 返回用户优惠券数量并更新状态 - $res = Db::update("UPDATE ims_system_coupon_user_receive SET number_remain=number_remain+{$coupon->number}, status=IF(number=number_remain,0,1), update_time=".time()."" - ." WHERE id={$coupon->user_receive_id} AND number>=(number_remain+{$coupon->number})"); - - // 更新使用记录状态为已退回 - CouponUserUse::where([ - ['id','=',$coupon->id], - ['status','=',CouponUserUse::COUPON_USE_STATE_USED], - ]) - ->update([ - 'status' => CouponUserUse::COUPON_USE_STATE_CANCEL, - 'return_time' => time(), - 'update_time' => time(), - ]); - - //删除当日 redis 使用记录缓存 - $redis = ApplicationContext::getContainer()->get(Redis::class); - $remRes = $redis->sRem( - 'coupon_'.date('Ymd').'_used_'.$order_main->user_id, - $coupon->system_coupon_id - ); - return $remRes; - } - /* 删除-优惠券今日使用的缓存 * @param $userId * @param $couponId