作者 郭文星

'3123'

@@ -11,6 +11,7 @@ use think\Exception; @@ -11,6 +11,7 @@ use think\Exception;
11 */ 11 */
12 class Client extends Api 12 class Client extends Api
13 { 13 {
  14 + protected $noNeedLogin = [''];
14 protected $noNeedRight = ['*']; 15 protected $noNeedRight = ['*'];
15 protected $postParam; 16 protected $postParam;
16 protected $store_id; 17 protected $store_id;
@@ -163,8 +163,8 @@ class Wechat extends Api @@ -163,8 +163,8 @@ class Wechat extends Api
163 if(empty(request()->param('code'))){ 163 if(empty(request()->param('code'))){
164 return $this->error('非法操作'); 164 return $this->error('非法操作');
165 } 165 }
166 -  
167 - 166 +
  167 +
168 try{ 168 try{
169 $app = WehcatModule::getInstance()->initWechat(); 169 $app = WehcatModule::getInstance()->initWechat();
170 $oauth = $app->oauth; 170 $oauth = $app->oauth;
@@ -200,7 +200,7 @@ class Wechat extends Api @@ -200,7 +200,7 @@ class Wechat extends Api
200 if($user_id !=0){ 200 if($user_id !=0){
201 201
202 $data['token'] = $this->auth->getToken(); 202 $data['token'] = $this->auth->getToken();
203 - $data['user_info'] = $user; 203 + $data['user_info'] =$this->auth->getUserinfo();
204 $this->success('完成',$data); 204 $this->success('完成',$data);
205 }else{ 205 }else{
206 $this->error('code处理失败'); 206 $this->error('code处理失败');
@@ -221,7 +221,7 @@ class Wechat extends Api @@ -221,7 +221,7 @@ class Wechat extends Api
221 return $this->error('请求错误'); 221 return $this->error('请求错误');
222 } 222 }
223 $my_user_id = $this->auth->id; 223 $my_user_id = $this->auth->id;
224 - 224 +
225 if(empty($my_user_id)){return $this->error('用户信息错误');} 225 if(empty($my_user_id)){return $this->error('用户信息错误');}
226 if(empty($param['store_id'])){return $this->error('门店信息错误');} 226 if(empty($param['store_id'])){return $this->error('门店信息错误');}
227 //记录门店浏览统计 227 //记录门店浏览统计
@@ -263,7 +263,7 @@ class Wechat extends Api @@ -263,7 +263,7 @@ class Wechat extends Api
263 $data['user_id'] = $user_id; 263 $data['user_id'] = $user_id;
264 $data['createtime'] = time(); 264 $data['createtime'] = time();
265 Db::name('verification_store_user_record')->insert($data); 265 Db::name('verification_store_user_record')->insert($data);
266 - } 266 + }
267 267
268 268
269 /* 269 /*
@@ -354,7 +354,7 @@ class Wechat extends Api @@ -354,7 +354,7 @@ class Wechat extends Api
354 * 4. 上级的上级 是普通人,则直接获得某个门店的所有礼品券 354 * 4. 上级的上级 是普通人,则直接获得某个门店的所有礼品券
355 * A -> B -> C 下单 355 * A -> B -> C 下单
356 * $order_info 支付成功后的订单信息 356 * $order_info 支付成功后的订单信息
357 - */ 357 + */
358 358
359 public function sales_distribution($order_info){ 359 public function sales_distribution($order_info){
360 $w['id'] = $order_info['user_id']; 360 $w['id'] = $order_info['user_id'];
@@ -367,7 +367,7 @@ class Wechat extends Api @@ -367,7 +367,7 @@ class Wechat extends Api
367 $w1['id'] = $myInfo['pid']; 367 $w1['id'] = $myInfo['pid'];
368 $myInfoP = Db::name('user')->where($w1)->find(); 368 $myInfoP = Db::name('user')->where($w1)->find();
369 $this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']); 369 $this->getParent($myInfoP['id'],$order_info['verification_store_id'],$order_info['id']);
370 - 370 +
371 } 371 }
372 } 372 }
373 373
@@ -443,14 +443,14 @@ class Wechat extends Api @@ -443,14 +443,14 @@ class Wechat extends Api
443 $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); 443 $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find();
444 $app = WehcatModule::getInstance()->initWechatPay(); 444 $app = WehcatModule::getInstance()->initWechatPay();
445 $result = $app->redpack->sendNormal([ 445 $result = $app->redpack->sendNormal([
446 - 446 +
447 'mch_billno' => '168532907259455', 447 'mch_billno' => '168532907259455',
448 'send_name' => '测试红包', 448 'send_name' => '测试红包',
449 're_openid' => 'o5OQw6PPEGaHqIjAir7gqeDV5MzQ', 449 're_openid' => 'o5OQw6PPEGaHqIjAir7gqeDV5MzQ',
450 'total_num' => 1, //固定为1,可不传 450 'total_num' => 1, //固定为1,可不传
451 'total_amount' => 100, //单位为分,不小于100 451 'total_amount' => 100, //单位为分,不小于100
452 'wishing' => '祝福语', 452 'wishing' => '祝福语',
453 - 453 +
454 'act_name' => '测试活动', 454 'act_name' => '测试活动',
455 'remark' => '测试备注', 455 'remark' => '测试备注',
456 ]); 456 ]);