Browse Source

fix:测试

super-yimizi 1 month ago
parent
commit
a109a503ed
1 changed files with 14 additions and 12 deletions
  1. 14 12
      application/common/library/easywechatPlus/WechatService.php

+ 14 - 12
application/common/library/easywechatPlus/WechatService.php

@@ -68,18 +68,20 @@ class WechatService extends EasywechatPlus
      */
     public function getWechatSession($code)
     {
-        $access_token = $this->getAccessToken();
-        $url = "https://api.weixin.qq.com/sns/jscode2session";
-        $result = HttpClient::request('get', $url, [
-            'query' => [
-                "access_token" => $access_token['access_token'],
-                'appid'      => $this->app->app_id,
-                'secret'     => $this->app->app_secret,
-                'js_code'    => $code,
-                'grant_type' => 'authorization_code'
-            ],
-        ]);
-        $result = $result->getBody()->getContents();
+        // $access_token = $this->getAccessToken();
+        // $url = "https://api.weixin.qq.com/sns/jscode2session";
+        // $result = HttpClient::request('get', $url, [
+        //     'query' => [
+        //         "access_token" => $access_token['access_token'],
+        //         'appid'      => $this->app->app_id,
+        //         'secret'     => $this->app->app_secret,
+        //         'js_code'    => $code,
+        //         'grant_type' => 'authorization_code'
+        //     ],
+        // ]);
+        $result = $this->app->auth->session($code);
+        Log::write('getWechatSession:'.$result);
+        //$result = $result->getBody()->getContents();
         $result = json_decode($result, true);
         if ($result['errcode'] == 0) {
             return $result;