From 917e51085c739c6c227cf68f4a2f0eaa4c45365b Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 2 Apr 2018 10:53:38 +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 | 24 ++++++++++++++--------- application/wechat/view/config/index.html | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index 5282d9288..d5bca61dc 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -45,19 +45,25 @@ class Config extends BasicAdmin { if ($this->request->isGet()) { $code = encode(url('@admin', '', true, true) . '#' . $this->request->url()); - try { - $info = WechatService::instance('config')->getConfig(); - } catch (Exception $e) { - $info = []; - } - return $this->fetch('', [ + $data = [ 'title' => '微信接口配置', - 'appuri' => url("@wechat/api.push", '', true, true), 'appid' => $this->request->get('appid', sysconf('wechat_thr_appid')), 'appkey' => $this->request->get('appkey', sysconf('wechat_thr_appkey')), 'authurl' => config('wechat.service_url') . "/wechat/api.push/auth/{$code}.html", - 'wechat' => $info, - ]); + ]; + // 第三方平台配置 + $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)); + } + try { + $data['wechat'] = $wechat->getConfig(); + } catch (Exception $e) { + $data['wechat'] = []; + } + return $this->fetch('', $data); } try { // 接口对接类型 diff --git a/application/wechat/view/config/index.html b/application/wechat/view/config/index.html index d3f326f8a..026fb0652 100644 --- a/application/wechat/view/config/index.html +++ b/application/wechat/view/config/index.html @@ -126,7 +126,7 @@
- +

公众号服务平台接口通知URL, 公众号消息接收与回复等。