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

Loading…
Cancel
Save