Skip to content

Commit

Permalink
fest: 支持评论免审核设置 #58
Browse files Browse the repository at this point in the history
  • Loading branch information
fesiong committed Aug 4, 2024
1 parent bbb333a commit 0670f64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controller/apiTag.go
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,13 @@ func ApiCommentPublish(ctx iris.Context) {
userId := ctx.Values().GetIntDefault("userId", 0)
if userId > 0 {
req.Status = 1
userInfo := ctx.Values().Get("userInfo")
if userInfo != nil {
user, ok := userInfo.(*model.User)
if ok {
req.UserName = user.UserName
}
}
}

req.UserId = uint(userId)
Expand Down
9 changes: 9 additions & 0 deletions controller/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ func CommentPublish(ctx iris.Context) {
req.Content = ctx.PostValueTrim("content")
req.ParentId = uint(ctx.PostValueIntDefault("parent_id", 0))
req.ToUid = uint(ctx.PostValueIntDefault("to_uid", 0))
if userId > 0 {
userInfo := ctx.Values().Get("userInfo")
if userInfo != nil {
user, ok := userInfo.(*model.User)
if ok {
req.UserName = user.UserName
}
}
}

req.Status = status
req.UserId = uint(userId)
Expand Down

0 comments on commit 0670f64

Please sign in to comment.