作者 郭文星

'123'

@@ -242,7 +242,7 @@ class Wechat extends Api @@ -242,7 +242,7 @@ class Wechat extends Api
242 if(in_array($role['type'],['1','3'])){ 242 if(in_array($role['type'],['1','3'])){
243 return $this->error('我是代理不记录'); 243 return $this->error('我是代理不记录');
244 } 244 }
245 - 245 +
246 Db::name('user')->where($w)->update(['pid'=>$param['share_id'],'updatetime'=>$time]); 246 Db::name('user')->where($w)->update(['pid'=>$param['share_id'],'updatetime'=>$time]);
247 return $this->success('更新关系'); 247 return $this->success('更新关系');
248 }else{ 248 }else{
@@ -292,7 +292,7 @@ class Wechat extends Api @@ -292,7 +292,7 @@ class Wechat extends Api
292 return $this->error('预下单信息错误'); 292 return $this->error('预下单信息错误');
293 } 293 }
294 $my_user_id = $this->auth->id; 294 $my_user_id = $this->auth->id;
295 - 295 +
296 if(empty($my_user_id)){return $this->error('用户信息错误');} 296 if(empty($my_user_id)){return $this->error('用户信息错误');}
297 $o_w["order_no"] = $order_no; 297 $o_w["order_no"] = $order_no;
298 $order_info = Db::name('verification_order')->where($o_w)->find(); 298 $order_info = Db::name('verification_order')->where($o_w)->find();
@@ -334,7 +334,7 @@ class Wechat extends Api @@ -334,7 +334,7 @@ class Wechat extends Api
334 public function notify(){ 334 public function notify(){
335 $app = WehcatModule::getInstance()->initWechatPay(); 335 $app = WehcatModule::getInstance()->initWechatPay();
336 $xml = file_get_contents("php://input"); 336 $xml = file_get_contents("php://input");
337 - 337 +
338 $xmljson= json_encode(simplexml_load_string($xml, 'SimplexmlElement', LIBXML_NOCDATA ));//将对象转换个JSON 338 $xmljson= json_encode(simplexml_load_string($xml, 'SimplexmlElement', LIBXML_NOCDATA ));//将对象转换个JSON
339 $message = json_decode($xmljson,true); 339 $message = json_decode($xmljson,true);
340 // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单 340 // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
@@ -353,11 +353,11 @@ class Wechat extends Api @@ -353,11 +353,11 @@ class Wechat extends Api
353 $this->sales_distribution($order_info); 353 $this->sales_distribution($order_info);
354 } 354 }
355 } else { 355 } else {
356 - 356 +
357 } 357 }
358 // 返回状态 358 // 返回状态
359 $this->returnCode(true, 'OK'); 359 $this->returnCode(true, 'OK');
360 - 360 +
361 361
362 /* 362 /*
363 $xml = file_get_contents("php://input"); 363 $xml = file_get_contents("php://input");
@@ -380,7 +380,7 @@ class Wechat extends Api @@ -380,7 +380,7 @@ class Wechat extends Api
380 'return_code' => $returnCode ? 'SUCCESS' : 'FAIL', 380 'return_code' => $returnCode ? 'SUCCESS' : 'FAIL',
381 'return_msg' => $msg ?: 'OK', 381 'return_msg' => $msg ?: 'OK',
382 ]; 382 ];
383 - 383 +
384 die($this->toXml($return)); 384 die($this->toXml($return));
385 } 385 }
386 386
@@ -451,7 +451,7 @@ class Wechat extends Api @@ -451,7 +451,7 @@ class Wechat extends Api
451 451
452 //支付后,根据用户角色 处理对应的事情 452 //支付后,根据用户角色 处理对应的事情
453 private function getParent($pid,$verification_coupon_ids,$order_id){ 453 private function getParent($pid,$verification_coupon_ids,$order_id){
454 - 454 +
455 //上级身份 455 //上级身份
456 $time = time(); 456 $time = time();
457 $w1 = []; 457 $w1 = [];
@@ -479,10 +479,10 @@ class Wechat extends Api @@ -479,10 +479,10 @@ class Wechat extends Api
479 $save['verification_coupon_id'] = $store['verification_coupon_id']; 479 $save['verification_coupon_id'] = $store['verification_coupon_id'];
480 $save['verification_store_id'] = $store['id']; 480 $save['verification_store_id'] = $store['id'];
481 $save['user_id'] = $pid; 481 $save['user_id'] = $pid;
482 - 482 +
483 $save['type'] = 0;//使用情况 483 $save['type'] = 0;//使用情况
484 $save['closetime'] = $coupon['closetime']; 484 $save['closetime'] = $coupon['closetime'];
485 - $save['receive_no'] = $time.uniqid(); 485 + $save['receive_no'] = rand(100000,999999).uniqid();
486 $res = (new \app\api\controller\v1\Index())->build($save['receive_no']); 486 $res = (new \app\api\controller\v1\Index())->build($save['receive_no']);
487 $save['qr_code'] = $res;//二维码 487 $save['qr_code'] = $res;//二维码
488 $save['createtime'] = $time; 488 $save['createtime'] = $time;
@@ -519,7 +519,7 @@ class Wechat extends Api @@ -519,7 +519,7 @@ class Wechat extends Api
519 } 519 }
520 } 520 }
521 521
522 - 522 +
523 523
524 524
525 // 发放红包 单位 分 最低100分, 525 // 发放红包 单位 分 最低100分,
@@ -547,7 +547,7 @@ class Wechat extends Api @@ -547,7 +547,7 @@ class Wechat extends Api
547 'act_name' => '佣金分享红包到账', 547 'act_name' => '佣金分享红包到账',
548 'remark' => '感谢您的参与', 548 'remark' => '感谢您的参与',
549 ]); 549 ]);
550 - 550 +
551 if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){ 551 if($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS'){
552 //记录佣金表 verification_brokerage_record 552 //记录佣金表 verification_brokerage_record
553 $send_result = 1; 553 $send_result = 1;
@@ -556,7 +556,7 @@ class Wechat extends Api @@ -556,7 +556,7 @@ class Wechat extends Api
556 $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order,$mch_billno); 556 $this->brokerage_record($verification_store,$user_info,$send_result,$verification_order,$mch_billno);
557 }catch(\Exception $e){ 557 }catch(\Exception $e){
558 Db::name('wechat_pay_recode')->insert(['json'=>json_encode($result),'time'=>time(),'action'=>'grant_red_packets']); 558 Db::name('wechat_pay_recode')->insert(['json'=>json_encode($result),'time'=>time(),'action'=>'grant_red_packets']);
559 - 559 +
560 } 560 }
561 } 561 }
562 562
@@ -584,10 +584,10 @@ class Wechat extends Api @@ -584,10 +584,10 @@ class Wechat extends Api
584 }catch(\Exception $e){ 584 }catch(\Exception $e){
585 Db::name('wechat_pay_recode')->insert(['json'=>$e->getMessage(),'time'=>time()]); 585 Db::name('wechat_pay_recode')->insert(['json'=>$e->getMessage(),'time'=>time()]);
586 } 586 }
587 - 587 +
588 } 588 }
589 589
590 590
591 - 591 +
592 592
593 } 593 }