diff --git a/app/wechat/controller/Keys.php b/app/wechat/controller/Keys.php
index a05b68f8f..6f7f3dd2a 100644
--- a/app/wechat/controller/Keys.php
+++ b/app/wechat/controller/Keys.php
@@ -42,6 +42,9 @@ class Keys extends Controller
* 回复规则管理
* @auth true
* @menu true
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
@@ -56,10 +59,13 @@ class Keys extends Controller
$this->error("生成二维码失败,请稍候再试!
{$exception->getMessage()}");
}
// 数据列表分页处理
- $this->title = '回复规则管理';
- WechatKeys::mQuery(null, function (QueryHelper $query) {
- $query->equal('status')->like('keys,type')->dateBetween('create_at');
- $query->whereNotIn('keys', ['subscribe', 'default'])->order('sort desc,id desc')->page();
+ $this->type = input('get.type', 'index');
+ WechatKeys::mQuery()->layTable(function () {
+ $this->title = '回复规则管理';
+ }, function (QueryHelper $query) {
+ $query->whereNotIn('keys', ['subscribe', 'default']);
+ $query->like('keys,type#mtype')->dateBetween('create_at');
+ $query->where(['status' => intval($this->type === 'index')]);
});
}
diff --git a/app/wechat/model/WechatKeys.php b/app/wechat/model/WechatKeys.php
index 6e9a05cb6..ac01bc5b1 100644
--- a/app/wechat/model/WechatKeys.php
+++ b/app/wechat/model/WechatKeys.php
@@ -25,4 +25,13 @@ use think\admin\Model;
*/
class WechatKeys extends Model
{
+ /**
+ * 格式化创建时间
+ * @param string $value
+ * @return string
+ */
+ public function getCreateAtAttr(string $value): string
+ {
+ return format_datetime($value);
+ }
}
\ No newline at end of file
diff --git a/app/wechat/view/keys/index.html b/app/wechat/view/keys/index.html
index 1ec6cb9a7..398fcd69b 100644
--- a/app/wechat/view/keys/index.html
+++ b/app/wechat/view/keys/index.html
@@ -1,91 +1,118 @@
-{extend name="../../admin/view/main"}
+{extend name="../../admin/view/table"}
{block name="button"}
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
{/block}
-{block name='content'}
-
- - | -- - | -关键字 | -类型 | -预览 | -添加时间 | -状态 | -- |
---|---|---|---|---|---|---|---|
- - | -- - | -- {notempty name='vo.qrc'} - - {/notempty} - {$vo.keys} - | -{$vo.type} | -- {if $vo.type eq '音乐'} - 预览 - {elseif in_array($vo.type,['文字','转客服'])} - 预览 - {elseif $vo.type eq '图片'} - 预览 - {elseif $vo.type eq '图文'} - 预览 - {elseif $vo.type eq '视频'} - 预览 - {elseif $vo.type eq '语音'} - 预览 - {else} {$vo.content} {/if} - | -{$vo.create_at|format_datetime} | -{if $vo.status eq 0}已禁用{elseif $vo.status eq 1}已激活{/if} | -- - - 编 辑 - - - - 禁 用 - - 激 活 - - - - 删 除 - - - | -