作者 郭文星
@@ -203,6 +203,7 @@ class Client extends Base @@ -203,6 +203,7 @@ class Client extends Base
203 public function crateorder(){ 203 public function crateorder(){
204 $time=time(); 204 $time=time();
205 $verification_activity_id=$this->postParam['verification_activity_id']; 205 $verification_activity_id=$this->postParam['verification_activity_id'];
  206 + if(empty($verification_activity_id)){return $this->error('活动信息错误');}
206 //查询到活动 207 //查询到活动
207 $where["id"] = ["=", $verification_activity_id]; 208 $where["id"] = ["=", $verification_activity_id];
208 $activity=Db::name('verification_activity')->where($where)->find(); 209 $activity=Db::name('verification_activity')->where($where)->find();
@@ -278,7 +279,6 @@ class Client extends Base @@ -278,7 +279,6 @@ class Client extends Base
278 //参数 279 //参数
279 $param = request()->param(); 280 $param = request()->param();
280 $user_id = $this->auth->id; 281 $user_id = $this->auth->id;
281 -  
282 //验证 282 //验证
283 if(empty($user_id)){return $this->error('用户信息错误');} 283 if(empty($user_id)){return $this->error('用户信息错误');}
284 if(empty($param['store_id'])){return $this->error('请确认门店');} 284 if(empty($param['store_id'])){return $this->error('请确认门店');}
@@ -308,4 +308,29 @@ class Client extends Base @@ -308,4 +308,29 @@ class Client extends Base
308 return $this->success('',$data); 308 return $this->success('',$data);
309 } 309 }
310 310
  311 +
  312 + /*
  313 + 我的礼品券
  314 + store_id
  315 + 分页参数page
  316 + coupon_type 券类型 卡卷类型:0=代金卷,1=礼品卷,2=消费卷,3=满减卷
  317 + type 卡卷状态:0=未使用,1=已使用,2=已过期
  318 + */
  319 + public function my_receive_coupons_recode(){
  320 + //参数
  321 + $param = request()->param();
  322 + $user_id = $this->auth->id;
  323 + //验证
  324 + if(empty($user_id)){return $this->error('用户信息错误');}
  325 + if(empty($param['store_id'])){return $this->error('请确认门店');}
  326 + if(!is_numeric($param['type'])){return $this->error('请确认卡券类型');}
  327 + $w['user_id'] = $user_id;
  328 + $w['verification_store_id'] = $param['store_id'];
  329 + $w['coupon_type'] = 1;
  330 + $w['type'] = $param['type'];
  331 + $data = Db::name('verification_receive')->where($w)->paginate(10);
  332 +
  333 + return $this->success('',$data);
  334 + }
  335 +
311 } 336 }
@@ -431,13 +431,14 @@ class Wechat extends Api @@ -431,13 +431,14 @@ class Wechat extends Api
431 //用户是否已经领取该门店的券 431 //用户是否已经领取该门店的券
432 $r = Db::name('verification_receive')->where($save)->find(); 432 $r = Db::name('verification_receive')->where($save)->find();
433 if(empty($r)){ 433 if(empty($r)){
434 - $save['type'] = 0; 434 + $save['type'] = 0;//使用情况
435 $save['closetime'] = $v['closetime']; 435 $save['closetime'] = $v['closetime'];
436 $save['receive_no'] = $time.uniqid(); 436 $save['receive_no'] = $time.uniqid();
437 $res = (new \app\api\controller\v1\Index())->build($save['receive_no']); 437 $res = (new \app\api\controller\v1\Index())->build($save['receive_no']);
438 $save['qr_code'] = $res;//二维码 438 $save['qr_code'] = $res;//二维码
439 $save['createtime'] = $time; 439 $save['createtime'] = $time;
440 $save['verification_order_id'] = $order_id; 440 $save['verification_order_id'] = $order_id;
  441 + $save['coupon_type'] = $v['type'];
441 Db::name('verification_receive')->insert($save); 442 Db::name('verification_receive')->insert($save);
442 } 443 }
443 } 444 }