作者 chencheng

123

@@ -28,10 +28,10 @@ class Client extends Api @@ -28,10 +28,10 @@ class Client extends Api
28 $this->auth->id ;//测试用 28 $this->auth->id ;//测试用
29 $postParam = $this->request->param(); 29 $postParam = $this->request->param();
30 $this->postParam = $postParam; 30 $this->postParam = $postParam;
31 - if (empty($postParam['code'])) {  
32 - $this->error("门店code异常"); 31 + if (empty($postParam['store_id'])) {
  32 + $this->error("门店store_id异常");
33 } 33 }
34 - $this->store_id = $postParam['code']; 34 + $this->store_id = $postParam['store_id'];
35 $store = Db::name("verification_store")->where("id", $this->store_id)->find(); 35 $store = Db::name("verification_store")->where("id", $this->store_id)->find();
36 if (empty($store)) { 36 if (empty($store)) {
37 $this->error("门店不存在,请退出登录后重试!"); 37 $this->error("门店不存在,请退出登录后重试!");
@@ -231,13 +231,12 @@ class Client extends Api @@ -231,13 +231,12 @@ class Client extends Api
231 231
232 232
233 /* 233 /*
234 - 7.生成二维码 及 规则  
235 - 二维码 没有则创新 /index.php/api/v1/index/synthesis?store_id=1&activity_id=2 234 + 7.生成二维码 及 规则 https://coupon.xp.yn.cn?store_id=1&activity_id=3
  235 + 二维码 没有则创新
236 参数 用户id 门店id 活动id 236 参数 用户id 门店id 活动id
237 - code activiy_id 237 + store_id activiy_id
238 请求需要加 header token 238 请求需要加 header token
239 -  
240 - 有前端自行合成分销图片 239 + 由前端自行合成分销图片
241 */ 240 */
242 public function synthesis(){ 241 public function synthesis(){
243 //参数 242 //参数
@@ -246,10 +245,10 @@ class Client extends Api @@ -246,10 +245,10 @@ class Client extends Api
246 $user_id=2; 245 $user_id=2;
247 //验证 246 //验证
248 if(empty($user_id)){return $this->error('用户信息错误');} 247 if(empty($user_id)){return $this->error('用户信息错误');}
249 - if(empty($param['code'])){return $this->error('请确认门店');} 248 + if(empty($param['store_id'])){return $this->error('请确认门店');}
250 if(empty($param['activity_id'])){return $this->error('请确认活动');} 249 if(empty($param['activity_id'])){return $this->error('请确认活动');}
251 $w['user_id'] = $user_id; 250 $w['user_id'] = $user_id;
252 - $w['code'] = $param['code']; 251 + $w['store_id'] = $param['store_id'];
253 $w['activity_id'] = $param['activity_id']; 252 $w['activity_id'] = $param['activity_id'];
254 $r = Db::name('verification_user_synthesis')->where($w)->find(); 253 $r = Db::name('verification_user_synthesis')->where($w)->find();
255 //有 则 返回 无 则新增 254 //有 则 返回 无 则新增
@@ -263,7 +262,13 @@ class Client extends Api @@ -263,7 +262,13 @@ class Client extends Api
263 }else{ 262 }else{
264 $res = $r['url']; 263 $res = $r['url'];
265 } 264 }
266 - return $this->success('',$res); 265 + //获取 当前活动当前门店的背景图
  266 + $st_a['verification_store_id'] = $param['store_id'];
  267 + $st_a['id'] = $param['activity_id'];
  268 + $storeActivity = Db::name('verification_activity')->where($st_a)->find();
  269 + $data['ercode_url'] = $res;//二维码地址
  270 + $data['bg_url'] = !empty($storeActivity['poster'])?request()->domain().$storeActivity['poster']:'';//背景图
  271 + return $this->success('',$data);
267 } 272 }
268 273
269 } 274 }
@@ -151,6 +151,11 @@ class Wechat extends Api @@ -151,6 +151,11 @@ class Wechat extends Api
151 https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect 151 https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
152 2.2 由微信回跳后,获取code 和 state 参数,由前端post code给后台 152 2.2 由微信回跳后,获取code 和 state 参数,由前端post code给后台
153 返回 token 前端存储 每次请求 放在header里 153 返回 token 前端存储 每次请求 放在header里
  154 + 2.3 分销地址 如 https://coupon.xp.yn.cn?store_id=1&activity_id=3
  155 + 假设 首页地址有参数 store_id activity_id,则表示分销首页,因此
  156 + 2.3.1 未登录 则跳转官方,需要携带分销参数 登录成功后 获取token,再发送请求 store_id activity_id
  157 + 2.3.2 已登录 有获取token,再发送请求 store_id activity_id
  158 + 无地址参数则不发送请求
154 */ 159 */
155 160
156 public function get_user_info_by_code (){ 161 public function get_user_info_by_code (){
@@ -200,6 +205,8 @@ class Wechat extends Api @@ -200,6 +205,8 @@ class Wechat extends Api
200 } 205 }
201 206
202 207
  208 +
  209 +
203 210
204 /* 211 /*
205 3.订单支付 前端请求 212 3.订单支付 前端请求