wang hou sheng 1 year ago
parent 5da78cfd02
commit 0db1f48794
  1. 2
      app/api/controller/Wxserver.php
  2. 6
      app/common/library/wxserver/Server.php

@ -17,7 +17,7 @@ class Wxserver extends BaseController
{ {
$obj = new \app\common\library\wxserver\Server(); $obj = new \app\common\library\wxserver\Server();
$domain = $this->request->domain(true); $domain = $this->request->domain(true);
$arr = $obj->setDomain($this->request->domain(true), 'wx1814307a39775007'); $arr = $obj->setDomain($this->request->domain(true), 'wxe3ed157849bd07b5');
return $this->renderSuccess(['domain' => $domain, 'arr' => $arr]); return $this->renderSuccess(['domain' => $domain, 'arr' => $arr]);
} }

@ -466,12 +466,11 @@ class Server
* @notes:设置域名 * @notes:设置域名
* @param $appid * @param $appid
* @param $domain * @param $domain
* @return bool
* @author: wanghousheng * @author: wanghousheng
*/ */
public function setDomain($appid, $domain): bool public function setDomain($appid, $domain)
{ {
$url = 'https://api.weixin.qq.com/wxa/modify_domain_directly?access_token=' . $this->authorizerAccessToken($appid); $url = 'https://api.weixin.qq.com/wxa/modify_domain?access_token=' . $this->authorizerAccessToken($appid);
$data['action'] = 'set'; $data['action'] = 'set';
$data['requestdomain'] = [$domain]; $data['requestdomain'] = [$domain];
$data['wsrequestdomain'] = []; $data['wsrequestdomain'] = [];
@ -481,6 +480,7 @@ class Server
$data['tcpdomain'] = []; $data['tcpdomain'] = [];
$result = $this->curlPost($url, json_encode($data)); $result = $this->curlPost($url, json_encode($data));
$result = json_decode($result, true); $result = json_decode($result, true);
return $result;
if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') { if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') {
return true; return true;
} }

Loading…
Cancel
Save