[更新]修改微信模式兼容

This commit is contained in:
Anyon 2018-03-19 14:02:34 +08:00
parent 48c5c2fd35
commit 06fa7570f7
2 changed files with 7 additions and 4 deletions

View File

@ -17,6 +17,7 @@ namespace app\wechat\controller;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\LogService; use service\LogService;
use service\WechatService; use service\WechatService;
use think\Exception;
/** /**
* 微信配置管理 * 微信配置管理
@ -44,13 +45,18 @@ class Config extends BasicAdmin
{ {
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());
try {
$info = WechatService::instance('config')->getConfig();
} catch (Exception $e) {
$info = [];
}
return $this->fetch('', [ return $this->fetch('', [
'title' => '微信接口配置', 'title' => '微信接口配置',
'appuri' => url("@wechat/api.push", '', true, true), 'appuri' => url("@wechat/api.push", '', true, true),
'appid' => $this->request->get('appid', sysconf('wechat_thr_appid')), 'appid' => $this->request->get('appid', sysconf('wechat_thr_appid')),
'appkey' => $this->request->get('appkey', sysconf('wechat_thr_appkey')), 'appkey' => $this->request->get('appkey', sysconf('wechat_thr_appkey')),
'authurl' => "http://wm.cuci.cc/wechat/api.push/auth/{$code}.html", 'authurl' => "http://wm.cuci.cc/wechat/api.push/auth/{$code}.html",
'wechat' => WechatService::instance('config')->getConfig(), 'wechat' => $info,
]); ]);
} }
try { try {

View File

@ -69,9 +69,6 @@ class WechatService
'ssl_key' => sysconf('wechat_cert_key'), 'ssl_key' => sysconf('wechat_cert_key'),
'cachepath' => env('cache_path') . 'wechat' . DIRECTORY_SEPARATOR, 'cachepath' => env('cache_path') . 'wechat' . DIRECTORY_SEPARATOR,
]; ];
if (in_array(strtolower($name), ['wechat', 'config'])) {
$name = 'user';
}
$type = '\\WeChat\\' . ucfirst(strtolower($name)); $type = '\\WeChat\\' . ucfirst(strtolower($name));
return new $type($config); return new $type($config);
case 'thr': case 'thr':