2022-09-27 17:59:05 +08:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
2022-10-24 16:51:05 +08:00
|
|
|
"github.com/answerdev/answer/internal/base/handler"
|
|
|
|
"github.com/answerdev/answer/internal/base/middleware"
|
|
|
|
"github.com/answerdev/answer/internal/schema"
|
|
|
|
"github.com/answerdev/answer/internal/service/rank"
|
2022-09-27 17:59:05 +08:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RankController rank controller
|
|
|
|
type RankController struct {
|
|
|
|
rankService *rank.RankService
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewRankController new controller
|
|
|
|
func NewRankController(
|
|
|
|
rankService *rank.RankService) *RankController {
|
|
|
|
return &RankController{rankService: rankService}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetRankPersonalWithPage user personal rank list
|
|
|
|
// @Summary user personal rank list
|
|
|
|
// @Description user personal rank list
|
|
|
|
// @Tags Rank
|
|
|
|
// @Produce json
|
|
|
|
// @Param page query int false "page"
|
|
|
|
// @Param page_size query int false "page size"
|
|
|
|
// @Param username query string false "username"
|
2023-05-29 10:38:59 +08:00
|
|
|
// @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetRankPersonalPageResp}}
|
2022-09-27 17:59:05 +08:00
|
|
|
// @Router /answer/api/v1/personal/rank/page [get]
|
|
|
|
func (cc *RankController) GetRankPersonalWithPage(ctx *gin.Context) {
|
|
|
|
req := &schema.GetRankPersonalWithPageReq{}
|
|
|
|
if handler.BindAndCheck(ctx, req) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
req.UserID = middleware.GetLoginUserIDFromContext(ctx)
|
|
|
|
|
2023-05-29 10:38:59 +08:00
|
|
|
resp, err := cc.rankService.GetRankPersonalPage(ctx, req)
|
2022-09-27 17:59:05 +08:00
|
|
|
handler.HandleResponse(ctx, err, resp)
|
|
|
|
}
|