wang hou sheng 8 months ago
parent 7ee46d8019
commit 390af05e46
  1. 7
      app/api/controller/Wxserver.php
  2. 15
      app/common/library/wxserver/Server.php

@ -13,6 +13,13 @@ use think\facade\Db;
class Wxserver extends BaseController class Wxserver extends BaseController
{ {
public function index()
{
$obj = new \app\common\library\wxserver\Server();
$arr = $obj->setDomainDirectly($this->request->domain(true), 'wxe3ed157849bd07b5');
return $this->renderSuccess($arr);
}
public function verifyTicket() public function verifyTicket()
{ {

@ -462,6 +462,21 @@ class Server
return $list; return $list;
} }
public function setDomainDirectly($appid, $domain)
{
$url = 'https://api.weixin.qq.com/wxa/modify_domain_directly?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;
}
public function apiText($authorization_code, $touser) public function apiText($authorization_code, $touser)
{ {
$url = 'https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=' . $this->getComponentAccessToken(); $url = 'https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=' . $this->getComponentAccessToken();

Loading…
Cancel
Save