|
|
|
@ -66,8 +66,8 @@ class Server |
|
|
|
|
*/ |
|
|
|
|
public function getComponentAccessToken() |
|
|
|
|
{ |
|
|
|
|
if (Cache::has('ComponentAccessToken')) { |
|
|
|
|
return Cache::get('ComponentAccessToken'); |
|
|
|
|
if (Cache::has('wxserver_component_access_token')) { |
|
|
|
|
return Cache::get('wxserver_component_access_token'); |
|
|
|
|
} |
|
|
|
|
$url = 'https://api.weixin.qq.com/cgi-bin/component/api_component_token'; |
|
|
|
|
$ticket = Cache::get('component_verify_ticket'); |
|
|
|
@ -79,7 +79,7 @@ class Server |
|
|
|
|
$result = $this->curlPost($url, json_encode($data), 10); |
|
|
|
|
$result = json_decode($result, true); |
|
|
|
|
if (!empty($result['component_access_token'])) { |
|
|
|
|
Cache::set('ComponentAccessToken', $result['component_access_token'], 6200); |
|
|
|
|
Cache::set('wxserver_component_access_token', $result['component_access_token'], 6200); |
|
|
|
|
return $result['component_access_token']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -324,9 +324,9 @@ class Server |
|
|
|
|
public function getTemplatelist(): array |
|
|
|
|
{ |
|
|
|
|
if (Cache::has('wx_server_templatelist')) { |
|
|
|
|
return Cache::get('wx_server_templatelist'); |
|
|
|
|
//return Cache::get('wx_server_templatelist'); |
|
|
|
|
} |
|
|
|
|
$token = $this->getStableAccessToken(); |
|
|
|
|
$token = $this->getComponentAccessToken(); |
|
|
|
|
$list = []; |
|
|
|
|
if ($token) { |
|
|
|
|
$url = 'https://api.weixin.qq.com/wxa/gettemplatelist?access_token=' . $token . '&template_type=1'; |
|
|
|
|