From b50042d95719b5cde49379424c0b7b295cca3984 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 2 Apr 2018 11:03:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/Config.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index f5be6cb84..7a332a595 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -43,6 +43,7 @@ class Config extends BasicAdmin */ public function index() { + $thrNotifyUrl = url('@wechat/api.push', '', true, true); if ($this->request->isGet()) { $code = encode(url('@admin', '', true, true) . '#' . $this->request->url()); $data = [ @@ -51,14 +52,13 @@ class Config extends BasicAdmin 'appkey' => $this->request->get('appkey', sysconf('wechat_thr_appkey')), 'authurl' => config('wechat.service_url') . "/wechat/api.push/auth/{$code}.html", ]; - $wechat = WechatService::config(); if ($this->request->get('appid', false)) { sysconf('wechat_thr_appid', $data['appid']); sysconf('wechat_thr_appkey', $data['appkey']); - $wechat->setApiNotifyUri(url('@wechat/api.push', '', true, true)); + WechatService::config()->setApiNotifyUri($thrNotifyUrl); } try { - $data['wechat'] = $wechat->getConfig(); + $data['wechat'] = WechatService::config()->getConfig(); } catch (Exception $e) { $data['wechat'] = []; } @@ -77,8 +77,7 @@ class Config extends BasicAdmin sysconf('wechat_thr_appkey', $this->request->post('wechat_thr_appkey')); // 第三方平台时设置远程平台通知接口 if ($this->request->post('wechat_type') === 'thr') { - $apiurl = url('@wechat/api.push', '', true, true); - if (!WechatService::config()->setApiNotifyUri($apiurl)) { + if (!WechatService::config()->setApiNotifyUri($thrNotifyUrl)) { $this->error('远程服务端接口更新失败,请稍候再试!'); } }