|
|
@ -48,9 +48,6 @@ class Server |
|
|
|
|
|
|
|
|
|
|
|
public function getStableAccessToken() |
|
|
|
public function getStableAccessToken() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (Cache::has('StableAccessToken')) { |
|
|
|
|
|
|
|
return Cache::get('StableAccessToken'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$url = 'https://api.weixin.qq.com/cgi-bin/stable_token'; |
|
|
|
$url = 'https://api.weixin.qq.com/cgi-bin/stable_token'; |
|
|
|
$data['grant_type'] = 'client_credential'; |
|
|
|
$data['grant_type'] = 'client_credential'; |
|
|
|
$data['appid'] = self::APPID; |
|
|
|
$data['appid'] = self::APPID; |
|
|
@ -58,7 +55,6 @@ class Server |
|
|
|
$result = $this->curlPost($url, json_encode($data), 10); |
|
|
|
$result = $this->curlPost($url, json_encode($data), 10); |
|
|
|
$result = json_decode($result, true); |
|
|
|
$result = json_decode($result, true); |
|
|
|
if (!empty($result['access_token'])) { |
|
|
|
if (!empty($result['access_token'])) { |
|
|
|
Cache::set('StableAccessToken', $result['access_token'], 6200); |
|
|
|
|
|
|
|
return $result['access_token']; |
|
|
|
return $result['access_token']; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -327,9 +323,9 @@ class Server |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getTemplatelist(): array |
|
|
|
public function getTemplatelist(): array |
|
|
|
{ |
|
|
|
{ |
|
|
|
// if (Cache::has('wx_server_templatelist')) { |
|
|
|
if (Cache::has('wx_server_templatelist')) { |
|
|
|
// return Cache::get('wx_server_templatelist'); |
|
|
|
return Cache::get('wx_server_templatelist'); |
|
|
|
// } |
|
|
|
} |
|
|
|
$token = $this->getStableAccessToken(); |
|
|
|
$token = $this->getStableAccessToken(); |
|
|
|
$list = []; |
|
|
|
$list = []; |
|
|
|
if ($token) { |
|
|
|
if ($token) { |
|
|
|