fix: 修复预处理器atUserID属性赋值

pull/38/head
1005281342 3 years ago
parent cadde4ae89
commit 36bff95834

@ -186,21 +186,22 @@ func (svc *Service) DeletePostComment(comment *model.Comment) error {
return svc.dao.DeleteComment(comment)
}
func (svc *Service) createPostPreHandler(commentID int64, userID, atUserID int64) (*model.Post, *model.Comment, error) {
func (svc *Service) createPostPreHandler(commentID int64, userID, atUserID int64) (*model.Post, *model.Comment, int64,
error) {
// 加载Comment
comment, err := svc.dao.GetCommentByID(commentID)
if err != nil {
return nil, nil, err
return nil, nil, atUserID, err
}
// 加载comment的post
post, err := svc.dao.GetPostByID(comment.PostID)
if err != nil {
return nil, nil, err
return nil, nil, atUserID, err
}
if post.CommentCount >= global.AppSetting.MaxCommentCount {
return nil, nil, errcode.MaxCommentCount
return nil, nil, atUserID, errcode.MaxCommentCount
}
if userID == atUserID {
@ -215,12 +216,16 @@ func (svc *Service) createPostPreHandler(commentID int64, userID, atUserID int64
}
}
return post, comment, nil
return post, comment, atUserID, nil
}
func (svc *Service) CreatePostCommentReply(commentID int64, content string, userID, atUserID int64) (*model.CommentReply, error) {
var post, comment, err = svc.createPostPreHandler(commentID, userID, atUserID)
if err != nil {
var (
post *model.Post
comment *model.Comment
err error
)
if post, comment, atUserID, err = svc.createPostPreHandler(commentID, userID, atUserID); err != nil {
return nil, err
}

Loading…
Cancel
Save