浏览代码

Merge branch 'qa_rand_avatar_20220914' into debug

hsun 2 年之前
父节点
当前提交
f11db77eae
共有 1 个文件被更改,包括 23 次插入16 次删除
  1. 23 16
      controller/community/comment.go

+ 23 - 16
controller/community/comment.go

@@ -6,7 +6,6 @@ import (
 	"hongze/hongze_yb/logic/yb_community_question"
 	"hongze/hongze_yb/logic/yb_community_question"
 	"hongze/hongze_yb/models/request"
 	"hongze/hongze_yb/models/request"
 	responseModel "hongze/hongze_yb/models/response"
 	responseModel "hongze/hongze_yb/models/response"
-	"hongze/hongze_yb/models/tables/wx_user"
 	"hongze/hongze_yb/models/tables/yb_community_question_comment"
 	"hongze/hongze_yb/models/tables/yb_community_question_comment"
 	"hongze/hongze_yb/services"
 	"hongze/hongze_yb/services"
 	userService "hongze/hongze_yb/services/user"
 	userService "hongze/hongze_yb/services/user"
@@ -23,27 +22,35 @@ func Comment(c *gin.Context) {
 	userInfo := userService.GetInfoByClaims(c)
 	userInfo := userService.GetInfoByClaims(c)
 
 
 	var qaAvatarUrl string
 	var qaAvatarUrl string
-	if userInfo.QaAvatarUrl == "" {
-		avatar, err := yb_community_question_comment.GetUserAvatarRandom()
-		if err != nil {
-			response.FailMsg("发布失败", err.Error(), c)
-			return
-		}
-		qaAvatarUrl = avatar.AvatarUrl
-		err = wx_user.ModifyQaAvatarUrl(qaAvatarUrl, userInfo.UserID)
-		if err != nil {
-			response.FailMsg("发布失败", err.Error(), c)
-			return
-		}
-	} else {
-		qaAvatarUrl = userInfo.QaAvatarUrl
+	//if userInfo.QaAvatarUrl == "" {
+	//	avatar, err := yb_community_question_comment.GetUserAvatarRandom()
+	//	if err != nil {
+	//		response.FailMsg("发布失败", err.Error(), c)
+	//		return
+	//	}
+	//	qaAvatarUrl = avatar.AvatarUrl
+	//	err = wx_user.ModifyQaAvatarUrl(qaAvatarUrl, userInfo.UserID)
+	//	if err != nil {
+	//		response.FailMsg("发布失败", err.Error(), c)
+	//		return
+	//	}
+	//} else {
+	//	qaAvatarUrl = userInfo.QaAvatarUrl
+	//}
+
+	// 2022-0914修改为全随机
+	avatar, e := yb_community_question_comment.GetUserAvatarRandom()
+	if e != nil {
+		response.FailMsg("发布失败", e.Error(), c)
+		return
 	}
 	}
+	qaAvatarUrl = avatar.AvatarUrl
 
 
 	req.IsShowName = 0
 	req.IsShowName = 0
 	if userInfo.NickName != `` { //非空串时为实名
 	if userInfo.NickName != `` { //非空串时为实名
 		req.IsShowName = 1
 		req.IsShowName = 1
 	}
 	}
-	ybCommunityQuestionComment, err, errMsg := yb_community_question.Comment(userInfo, req.CommunityQuestionID, req.Content, req.SourceAgent, req.IsShowName,qaAvatarUrl)
+	ybCommunityQuestionComment, err, errMsg := yb_community_question.Comment(userInfo, req.CommunityQuestionID, req.Content, req.SourceAgent, req.IsShowName, qaAvatarUrl)
 	if err != nil {
 	if err != nil {
 		response.FailMsg(errMsg, err.Error(), c)
 		response.FailMsg(errMsg, err.Error(), c)
 		return
 		return