wang hou sheng 7 months ago
parent 1cfe098964
commit a616ba0627
  1. 14
      app/admin/controller/Wxserve.php
  2. 35
      app/common/library/wxserver/Server.php

@ -196,13 +196,15 @@ class Wxserve extends Controller
public function getVersion(): Json
{
$appid = $this->request->get('appid');
if ($appid) {
$obj = new Server();
if ($obj->getVersioninfo($appid)) {
return $this->renderSuccess('success');
}
if (!$appid) {
return $this->renderError('缺少参数appid');
}
return $this->renderError('操作失败');
$obj = new Server();
$msg = $obj->getVersioninfo($appid);
if ($msg == 'ok') {
return $this->renderSuccess('success');
}
return $this->renderError($msg);
}
/**

@ -283,30 +283,33 @@ class Server
/**
* @notes:获取版本信息
* @param $appid
* @return bool
* @return mixed|string
* @author: wanghousheng
*/
public function getVersioninfo($appid): bool
public function getVersioninfo($appid)
{
$msg = '未知错误';
$access_token = $this->authorizerAccessToken($appid);
$url = 'https://api.weixin.qq.com/wxa/getversioninfo?access_token=' . $access_token;
$result = $this->curlPost($url, '{}');
$result = json_decode($result, true);
if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') {
$up = [];
if (!empty($result['exp_info'])) {
$up['exp_info'] = json_encode($result['exp_info']);
}
if (!empty($result['release_info'])) {
$up['release_info'] = json_encode($result['release_info']);
}
if ($up) {
$model = new WxserverAccount();
$model->update($up, ['appid' => $appid]);
if ($result && !empty($result['errmsg'])) {
$msg = $result['errmsg'];
if ($msg == 'ok') {
$up = [];
if (!empty($result['exp_info'])) {
$up['exp_info'] = json_encode($result['exp_info']);
}
if (!empty($result['release_info'])) {
$up['release_info'] = json_encode($result['release_info']);
}
if ($up) {
$model = new WxserverAccount();
$model->update($up, ['appid' => $appid]);
}
}
return true;
}
return false;
return $msg;
}
/**
@ -642,7 +645,7 @@ class Server
$up['privacy_status'] = 1;
}
//设置业务域名
if ($this->modifyJumpDomain($appid)) {
if ($this->modifyJumpDomain($appid, $domain)) {
$up['jump_domain_status'] = 1;
}
//设置订单页path信息

Loading…
Cancel
Save