From 06fa7570f72b80dd71b668cab5e7519871ecd1cf Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 19 Mar 2018 14:02:34 +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=E6=A8=A1=E5=BC=8F=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wechat/controller/Config.php | 8 +++++++- extend/service/WechatService.php | 3 --- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index 333604aea..48de3aae8 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -17,6 +17,7 @@ namespace app\wechat\controller; use controller\BasicAdmin; use service\LogService; use service\WechatService; +use think\Exception; /** * 微信配置管理 @@ -44,13 +45,18 @@ 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('', [ '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' => "http://wm.cuci.cc/wechat/api.push/auth/{$code}.html", - 'wechat' => WechatService::instance('config')->getConfig(), + 'wechat' => $info, ]); } try { diff --git a/extend/service/WechatService.php b/extend/service/WechatService.php index a0a187530..40404007c 100644 --- a/extend/service/WechatService.php +++ b/extend/service/WechatService.php @@ -69,9 +69,6 @@ class WechatService 'ssl_key' => sysconf('wechat_cert_key'), 'cachepath' => env('cache_path') . 'wechat' . DIRECTORY_SEPARATOR, ]; - if (in_array(strtolower($name), ['wechat', 'config'])) { - $name = 'user'; - } $type = '\\WeChat\\' . ucfirst(strtolower($name)); return new $type($config); case 'thr':