From 137c7c80bde55990aae70b88a3e46f7618345953 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 20 Mar 2023 17:48:47 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv/group_power_cv/group_rank.go | 5 ----- route/group_power_r/group_rank.go | 10 ++++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cv/group_power_cv/group_rank.go b/cv/group_power_cv/group_rank.go index d562fa5..2432114 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 fcbcc43..7c665f1 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 -- 2.22.0