Files
think-plugs-notice/src/model/NoticeNotice.php
Jerry Yan 288f3886e4 feat(admin): 添加后台首页入口和通知模块
- 新增 Index 控制器,实现后台首页逻辑- 添加通知模块,展示未读通知数量
- 实现用户资料修改和密码更改功能
- 添加主题切换功能
- 优化登录和权限验证流程
- 新增首页模板和样式
2025-08-31 18:01:32 +08:00

30 lines
602 B
PHP

<?php
namespace jerryyan\notice\model;
use think\admin\Model;
class NoticeNotice extends Model
{
public static function types()
{
return static::mk()->group('type')->field('type,count(id) as count')->select();
}
/**
* 获取当前用户未读通知数量
* @return int
*/
public static function getUnreadCount()
{
$userId = session('user.id');
if (!$userId) {
return 0;
}
return static::mk()
->where('staff_id', $userId)
->whereNull('read_at')
->count();
}
}