feat(admin): 添加后台首页入口和通知模块

- 新增 Index 控制器,实现后台首页逻辑- 添加通知模块,展示未读通知数量
- 实现用户资料修改和密码更改功能
- 添加主题切换功能
- 优化登录和权限验证流程
- 新增首页模板和样式
This commit is contained in:
2025-08-31 18:01:32 +08:00
parent 50f25d251d
commit 288f3886e4
2 changed files with 21 additions and 0 deletions

View File

@@ -37,4 +37,8 @@ class Notice extends Controller
'read_at' => null
]);
}
protected function _read_save_result() {
$this->success('成功!', 'javascript:location.reload()', 1);
}
}

View File

@@ -10,4 +10,21 @@ class NoticeNotice extends Model
{
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();
}
}