diff --git a/cv/group_power_cv/group_rank.go b/cv/group_power_cv/group_rank.go index d562fa5c87b4f748fec47d747b5ab918909338d5..243211416d02814a333ebe0dceb4c8ebdd6ba6f2 100644 --- a/cv/group_power_cv/group_rank.go +++ b/cv/group_power_cv/group_rank.go @@ -40,11 +40,6 @@ type CvGroupPowerRank struct { Items []CvGroupPowerRankData `json:"items"` // 列表 } -type CvGroupPowerRankTop3 struct { - Period string `json:"period"` // 榜单周期 day:日 week:周 month:月 - Items []CvGroupPowerRankData `json:"items"` // 列表 -} - type CvGroupPowerRankData struct { CvGroupPowerBase `json:",inline"` CvGroupPowerGrade `json:",inline"` diff --git a/route/group_power_r/group_rank.go b/route/group_power_r/group_rank.go index fcbcc43ae77cf297c8ba067d29e7b330f855e42f..7c665f1ad215efdc27ba45f8a6fbcf59ef34e280 100644 --- a/route/group_power_r/group_rank.go +++ b/route/group_power_r/group_rank.go @@ -24,7 +24,7 @@ import ( // @Param token header string true "token" // @Param nonce header string true "随机数字" // @Param period path string true "榜单周期 day:日 week:周 month:月" -// @Success 200 {object} []group_power_cv.CvGroupPowerRankTop3 +// @Success 200 {object} []group_power_cv.CvGroupPowerRank // @Router /v1/groupPower/rank/{period} [get] func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) { myContext := mycontext.CreateMyContext(c.Keys) @@ -111,12 +111,12 @@ func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) { // @Summary 家族日周月榜单top3 // @Param token header string true "token" // @Param nonce header string true "随机数字" -// @Success 200 {object} []group_power_cv.CvGroupPowerRankTop3 +// @Success 200 {object} map[string][]group_power_cv.CvGroupPowerRankData // @Router /v1/groupPower/rankTop [get] func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) { myContext := mycontext.CreateMyContext(c.Keys) periods := []string{"day", "week", "month"} - var response []group_power_cv.CvGroupPowerRankTop3 + var response = make(map[string][]group_power_cv.CvGroupPowerRankData) for _, period := range periods { var beginDate, endDate string switch period { @@ -145,9 +145,8 @@ func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) { if err != nil { return myContext, err } - data := group_power_cv.CvGroupPowerRankTop3{Period: period} for _, v := range rank { - data.Items = append(data.Items, group_power_cv.CvGroupPowerRankData{ + response[period] = append(response[period], group_power_cv.CvGroupPowerRankData{ CvGroupPowerBase: group_power_cv.CvGroupPowerBase{ Id: v.GroupPowerId, Icon: groupPowers[v.GroupPowerId].Icon, @@ -161,7 +160,6 @@ func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) { Rank: v.Rank, }) } - response = append(response, data) } resp.ResponseOk(c, response) return myContext, nil