feat: 封禁用户允许登录但禁止写操作

- Session 结构体新增 Status 字段,Create/Validate 同步状态
- AuthService.Login 移除封禁检查,允许封禁用户登录
- 新增 BannedWriteGuard 中间件,拦截 POST/PUT/DELETE 写操作
- 封禁用户自动签到跳过
- 所有需登录的 API 路由组应用 BannedWriteGuard
- AdminService.UpdateUserStatus 保留 DestroyByUID 确保状态刷新
This commit is contained in:
2026-05-31 21:20:04 +08:00
parent a84fa5da61
commit bbcd992614
7 changed files with 44 additions and 18 deletions

View File

@ -14,6 +14,7 @@ type Session struct {
Username string // 用户名
Avatar string // 头像 URL
Role string // 角色
Status string // 账号状态active/banned/deleted/locked
Exp int // 经验值(用于前端实时展示等级)
RememberMe bool // 是否持久化(决定 cookie maxAge
IP string // 登录 IP