mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改微信配置接口
This commit is contained in:
parent
03edb4bf50
commit
b50042d957
@ -43,6 +43,7 @@ class Config extends BasicAdmin
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
$thrNotifyUrl = url('@wechat/api.push', '', true, true);
|
||||||
if ($this->request->isGet()) {
|
if ($this->request->isGet()) {
|
||||||
$code = encode(url('@admin', '', true, true) . '#' . $this->request->url());
|
$code = encode(url('@admin', '', true, true) . '#' . $this->request->url());
|
||||||
$data = [
|
$data = [
|
||||||
@ -51,14 +52,13 @@ class Config extends BasicAdmin
|
|||||||
'appkey' => $this->request->get('appkey', sysconf('wechat_thr_appkey')),
|
'appkey' => $this->request->get('appkey', sysconf('wechat_thr_appkey')),
|
||||||
'authurl' => config('wechat.service_url') . "/wechat/api.push/auth/{$code}.html",
|
'authurl' => config('wechat.service_url') . "/wechat/api.push/auth/{$code}.html",
|
||||||
];
|
];
|
||||||
$wechat = WechatService::config();
|
|
||||||
if ($this->request->get('appid', false)) {
|
if ($this->request->get('appid', false)) {
|
||||||
sysconf('wechat_thr_appid', $data['appid']);
|
sysconf('wechat_thr_appid', $data['appid']);
|
||||||
sysconf('wechat_thr_appkey', $data['appkey']);
|
sysconf('wechat_thr_appkey', $data['appkey']);
|
||||||
$wechat->setApiNotifyUri(url('@wechat/api.push', '', true, true));
|
WechatService::config()->setApiNotifyUri($thrNotifyUrl);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$data['wechat'] = $wechat->getConfig();
|
$data['wechat'] = WechatService::config()->getConfig();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$data['wechat'] = [];
|
$data['wechat'] = [];
|
||||||
}
|
}
|
||||||
@ -77,8 +77,7 @@ class Config extends BasicAdmin
|
|||||||
sysconf('wechat_thr_appkey', $this->request->post('wechat_thr_appkey'));
|
sysconf('wechat_thr_appkey', $this->request->post('wechat_thr_appkey'));
|
||||||
// 第三方平台时设置远程平台通知接口
|
// 第三方平台时设置远程平台通知接口
|
||||||
if ($this->request->post('wechat_type') === 'thr') {
|
if ($this->request->post('wechat_type') === 'thr') {
|
||||||
$apiurl = url('@wechat/api.push', '', true, true);
|
if (!WechatService::config()->setApiNotifyUri($thrNotifyUrl)) {
|
||||||
if (!WechatService::config()->setApiNotifyUri($apiurl)) {
|
|
||||||
$this->error('远程服务端接口更新失败,请稍候再试!');
|
$this->error('远程服务端接口更新失败,请稍候再试!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user