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