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'} -
- {include file='keys/index_search'} - - {notempty name='list'} - - - - - - - - - - - - - {/notempty} - - {foreach $list as $key=>$vo} - - - - - - - - - - - {/foreach} - -
- - - - 关键字类型预览添加时间状态
- - - - - {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} - - - 编 辑 - - - - 禁 用 - - 激 活 - - - - 删 除 - - -
- {empty name='list'}没有记录哦{else}{$pagehtml|raw|default=''}{/empty} +{block name="content"} +
+ +
+ {include file='keys/index_search'} +
+
+{/block} + +{block name='script'} + + + + + + + + + + + + {/block} \ No newline at end of file diff --git a/app/wechat/view/keys/index_search.html b/app/wechat/view/keys/index_search.html index 9c9129987..dec781a98 100644 --- a/app/wechat/view/keys/index_search.html +++ b/app/wechat/view/keys/index_search.html @@ -1,18 +1,20 @@
条件搜索