[更新]修改微信配置接口

This commit is contained in:
Anyon 2018-04-02 10:53:38 +08:00
parent df1a61c40a
commit 917e51085c
2 changed files with 16 additions and 10 deletions

View File

@ -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 {
// 接口对接类型

View File

@ -126,7 +126,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">AppUri<br><span class="nowrap color-desc">第三方推送接口</span></label>
<div class='col-sm-8'>
<input type="text" name="wechat_thr_appurl" required value="{$appuri}" title="请输入公众号接口通知URL" placeholder="公众号接口通知URL必填" class="layui-input layui-bg-gray">
<input type="text" name="wechat_thr_appurl" required value="{:url('@wechat/api.push', '', true, true)}" title="请输入公众号接口通知URL" placeholder="公众号接口通知URL必填" class="layui-input layui-bg-gray">
<p class="help-block">公众号服务平台接口通知URL, 公众号消息接收与回复等。</p>
</div>
</div>