wang hou sheng 8 months ago
parent 3a694fc1dc
commit fab9fa7d29
  1. 5
      app/common/library/wxserver/Server.php

@ -54,7 +54,7 @@ class Server
public function getComponentAccessToken() public function getComponentAccessToken()
{ {
if (Cache::has('ComponentAccessToken')) { if (Cache::has('ComponentAccessToken')) {
//return Cache::get('ComponentAccessToken'); return Cache::get('ComponentAccessToken');
} }
$url = 'https://api.weixin.qq.com/cgi-bin/component/api_component_token'; $url = 'https://api.weixin.qq.com/cgi-bin/component/api_component_token';
$ticket = Cache::get('component_verify_ticket'); $ticket = Cache::get('component_verify_ticket');
@ -65,7 +65,6 @@ class Server
$data['component_verify_ticket'] = $ticket; $data['component_verify_ticket'] = $ticket;
$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);
return $result;
if (!empty($result['component_access_token'])) { if (!empty($result['component_access_token'])) {
Cache::set('ComponentAccessToken', $result['component_access_token'], 6200); Cache::set('ComponentAccessToken', $result['component_access_token'], 6200);
return $result['component_access_token']; return $result['component_access_token'];
@ -227,12 +226,10 @@ class Server
*/ */
public function getTemplatedraftlist() public function getTemplatedraftlist()
{ {
if (Cache::has('wx_server_drafttemplatelist')) { if (Cache::has('wx_server_drafttemplatelist')) {
//return Cache::get('wx_server_drafttemplatelist'); //return Cache::get('wx_server_drafttemplatelist');
} }
$token = $this->getComponentAccessToken(); $token = $this->getComponentAccessToken();
return [$token];
$list = []; $list = [];
if ($token) { if ($token) {
$url = 'https://api.weixin.qq.com/wxa/gettemplatedraftlist?access_token=' . $token; $url = 'https://api.weixin.qq.com/wxa/gettemplatedraftlist?access_token=' . $token;

Loading…
Cancel
Save