作者 chencheng

123

... ... @@ -28,10 +28,10 @@ class Client extends Api
$this->auth->id ;//测试用
$postParam = $this->request->param();
$this->postParam = $postParam;
if (empty($postParam['code'])) {
$this->error("门店code异常");
if (empty($postParam['store_id'])) {
$this->error("门店store_id异常");
}
$this->store_id = $postParam['code'];
$this->store_id = $postParam['store_id'];
$store = Db::name("verification_store")->where("id", $this->store_id)->find();
if (empty($store)) {
$this->error("门店不存在,请退出登录后重试!");
... ... @@ -231,13 +231,12 @@ class Client extends Api
/*
7.生成二维码 及 规则
二维码 没有则创新 /index.php/api/v1/index/synthesis?store_id=1&activity_id=2
7.生成二维码 及 规则 https://coupon.xp.yn.cn?store_id=1&activity_id=3
二维码 没有则创新
参数 用户id 门店id 活动id
code activiy_id
store_id activiy_id
请求需要加 header token
有前端自行合成分销图片
由前端自行合成分销图片
*/
public function synthesis(){
//参数
... ... @@ -246,10 +245,10 @@ class Client extends Api
$user_id=2;
//验证
if(empty($user_id)){return $this->error('用户信息错误');}
if(empty($param['code'])){return $this->error('请确认门店');}
if(empty($param['store_id'])){return $this->error('请确认门店');}
if(empty($param['activity_id'])){return $this->error('请确认活动');}
$w['user_id'] = $user_id;
$w['code'] = $param['code'];
$w['store_id'] = $param['store_id'];
$w['activity_id'] = $param['activity_id'];
$r = Db::name('verification_user_synthesis')->where($w)->find();
//有 则 返回 无 则新增
... ... @@ -263,7 +262,13 @@ class Client extends Api
}else{
$res = $r['url'];
}
return $this->success('',$res);
//获取 当前活动当前门店的背景图
$st_a['verification_store_id'] = $param['store_id'];
$st_a['id'] = $param['activity_id'];
$storeActivity = Db::name('verification_activity')->where($st_a)->find();
$data['ercode_url'] = $res;//二维码地址
$data['bg_url'] = !empty($storeActivity['poster'])?request()->domain().$storeActivity['poster']:'';//背景图
return $this->success('',$data);
}
}
... ...
... ... @@ -151,6 +151,11 @@ class Wechat extends Api
https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
2.2 由微信回跳后,获取code 和 state 参数,由前端post code给后台
返回 token 前端存储 每次请求 放在header里
2.3 分销地址 如 https://coupon.xp.yn.cn?store_id=1&activity_id=3
假设 首页地址有参数 store_id activity_id,则表示分销首页,因此
2.3.1 未登录 则跳转官方,需要携带分销参数 登录成功后 获取token,再发送请求 store_id activity_id
2.3.2 已登录 有获取token,再发送请求 store_id activity_id
无地址参数则不发送请求
*/
public function get_user_info_by_code (){
... ... @@ -201,6 +206,8 @@ class Wechat extends Api
/*
3.订单支付 前端请求
3.1 入库 订单状态
... ...