作者 郭文星
... ... @@ -203,6 +203,7 @@ class Client extends Base
public function crateorder(){
$time=time();
$verification_activity_id=$this->postParam['verification_activity_id'];
if(empty($verification_activity_id)){return $this->error('活动信息错误');}
//查询到活动
$where["id"] = ["=", $verification_activity_id];
$activity=Db::name('verification_activity')->where($where)->find();
... ... @@ -278,7 +279,6 @@ class Client extends Base
//参数
$param = request()->param();
$user_id = $this->auth->id;
//验证
if(empty($user_id)){return $this->error('用户信息错误');}
if(empty($param['store_id'])){return $this->error('请确认门店');}
... ... @@ -308,4 +308,29 @@ class Client extends Base
return $this->success('',$data);
}
/*
我的礼品券
store_id
分页参数page
coupon_type 券类型 卡卷类型:0=代金卷,1=礼品卷,2=消费卷,3=满减卷
type 卡卷状态:0=未使用,1=已使用,2=已过期
*/
public function my_receive_coupons_recode(){
//参数
$param = request()->param();
$user_id = $this->auth->id;
//验证
if(empty($user_id)){return $this->error('用户信息错误');}
if(empty($param['store_id'])){return $this->error('请确认门店');}
if(!is_numeric($param['type'])){return $this->error('请确认卡券类型');}
$w['user_id'] = $user_id;
$w['verification_store_id'] = $param['store_id'];
$w['coupon_type'] = 1;
$w['type'] = $param['type'];
$data = Db::name('verification_receive')->where($w)->paginate(10);
return $this->success('',$data);
}
}
... ...
... ... @@ -431,13 +431,14 @@ class Wechat extends Api
//用户是否已经领取该门店的券
$r = Db::name('verification_receive')->where($save)->find();
if(empty($r)){
$save['type'] = 0;
$save['type'] = 0;//使用情况
$save['closetime'] = $v['closetime'];
$save['receive_no'] = $time.uniqid();
$res = (new \app\api\controller\v1\Index())->build($save['receive_no']);
$save['qr_code'] = $res;//二维码
$save['createtime'] = $time;
$save['verification_order_id'] = $order_id;
$save['coupon_type'] = $v['type'];
Db::name('verification_receive')->insert($save);
}
}
... ...