From e77d7b18b8343b0895fc108c939acf743bd974bd Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Thu, 19 Sep 2024 15:44:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8C=9C=E4=BD=A0=E5=96=9C?= =?UTF-8?q?=E6=AC=A2=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controller/Question.go | 17 +++++++++++++++++ api/router/router.go | 3 +++ 2 files changed, 20 insertions(+) diff --git a/api/controller/Question.go b/api/controller/Question.go index 9f5a299..9bd09d6 100644 --- a/api/controller/Question.go +++ b/api/controller/Question.go @@ -344,3 +344,20 @@ func (r *Question) PutQuestionSubmitCount(c *gin.Context) { responses.Ok(c) } + +// GetGuessUserLikeList 获取问题列表-猜你喜欢 +func (b *Question) GetGuessUserLikeList(c *gin.Context) { + userId := c.GetInt64("UserId") + + // 获取数据 + questionService := service.QuestionService{} + questions, err := questionService.GetGuessUserLIkeList(userId) + if err != nil { + responses.OkWithData(nil, c) + } + + // 处理返回值 + g := dto.GetHotQuestionListDto(questions) + + responses.OkWithData(g, c) +} diff --git a/api/router/router.go b/api/router/router.go index 7e0db35..cc8d272 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -212,6 +212,9 @@ func privateRouter(r *gin.Engine, api controller.Api) { // 增加问题提交次数(提交个人信息进行了算算的人次) clickGroup.PUT("/submit/:question_id", api.Question.PutQuestionSubmitCount) } + + // 获取问题列表-猜你喜欢 + questionGroup.GET("/like", api.Question.GetGuessUserLikeList) } // 用户