notice基础内容

This commit is contained in:
2025-06-23 18:13:14 +08:00
parent 1547fffc7e
commit a19e13280a
5 changed files with 137 additions and 1 deletions

40
src/controller/Notice.php Normal file
View File

@ -0,0 +1,40 @@
<?php
namespace jerryyan\notice\controller;
use jerryyan\notice\model\NoticeNotice;
use think\admin\Controller;
use think\admin\helper\QueryHelper;
/**
* 通知消息
* @auth false
*/
class Notice extends Controller
{
/**
* 通知消息
* @menu true
* @return void
*/
public function index()
{
$this->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
]);
}
}