Commit 137c7c80 authored by hujiebin's avatar hujiebin

feat:调整

parent 41a0b694
...@@ -40,11 +40,6 @@ type CvGroupPowerRank struct { ...@@ -40,11 +40,6 @@ type CvGroupPowerRank struct {
Items []CvGroupPowerRankData `json:"items"` // 列表 Items []CvGroupPowerRankData `json:"items"` // 列表
} }
type CvGroupPowerRankTop3 struct {
Period string `json:"period"` // 榜单周期 day:日 week:周 month:月
Items []CvGroupPowerRankData `json:"items"` // 列表
}
type CvGroupPowerRankData struct { type CvGroupPowerRankData struct {
CvGroupPowerBase `json:",inline"` CvGroupPowerBase `json:",inline"`
CvGroupPowerGrade `json:",inline"` CvGroupPowerGrade `json:",inline"`
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
// @Param token header string true "token" // @Param token header string true "token"
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param period path string true "榜单周期 day:日 week:周 month:月" // @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] // @Router /v1/groupPower/rank/{period} [get]
func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) { func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
...@@ -111,12 +111,12 @@ func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -111,12 +111,12 @@ func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) {
// @Summary 家族日周月榜单top3 // @Summary 家族日周月榜单top3
// @Param token header string true "token" // @Param token header string true "token"
// @Param nonce header string true "随机数字" // @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] // @Router /v1/groupPower/rankTop [get]
func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) { func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
periods := []string{"day", "week", "month"} periods := []string{"day", "week", "month"}
var response []group_power_cv.CvGroupPowerRankTop3 var response = make(map[string][]group_power_cv.CvGroupPowerRankData)
for _, period := range periods { for _, period := range periods {
var beginDate, endDate string var beginDate, endDate string
switch period { switch period {
...@@ -145,9 +145,8 @@ func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -145,9 +145,8 @@ func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) {
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
data := group_power_cv.CvGroupPowerRankTop3{Period: period}
for _, v := range rank { 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{ CvGroupPowerBase: group_power_cv.CvGroupPowerBase{
Id: v.GroupPowerId, Id: v.GroupPowerId,
Icon: groupPowers[v.GroupPowerId].Icon, Icon: groupPowers[v.GroupPowerId].Icon,
...@@ -161,7 +160,6 @@ func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -161,7 +160,6 @@ func GroupPowerRankTop(c *gin.Context) (*mycontext.MyContext, error) {
Rank: v.Rank, Rank: v.Rank,
}) })
} }
response = append(response, data)
} }
resp.ResponseOk(c, response) resp.ResponseOk(c, response)
return myContext, nil return myContext, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment