15954078560 2 years ago
parent
commit
0a25cb356e
1 changed files with 10 additions and 11 deletions
  1. 10 11
      application/api/controller/Index.php

+ 10 - 11
application/api/controller/Index.php

@@ -979,26 +979,25 @@ class Index extends Api
     //生成小程序邀请二维码
     public function getqrcode($id = 0) {
 //        $access_token = Cache::get('access_token');
-//        $access_token = '';
-//        if (!$access_token) {
+        $access_token = '';
+        if (!$access_token) {
             //获取$access_token
-            $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.config('wxchatpay.app_id').'&secret='.config('wxchatpay.app_secret');
-//            $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx326ed0bf442d2773&secret=33609a3bc45bb407f0b26816158405b8';
+//            $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.config('wxchatpay.app_id').'&secret='.config('wxchatpay.app_secret');
+            $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx326ed0bf442d2773&secret=33609a3bc45bb407f0b26816158405b8';
             $result = file_get_contents($url);
             $result = json_decode($result, true);
             $access_token = $result['access_token'];
             //缓存
             Cache::set('access_token', $access_token, 7000);
-//        }
+        }
         if (!$access_token) {
             $this->error('参数缺失');
         }
 
-        $data['scene'] = 'id='.$id.'&code='.$this->auth->invite_no;
-//        $data['scene'] = 'id=AVwvR&code='.$this->auth->invite_no;
-        $data['page'] = 'pages/home/detail';
-        $data['env_version'] = 'develop';
-//        $data['page'] = 'pages/product/product';
+//        $data['scene'] = 'id='.$id.'&code='.$this->auth->invite_no;
+        $data['scene'] = 'id=AVwvR&code='.$this->auth->invite_no;
+//        $data['page'] = 'pages/home/detail';
+        $data['page'] = 'pages/product/product';
 
         $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" . $access_token;
         $ch = curl_init($url);
@@ -1016,7 +1015,7 @@ class Index extends Api
 
         if (is_array($ret)) {
             return '';
-        }p($ret);die;
+        }
         if (json_decode($ret)) {
             $this->error('生成失败');
         }