Browse Source

fix:问答列表、点赞/吐槽接口返回字段变更

Roc 2 năm trước cách đây
mục cha
commit
0fb484cea6

+ 4 - 3
controller/community/question.go

@@ -360,9 +360,10 @@ func SetLikeOrTease(c *gin.Context) {
 	}
 
 	response.OkData("操作成功", responseModel.RespCommunityQuestionLikeTease{
-		LikeNum:  likeNum,
-		TeaseNum: teaseNum,
-		Enabled:  communityQuestionLikeTease.Enabled,
+		LikeTotal:  likeNum,
+		TeaseTotal: teaseNum,
+		OpType:     communityQuestionLikeTease.OpType,
+		Enabled:    communityQuestionLikeTease.Enabled,
 	}, c)
 
 	return

+ 1 - 6
logic/yb_community_question/yb_community_question_like_tease.go

@@ -132,13 +132,8 @@ func HandleLikeOrTeaseByCommunityQuestionItemList(userId uint64, questionList []
 		}
 
 		if ybCommunityQuestionLikeTease, ok := ybCommunityQuestionLikeTeaseMap[uint32(v.CommunityQuestionID)]; ok {
-			switch ybCommunityQuestionLikeTease.OpType {
 			//类型. 1-点赞 2-吐槽
-			case 1:
-				v.IsLike = true
-			case 2:
-				v.IsTease = true
-			}
+			v.OpType = ybCommunityQuestionLikeTease.OpType
 		}
 	}
 	return

+ 5 - 5
models/response/community.go

@@ -22,8 +22,7 @@ type CommunityQuestionItem struct {
 	//AuthOk                  bool                          `json:"auth_ok" description:"是否有权限"`
 	//PermissionInfo          PermissionCheckInfo           `json:"permission_info"`
 	AudioList    []*CommunityQuestionAudioItem `json:"audio_list"`
-	IsLike       bool                          `json:"is_like" description:"是否已经点赞"`
-	IsTease      bool                          `json:"is_tease" description:"是否已经吐槽"`
+	OpType       int8                          `description:"类型. 1-点赞 2-吐槽" json:"op_type"`
 	LikeTotal    int                           `json:"like_total" description:"点赞数"`
 	TeaseTotal   int                           `json:"tease_total" description:"吐槽数"`
 	CommentTotal int                           `json:"comment_total" description:"总共评论数"`
@@ -85,9 +84,10 @@ type CommunityVideoItem struct {
 
 // RespCommunityQuestionLikeTease
 type RespCommunityQuestionLikeTease struct {
-	LikeNum  int64 `description:"点赞总数" json:"like_num"`
-	TeaseNum int64 `description:"吐槽总数" json:"tease_num"`
-	Enabled  int8  `description:"本次点赞/吐槽结果: 0-已取消赞 1-有效赞" json:"like_enabled"`
+	LikeTotal  int64 `description:"点赞总数" json:"like_total"`
+	TeaseTotal int64 `description:"吐槽总数" json:"tease_total"`
+	OpType     int8  `description:"类型. 1-点赞 2-吐槽" json:"op_type"`
+	Enabled    int8  `description:"本次点赞/吐槽结果: 0-已取消赞 1-有效赞" json:"enabled"`
 }
 
 // RespCommunityQuestionCommentAdd 新增问答留言返回