wang hou sheng 8 months ago
parent 0e239bcedc
commit fc1b26d8cd
  1. 34
      app/common/library/wxserver/Server.php

@ -298,7 +298,7 @@ class Server
public function authorizerAccessToken($appid) public function authorizerAccessToken($appid)
{ {
if (Cache::has($appid . '_authorizer_access_token')) { if (Cache::has($appid . '_authorizer_access_token')) {
//return Cache::get($appid . '_authorizer_access_token'); return Cache::get($appid . '_authorizer_access_token');
} }
$refresh_token = $this->getRefreshToken($appid); $refresh_token = $this->getRefreshToken($appid);
if ($refresh_token) { if ($refresh_token) {
@ -470,21 +470,25 @@ class Server
*/ */
public function setDomain($appid, $domain) public function setDomain($appid, $domain)
{ {
$url = 'https://api.weixin.qq.com/wxa/modify_domain?access_token=' . $this->authorizerAccessToken($appid); $token = $this->authorizerAccessToken($appid);
$data['action'] = 'set'; if ($token) {
$data['requestdomain'] = [$domain]; $url = "https://api.weixin.qq.com/wxa/modify_domain?access_token=$token";
$data['wsrequestdomain'] = []; $data['action'] = 'set';
$data['uploaddomain'] = [$domain]; $data['requestdomain'] = [$domain];
$data['downloaddomain'] = [$domain]; $data['wsrequestdomain'] = [];
$data['udpdomain'] = []; $data['uploaddomain'] = [$domain];
$data['tcpdomain'] = []; $data['downloaddomain'] = [$domain];
$result = $this->curlPost($url, json_encode($data)); $data['udpdomain'] = [];
$result = json_decode($result, true); $data['tcpdomain'] = [];
return $result; $result = $this->curlPost($url, json_encode($data));
if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') { $result = json_decode($result, true);
return true; return $result;
if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') {
return true;
}
return false;
} }
return false; return [];
} }
public function apiText($authorization_code, $touser) public function apiText($authorization_code, $touser)

Loading…
Cancel
Save