wang hou sheng 9 months ago
parent ad3a074ed3
commit 6ec8b26da9
  1. 9
      app/admin/controller/Wxserve.php
  2. 22
      app/common/library/wxserver/Server.php

@ -12,6 +12,15 @@ use think\response\Json;
class Wxserve extends Controller
{
public function index(): Json
{
$appid = ['wxd87b1a7332d974d0', 'wxe3ed157849bd07b5', 'wx896520d9d03f108f', 'wx35f6c598106b9149', 'wx3f8c109fa934324f'];
$appid = array_merge($appid, ['wx1814307a39775007', 'wx74c7a92ae5ffbcb6', 'wx50b90d4df20da3ec', 'wxe843b6d7a4bd3389']);
$obj = new Server();
$data = $obj->applySetOrderPathInfo($appid);
return $this->renderSuccess(['result' => $data]);
}
/**
* @notes:生成授权二维码
* @return Json

@ -132,6 +132,26 @@ class Server
return $url;
}
/**
* @notes:申请设置订单页path信息
* @param array $appid
* @param string $path
* @return mixed
* @author: wanghousheng
*/
public function applySetOrderPathInfo(array $appid, string $path = 'pages/order/index')
{
$token = $this->getComponentAccessToken();
$data['access_token'] = $token;
$data['batch_req'] = [
'path' => $path,
'appid_list' => $appid,
];
$url = "https://api.weixin.qq.com/wxa/security/applysetorderpathinfo?component_access_token=$token";
$result = $this->curlPost($url, json_encode($data));
return json_decode($result, true);
}
/**
* @notes:获取预授权码
* @return false|mixed
@ -626,6 +646,8 @@ class Server
if ($this->modifyJumpDomain($appid)) {
$up['jump_domain_status'] = 1;
}
//设置订单页path信息
$this->applySetOrderPathInfo([$appid]);
if ($up) {
$model = new WxserverAccount();
$model->update($up, ['appid' => $appid]);

Loading…
Cancel
Save