From 64dd473329a51ccaf5d6680d40e80d295e47449d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 21 Apr 2017 14:59:52 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E5=BE=AE=E4=BF=A1=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/extra/view/admin.main.html | 12 +++--- application/wechat/controller/Keys.php | 48 +++++++++++++++++++-- application/wechat/view/keys.form.html | 39 +++++++++-------- public/static/theme/default/css/console.css | 2 +- 4 files changed, 72 insertions(+), 29 deletions(-) diff --git a/application/extra/view/admin.main.html b/application/extra/view/admin.main.html index 676d7495c..98fd1a13e 100644 --- a/application/extra/view/admin.main.html +++ b/application/extra/view/admin.main.html @@ -6,13 +6,13 @@ {block name="title"}{$title|default=''} {if !empty($title)}-{/if} {:sysconf('site_name')}{/block} - - - - {block name="style"}{/block} + + + + {block name="style"}{/block} - - + + {block name="bodyTag"} diff --git a/application/wechat/controller/Keys.php b/application/wechat/controller/Keys.php index 36654da8f..754ae41b3 100644 --- a/application/wechat/controller/Keys.php +++ b/application/wechat/controller/Keys.php @@ -26,6 +26,10 @@ use think\Db; */ class Keys extends BasicAdmin { + /** + * 指定当前数据表 + * @var string + */ protected $table = 'WechatKeys'; /** @@ -54,7 +58,7 @@ class Keys extends BasicAdmin { */ public function add() { $this->assign('title', '添加关键字规则'); - return $this->_form($this->table, 'form', 'id'); + return $this->_form($this->table, 'form'); } /** @@ -63,10 +67,14 @@ class Keys extends BasicAdmin { */ public function edit() { $this->assign('title', '编辑关键字规则'); - return $this->_form($this->table, 'form', 'id'); + return $this->_form($this->table, 'form'); } + /** + * 表单处理 + * @param $data + */ protected function _form_filter($data) { if ($this->request->isPost() && isset($data['keys'])) { $db = Db::name($this->table)->where('keys', $data['keys']); @@ -87,11 +95,43 @@ class Keys extends BasicAdmin { $this->error("关键字删除失败,请稍候再试!"); } + /** + * 关注默认回复 + */ public function subscribe() { - + $this->assign('title', '编辑默认回复'); + return $this->_form($this->table, 'form'); } - public function defaults() { + /** + * 关注默认回复表单处理 + * @param $data + */ + protected function _subscribe_form_filter(&$data) { + if ($this->request->isGet()) { + $data = Db::name($this->table)->where('keys', 'subscribe')->find(); + } + $data['keys'] = 'subscribe'; + } + + /** + * 无配置默认回复 + */ + public function defaults() { + $this->assign('title', '编辑无配置默认回复'); + return $this->_form($this->table, 'form'); + } + + + /** + * 无配置默认回复表单处理 + * @param $data + */ + protected function _defaults_form_filter(&$data) { + if ($this->request->isGet()) { + $data = Db::name($this->table)->where('keys', 'default')->find(); + } + $data['keys'] = 'default'; } } diff --git a/application/wechat/view/keys.form.html b/application/wechat/view/keys.form.html index 0dc23f9ce..cd7431066 100644 --- a/application/wechat/view/keys.form.html +++ b/application/wechat/view/keys.form.html @@ -4,7 +4,8 @@