fix: UID 类型混用统一(uint ↔ string)
- Comment.ReplyToUID string→uint, 移除 varchar(36) gorm 约束 - CommentMention.UID string→uint, 移除 varchar(36) gorm 约束 - UserSearchResult.UID string→uint - 移除 SearchUsersByLevel 中 strconv.FormatUint 转换 - 删除 GetUserUIDByID 方法,CreateReply 直接使用 parent.UserID - fillReplyToNames 使用 map[uint]string 替代 map[string]string - 更新 commentStore 接口声明 - 修复前端 mention 下拉 show.html 中 u.id→u.uid
This commit is contained in:
@ -88,15 +88,12 @@ func (s *CommentService) CreateReply(userID uint, parentID uint, body string) (*
|
||||
}
|
||||
|
||||
comment := &model.Comment{
|
||||
PostID: parent.PostID,
|
||||
RootID: parent.RootID,
|
||||
ParentID: &parentID,
|
||||
Body: body,
|
||||
UserID: userID,
|
||||
}
|
||||
// 获取被回复者UID
|
||||
if replyToUID, err := s.repo.GetUserUIDByID(parent.UserID); err == nil {
|
||||
comment.ReplyToUID = replyToUID
|
||||
PostID: parent.PostID,
|
||||
RootID: parent.RootID,
|
||||
ParentID: &parentID,
|
||||
Body: body,
|
||||
UserID: userID,
|
||||
ReplyToUID: parent.UserID,
|
||||
}
|
||||
|
||||
if err := s.repo.Create(comment); err != nil {
|
||||
|
||||
@ -154,11 +154,10 @@ type commentStore interface {
|
||||
FindPostIDByComment(commentID uint) (uint, error)
|
||||
FindPostAuthorID(postID uint) (uint, error)
|
||||
SearchUsersByLevel(keyword string, minLevel, limit int) ([]struct {
|
||||
UID string
|
||||
UID uint
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user