fix: 评论系统全量检查修复(7 项 Gap 全部修复)
- Delete 权限:新增 requesterID/isAdmin 参数,Service 层鉴权(仅本人/管理员可删)
- 通知内容:改用 GetUsernameByID 显示真实用户名,非数字 UID
- SearchUsers:Repository 返回 exp,Service 调用 GetLevelByExp 计算等级
- 通知高亮:Notification 新增 CommentID 字段,消息链接支持 #comment-{id}
- 已删除提示:前端 hash 检测 + 3 秒超时 Toast "该评论已不存在"
- Admin CSS:移除不存在的 comments.css 引用
- 错误哨兵:改用 common.ErrCommentNotFound/ErrCommentEmpty/PermissionDenied
This commit is contained in:
@ -86,7 +86,7 @@ type taskStore interface {
|
||||
|
||||
// levelNotifier 等级升级通知接口
|
||||
type levelNotifier interface {
|
||||
Create(userID uint, notifyType, title, content string, relatedID *uint) error
|
||||
Create(userID uint, notifyType, title, content string, relatedID, commentID *uint) error
|
||||
}
|
||||
|
||||
// EnergyStore EnergyService 所需的完整仓储接口
|
||||
@ -113,7 +113,7 @@ type energyStore = EnergyStore
|
||||
|
||||
// energyNotifier EnergyService 所需的通知接口(ISP)
|
||||
type energyNotifier interface {
|
||||
Create(userID uint, notifyType, title, content string, relatedID *uint) error
|
||||
Create(userID uint, notifyType, title, content string, relatedID, commentID *uint) error
|
||||
}
|
||||
|
||||
// commentStore CommentService 所需的最小仓储接口(ISP)
|
||||
@ -132,12 +132,14 @@ type commentStore interface {
|
||||
SearchUsersByLevel(keyword string, minLevel, limit int) ([]struct {
|
||||
UID string
|
||||
Username string
|
||||
Exp int
|
||||
}, error)
|
||||
GetUserUIDByID(userID uint) (string, error)
|
||||
GetUsernameByID(userID uint) (string, error)
|
||||
ListAllComments(keyword string, showDeleted bool, offset, limit int) ([]model.AdminCommentRow, int64, error)
|
||||
}
|
||||
|
||||
// commentNotifier CommentService 所需的通知接口(ISP)
|
||||
type commentNotifier interface {
|
||||
Create(userID uint, notifyType, title, content string, relatedID *uint) error
|
||||
Create(userID uint, notifyType, title, content string, relatedID, commentID *uint) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user