|
@@ -34,20 +34,8 @@ class Wechat |
|
@@ -34,20 +34,8 @@ class Wechat |
|
34
|
*/
|
34
|
*/
|
|
35
|
public function getAccessToken()
|
35
|
public function getAccessToken()
|
|
36
|
{
|
36
|
{
|
|
37
|
- $cacheKey = 'access_token';
|
|
|
|
38
|
- if (Cache::has($cacheKey)) {
|
|
|
|
39
|
- return Cache::get($cacheKey);
|
|
|
|
40
|
- }
|
|
|
|
41
|
- $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $this->appid . '&secret=' . $this->appSecret;
|
|
|
|
42
|
- var_dump($url);
|
|
|
|
43
|
- die();
|
|
|
|
44
|
- $response = http_get($url);
|
|
|
|
45
|
- value($response);
|
|
|
|
46
|
- die();
|
|
|
|
47
|
- $accessToken = $data['access_token'];
|
|
|
|
48
|
- // 将accessToken缓存起来,避免多次请求
|
|
|
|
49
|
- Cache::put($cacheKey, $accessToken, $data['expires_in'] / 60);
|
|
|
|
50
|
- return $accessToken;
|
37
|
+ $token = file_get_contents("http://wechat.globalso.com/api/accesstoken/aicc");
|
|
|
|
38
|
+ return $token;
|
|
51
|
}
|
39
|
}
|
|
52
|
/**
|
40
|
/**
|
|
53
|
* @remark :生成二维码
|
41
|
* @remark :生成二维码
|