|
@@ -8,8 +8,10 @@ import (
|
|
|
"hongze/hongze_yb/models/response"
|
|
|
report "hongze/hongze_yb/models/tables/rddp/report"
|
|
|
"hongze/hongze_yb/models/tables/rddp/report_chapter"
|
|
|
+ "hongze/hongze_yb/models/tables/wx_user"
|
|
|
"hongze/hongze_yb/models/tables/yb_comment"
|
|
|
"hongze/hongze_yb/services/user"
|
|
|
+ "hongze/hongze_yb/utils"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -181,8 +183,10 @@ func List(user user.UserInfo, reportId, reportChapterId int, hotFlag bool, page
|
|
|
}
|
|
|
|
|
|
var commentIds []uint64
|
|
|
+ var userIds []uint64
|
|
|
for _, v := range commentList {
|
|
|
commentIds = append(commentIds, v.CommentId)
|
|
|
+ userIds = append(userIds, v.UserId)
|
|
|
}
|
|
|
// 查询所有的回复列表
|
|
|
replyListMap := make(map[uint64][]*response.ReplyItem)
|
|
@@ -199,18 +203,45 @@ func List(user user.UserInfo, reportId, reportChapterId int, hotFlag bool, page
|
|
|
t.Content = v.Content
|
|
|
t.AdminId = v.AdminId
|
|
|
t.CreateTime = v.CreateTime
|
|
|
- t.AdminName = ""
|
|
|
- t.AdminImg = ""
|
|
|
+ t.AdminName = "弘则研究"
|
|
|
+ t.AdminImgUrl = utils.DEFAULT_HONGZE_SYS_LOGO
|
|
|
replyListMap[v.ReplyCommentId] = append(replyListMap[v.ReplyCommentId], t)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 查询精选留言相关的用户
|
|
|
+ var userOthers []*wx_user.WxUser
|
|
|
+ if len(userIds) > 0 {
|
|
|
+ userOthers, err = wx_user.GetByUserIds(userIds)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = err.Error()
|
|
|
+ err = errors.New("查询精选留言用户出错")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ usersMap := make(map[uint64]*wx_user.WxUser)
|
|
|
+ for _, v := range userOthers {
|
|
|
+ usersMap[v.UserID] = v
|
|
|
+ }
|
|
|
var list []*response.RespCommentItem
|
|
|
for _, v := range commentList {
|
|
|
tmp := new(response.RespCommentItem)
|
|
|
tmp.CommentId = v.CommentId
|
|
|
tmp.UserId = v.UserId
|
|
|
- tmp.UserName = ""
|
|
|
- tmp.UserImg = ""
|
|
|
+ tmp.UserName = "匿名用户"
|
|
|
+ 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]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
tmp.Content = v.Content
|
|
|
tmp.IsHot = v.IsHot
|
|
|
tmp.IsTop = v.IsTop
|