diff --git a/app/Http/Admin/Controllers/Controller.php b/app/Http/Admin/Controllers/Controller.php index 25899d50..058bfa77 100644 --- a/app/Http/Admin/Controllers/Controller.php +++ b/app/Http/Admin/Controllers/Controller.php @@ -21,17 +21,6 @@ class Controller extends \Phalcon\Mvc\Controller public function beforeExecuteRoute(Dispatcher $dispatcher) { - /** - * demo分支拒绝数据提交 - */ - if ($this->isNotSafeRequest()) { - $dispatcher->forward([ - 'controller' => 'public', - 'action' => 'forbidden', - ]); - return false; - } - if ($this->isNotSafeRequest()) { $this->checkHttpReferer(); $this->checkCsrfToken(); diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 71e41fc0..7452c717 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -327,4 +327,29 @@ class SettingController extends Controller } } + /** + * @Route("/wechat", name="admin.setting.wechat") + */ + public function wechatAction() + { + $settingService = new SettingService(); + + if ($this->request->isPost()) { + + $section = $this->request->getPost('section', 'string'); + + $data = $this->request->getPost(); + + $settingService->updateSettings($section, $data); + + return $this->jsonSuccess(['msg' => '更新配置成功']); + + } else { + + $oa = $settingService->getWeChatOASettings(); + + $this->view->setVar('oa', $oa); + } + } + } diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php index 427c9924..52d6bf1e 100644 --- a/app/Http/Admin/Services/AuthNode.php +++ b/app/Http/Admin/Services/AuthNode.php @@ -750,6 +750,12 @@ class AuthNode extends Service 'type' => 'menu', 'route' => 'admin.setting.oauth', ], + [ + 'id' => '5-1-13', + 'title' => '微信公众平台', + 'type' => 'menu', + 'route' => 'admin.setting.wechat', + ], ], ], ], diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index d6d46164..3b744ad8 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -57,6 +57,16 @@ class Setting extends Service return $wxpay; } + public function getWeChatOASettings() + { + $oa = $this->getSettings('wechat.oa'); + + $oa['auth_url'] = $oa['auth_url'] ?: kg_full_url(['for' => 'home.wechat.oa.auth_callback']); + $oa['notify_url'] = $oa['notify_url'] ?: kg_full_url(['for' => 'home.wechat.oa.notify_callback']); + + return $oa; + } + public function getVipSettings() { $vipRepo = new VipRepo(); @@ -87,16 +97,8 @@ class Setting extends Service $result = []; - /** - * demo分支过滤敏感数据 - */ if ($items->count() > 0) { foreach ($items as $item) { - $case1 = preg_match('/(id|auth|key|secret|password|pwd)$/', $item->item_key); - $case2 = $this->dispatcher->getControllerName() == 'setting'; - if ($case1 && $case2) { - $item->item_value = '***'; - } $result[$item->item_key] = $item->item_value; } } diff --git a/app/Http/Admin/Views/setting/wechat.volt b/app/Http/Admin/Views/setting/wechat.volt new file mode 100644 index 00000000..a37d7091 --- /dev/null +++ b/app/Http/Admin/Views/setting/wechat.volt @@ -0,0 +1,16 @@ +{% extends 'templates/main.volt' %} + +{% block content %} + +