From a19e13280a597ef1416687618b79e03ca7790d2d Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 23 Jun 2025 18:13:14 +0800 Subject: [PATCH] =?UTF-8?q?notice=E5=9F=BA=E7=A1=80=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Service.php | 10 ++++++- src/controller/Notice.php | 40 ++++++++++++++++++++++++++++ src/model/NoticeNotice.php | 13 +++++++++ src/view/notice/index.html | 44 +++++++++++++++++++++++++++++++ src/view/notice/index_search.html | 31 ++++++++++++++++++++++ 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 src/controller/Notice.php create mode 100644 src/model/NoticeNotice.php create mode 100644 src/view/notice/index.html create mode 100644 src/view/notice/index_search.html diff --git a/src/Service.php b/src/Service.php index 78394d0..4f8766f 100644 --- a/src/Service.php +++ b/src/Service.php @@ -7,9 +7,17 @@ use think\admin\Plugin; class Service extends Plugin { protected $appName = '通知提醒'; + protected $appCode = 'notice'; public static function menu(): array { - return []; + return [ + [ + 'name' => '通知提醒', + 'subs' => [ + ['name' => '通知提醒', 'icon' => 'layui-icon layui-icon-cols', 'url' => 'notice/notice/index'], + ] + ] + ]; } } \ No newline at end of file diff --git a/src/controller/Notice.php b/src/controller/Notice.php new file mode 100644 index 0000000..a5d07b5 --- /dev/null +++ b/src/controller/Notice.php @@ -0,0 +1,40 @@ +title = '通知消息'; + NoticeNotice::mQuery()->layTable(function () { + $this->types = NoticeNotice::types(); + }, static function (QueryHelper $query) { + $query->where('staff_id', '=', session('user.id')); + $query->equal('status')->like('type,content'); + }); + } + + public function read() + { + NoticeNotice::mSave([ + 'read_at' => date('Y-m-d H:i:s'), + ], '', [ + 'staff_id' => session('user.id'), + 'read_at' => null + ]); + } +} \ No newline at end of file diff --git a/src/model/NoticeNotice.php b/src/model/NoticeNotice.php new file mode 100644 index 0000000..4c1aef7 --- /dev/null +++ b/src/model/NoticeNotice.php @@ -0,0 +1,13 @@ +group('type')->field('type,count(id) as count')->select(); + } +} \ No newline at end of file diff --git a/src/view/notice/index.html b/src/view/notice/index.html new file mode 100644 index 0000000..b373966 --- /dev/null +++ b/src/view/notice/index.html @@ -0,0 +1,44 @@ +{extend name='table'} + +{block name="button"} +{:lang('全部已读')} +{/block} + +{block name="content"} +
+ {include file="notice/index_search"} +
+
+ + +{/block} \ No newline at end of file diff --git a/src/view/notice/index_search.html b/src/view/notice/index_search.html new file mode 100644 index 0000000..286a173 --- /dev/null +++ b/src/view/notice/index_search.html @@ -0,0 +1,31 @@ +
+ {:lang('条件搜索')} + +
\ No newline at end of file