fixed update tweet's comment essence status error

pull/455/head
Michael Li 1 year ago
parent a09233d547
commit 198cf5dff7
No known key found for this signature in database

@ -148,7 +148,7 @@ func (s *commentSrv) GetCommentRepliesByID(ids []int64) ([]*ms.CommentReplyForma
return repliesFormated, nil
}
func (s *commentManageSrv) HighlightComment(userId, commentId int64) (res int8, err error) {
func (s *commentManageSrv) HighlightComment(userId, commentId int64) (isEssence int8, err error) {
post := &dbr.Post{}
comment := &dbr.Comment{}
db := s.db.Model(comment)
@ -161,8 +161,12 @@ func (s *commentManageSrv) HighlightComment(userId, commentId int64) (res int8,
if post.UserID != userId {
return 0, cs.ErrNoPermission
}
comment.IsEssence = 1 - comment.IsEssence
return comment.IsEssence, db.Save(comment).Error
isEssence = 1 - comment.IsEssence
err = s.db.Model(comment).UpdateColumns(map[string]any{
"is_essence": isEssence,
"modified_on": time.Now().Unix(),
}).Where("id=?", commentId).Error
return
}
func (s *commentManageSrv) DeleteComment(comment *ms.Comment) (err error) {

Loading…
Cancel
Save