作者 lihan
1 个管道 的构建 通过 耗费 0 秒

赠送优惠券

@@ -137,12 +137,10 @@ class IndexController extends HomeBaseController @@ -137,12 +137,10 @@ class IndexController extends HomeBaseController
137 if ($request->isAjax()) { 137 if ($request->isAjax()) {
138 $user_id = session('user.id'); 138 $user_id = session('user.id');
139 $tel = $request->param('tel'); 139 $tel = $request->param('tel');
140 - if (Db::name('user')->where(['id' => $user_id])->value('is_first') == 1) { 140 + $is_first = Db::name('user')->where(['id' => session('user.id')])->value('is_first');
  141 + if ($is_first == 1) {
  142 + give_as_a_present($user_id, '首次下单赠送');
141 Db::name('user')->update(['id' => $user_id, 'tel' => $tel, 'is_first' => 0]); 143 Db::name('user')->update(['id' => $user_id, 'tel' => $tel, 'is_first' => 0]);
142 - $is_first = Db::name('user')->where(['id' => session('user.id')])->value('is_first');  
143 - if ($is_first == 1) {  
144 - give_as_a_present($user_id, '首次下单赠送');  
145 - }  
146 echo json_encode(['msg' => '绑定成功']); 144 echo json_encode(['msg' => '绑定成功']);
147 //领取优惠券 145 //领取优惠券
148 exit(); 146 exit();