作者 王智

文档修改

@@ -62,7 +62,7 @@ class User extends Api @@ -62,7 +62,7 @@ class User extends Api
62 /*新增会员到管易平台*/ 62 /*新增会员到管易平台*/
63 $GuanYiCloud = new GuanYiCloud(); 63 $GuanYiCloud = new GuanYiCloud();
64 $bool = $GuanYiCloud->getvip($Json['unionId']); 64 $bool = $GuanYiCloud->getvip($Json['unionId']);
65 - if ($bool == 0) { 65 + if ($bool == 1) {
66 $GuanYiCloud->addVip($Json['unionId'], $Json['nickName']); 66 $GuanYiCloud->addVip($Json['unionId'], $Json['nickName']);
67 } 67 }
68 $dataUser = [ 68 $dataUser = [
@@ -605,29 +605,28 @@ class Api @@ -605,29 +605,28 @@ class Api
605 //生成小程序码 605 //生成小程序码
606 public function InserMiniAppQrCode($Goods_id, $UserId, $Path) 606 public function InserMiniAppQrCode($Goods_id, $UserId, $Path)
607 { 607 {
608 -// //小程序码  
609 -// $options = [  
610 -// 'app_id' => appid,  
611 -// 'secret' => secret,  
612 -// ];  
613 -// $app = new Application($options);  
614 -// // 获取 access token 实例  
615 -// $accessToken = $app->access_token;  
616 -// $AccessToken = $accessToken->getToken();  
617 -// $url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' . $AccessToken;  
618 -// $Json = [  
619 -// 'scene' => 'Goods_id=' . $Goods_id . '&User_id=' . $UserId,  
620 -// 'path' => $Path,  
621 -//// 'is_hyaline' => True  
622 -// ];  
623 -// $MiniAppQrcodeVendor = $this->curlPost1($url, $Json);  
624 -// $PayOrder = $this->PayOrder();  
625 -// $path = './MiniAppQrCode/' . $PayOrder . '.png';  
626 - $JsonDecode = json_decode('{"errcode":40001,"errmsg":"invalid credential, access_token is invalid or not latest rid: 604f8b86-35e79e71-2a52ba2d"}', true); 608 + //小程序码
  609 + $options = [
  610 + 'app_id' => appid,
  611 + 'secret' => secret,
  612 + ];
  613 + $app = new Application($options);
  614 + // 获取 access token 实例
  615 + $accessToken = $app->access_token;
  616 + $AccessToken = $accessToken->getToken();
  617 + $url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' . $AccessToken;
  618 + $Json = [
  619 + 'scene' => 'Goods_id=' . $Goods_id . '&User_id=' . $UserId,
  620 + 'path' => $Path,
  621 +// 'is_hyaline' => True
  622 + ];
  623 + $MiniAppQrcodeVendor = $this->curlPost1($url, $Json);
  624 + $PayOrder = $this->PayOrder();
  625 + $path = './MiniAppQrCode/' . $PayOrder . '.png';
  626 + $JsonDecode = json_decode($MiniAppQrcodeVendor, true);
627 if ($JsonDecode['errcode'] && $JsonDecode['errcode'] == 40001) { 627 if ($JsonDecode['errcode'] && $JsonDecode['errcode'] == 40001) {
628 $this->error('生成海报超时'); 628 $this->error('生成海报超时');
629 } 629 }
630 - return 1;  
631 $res = file_put_contents($path, $MiniAppQrcodeVendor);//将微信返回的图片数据流写入文件 630 $res = file_put_contents($path, $MiniAppQrcodeVendor);//将微信返回的图片数据流写入文件
632 if ($res === false) { 631 if ($res === false) {
633 $this->error('生成小程序码失败', 0); 632 $this->error('生成小程序码失败', 0);