You've already forked think-plugs-notice
40 lines
889 B
PHP
40 lines
889 B
PHP
<?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
|
|
]);
|
|
}
|
|
} |