QuestionPage get questions by page @Summary get questions by page @Description get questions by page @Tags Question @Accept json @Produce json @Param data body schema.QuestionPageReq true "QuestionPageReq" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.QuestionPageResp}
(ctx *gin.Context)
| 324 | // @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.QuestionPageResp}} |
| 325 | // @Router /answer/api/v1/question/page [get] |
| 326 | func (qc *QuestionController) QuestionPage(ctx *gin.Context) { |
| 327 | req := &schema.QuestionPageReq{} |
| 328 | if handler.BindAndCheck(ctx, req) { |
| 329 | return |
| 330 | } |
| 331 | req.LoginUserID = middleware.GetLoginUserIDFromContext(ctx) |
| 332 | |
| 333 | questions, total, err := qc.questionService.GetQuestionPage(ctx, req) |
| 334 | if err != nil { |
| 335 | handler.HandleResponse(ctx, err, nil) |
| 336 | return |
| 337 | } |
| 338 | if pager.ValPageOutOfRange(total, req.Page, req.PageSize) { |
| 339 | handler.HandleResponse(ctx, errors.NotFound(reason.RequestFormatError), nil) |
| 340 | return |
| 341 | } |
| 342 | handler.HandleResponse(ctx, nil, pager.NewPageModel(total, questions)) |
| 343 | } |
| 344 | |
| 345 | // QuestionRecommendPage get recommend questions by page |
| 346 | // @Summary get recommend questions by page |
nothing calls this directly
no test coverage detected