You've already forked think-plugs-notice
notice基础内容
This commit is contained in:
40
src/controller/Notice.php
Normal file
40
src/controller/Notice.php
Normal 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
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user