Browse Source

修改匿名用户随机数

xiexiaoyuan 2 năm trước cách đây
mục cha
commit
0375148176

+ 1 - 1
models/tables/yb_comment/query.go

@@ -72,7 +72,7 @@ func GetHotListTotalByOldReportId(oldReportId, oldReportChapterId int)(total int
 func GetReplyListByReplyCommentId(replyCommentIds []uint64) (list []*YbComment, err error) {
 func GetReplyListByReplyCommentId(replyCommentIds []uint64) (list []*YbComment, err error) {
 	err = global.DEFAULT_MYSQL.Model(YbComment{}).
 	err = global.DEFAULT_MYSQL.Model(YbComment{}).
 		Where("enabled = 1 and type = 2 and reply_comment_id in ?", replyCommentIds).
 		Where("enabled = 1 and type = 2 and reply_comment_id in ?", replyCommentIds).
-		Order("create_time desc, comment_id desc").
+		Order("comment_id asc").
 		Scan(&list).Error
 		Scan(&list).Error
 	return
 	return
 }
 }

+ 5 - 13
services/comment/comment.go

@@ -210,7 +210,7 @@ func List(user user.UserInfo,  reportId, reportChapterId, oldReportId, oldReport
 				err = errors.New("查询精选留言列表出错")
 				err = errors.New("查询精选留言列表出错")
 				return
 				return
 			}
 			}
-			total, err = yb_comment.GetHotListTotalByOldReportId(oldReportId, oldReportChapterId,)
+			total, err = yb_comment.GetHotListTotalByOldReportId(oldReportId, oldReportChapterId)
 			if err != nil {
 			if err != nil {
 				errMsg = err.Error()
 				errMsg = err.Error()
 				err = errors.New("查询精选留言总数出错")
 				err = errors.New("查询精选留言总数出错")
@@ -284,19 +284,11 @@ func List(user user.UserInfo,  reportId, reportChapterId, oldReportId, oldReport
 		tmp := new(response.RespCommentItem)
 		tmp := new(response.RespCommentItem)
 		tmp.CommentId = v.CommentId
 		tmp.CommentId = v.CommentId
 		tmp.UserId = v.UserId
 		tmp.UserId = v.UserId
-		tmp.UserName = "匿名用户"
+		tmp.UserName = "匿名用户"+strconv.Itoa(int(v.CommentId+v.UserId))
 		tmp.UserImgUrl = utils.DEFAULT_HONGZE_USER_LOGO
 		tmp.UserImgUrl = utils.DEFAULT_HONGZE_USER_LOGO
-		if info, ok := usersMap[v.UserId]; ok {
-			if v.IsShowName == 1 {   //是否匿名 0-匿名,1-不匿名
-				tmp.UserName = info.NickName
-				tmp.UserImgUrl = info.Headimgurl
-			}else{
-				if info.Mobile != "" {
-					tmp.UserName += info.Mobile[7:]
-				}else if info.OpenID != "" {
-					tmp.UserName += info.OpenID[3:8]
-				}
-			}
+		if info, ok := usersMap[v.UserId]; ok && v.IsShowName == 1{
+			tmp.UserName = info.NickName
+			tmp.UserImgUrl = info.Headimgurl
 		}
 		}
 		tmp.Content = v.Content
 		tmp.Content = v.Content
 		tmp.IsHot = v.IsHot
 		tmp.IsHot = v.IsHot