Commit 09d28573 authored by hujiebin's avatar hujiebin

补上家族之星三个榜一

parent fa68f2de
...@@ -653,7 +653,7 @@ func GetAllPowerDiamond(period string) (map[string]string, error) { ...@@ -653,7 +653,7 @@ func GetAllPowerDiamond(period string) (map[string]string, error) {
type GroupPowerInfo struct { type GroupPowerInfo struct {
Info *GroupPower `json:"info"` Info *GroupPower `json:"info"`
Members []*GroupPowerUser `json:"members"` Members []*GroupPowerUser `json:"members"`
Stars []*GroupPowerStart `json:"stars"` Stars []*GroupPowerStar `json:"stars,omitempty"`
} }
type GroupPower struct { type GroupPower struct {
...@@ -676,8 +676,8 @@ type GroupPowerUser struct { ...@@ -676,8 +676,8 @@ type GroupPowerUser struct {
Role groupPower_e.GroupPowerUserRole `json:"role"` Role groupPower_e.GroupPowerUserRole `json:"role"`
} }
type GroupPowerStart struct { type GroupPowerStar struct {
User *user_m.UserTiny `json:"user"` User user_cv.CvUserTiny `json:"user"`
RankingType groupPower_e.GroupPowerRankType `json:"rankingType"` RankingType groupPower_e.GroupPowerRankType `json:"rankingType"`
} }
......
...@@ -66,3 +66,24 @@ func GetGroupPowerMonthStarRank(model *domain.Model, groupPowerId mysql.ID, _typ ...@@ -66,3 +66,24 @@ func GetGroupPowerMonthStarRank(model *domain.Model, groupPowerId mysql.ID, _typ
} }
return res, nil return res, nil
} }
// 获取家族之星三个排行榜的各自第一名
func GetGroupPowerMonthStartTop1(model *domain.Model, groupPowerId mysql.ID) ([]*GroupPowerMonthStar, error) {
var res []*GroupPowerMonthStar
r1, err := GetGroupPowerMonthStarRank(model, groupPowerId, groupPower_e.GroupPowerStarTypeFamous, 0, 1)
if err != nil {
return res, err
}
r2, err := GetGroupPowerMonthStarRank(model, groupPowerId, groupPower_e.GroupPowerStarTypeActive, 0, 1)
if err != nil {
return res, err
}
r3, err := GetGroupPowerMonthStarRank(model, groupPowerId, groupPower_e.GroupPowerStarTypeCharm, 0, 1)
if err != nil {
return res, err
}
res = append(res, r1...)
res = append(res, r2...)
res = append(res, r3...)
return res, nil
}
...@@ -748,7 +748,29 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -748,7 +748,29 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
Grade: gpInfo.Grade, Exp: gpInfo.Exp, NextExp: gpInfo.NextExp, GradeName: gpInfo.GradeName, GradeMedal: gpInfo.GradeMedal, Grade: gpInfo.Grade, Exp: gpInfo.Exp, NextExp: gpInfo.NextExp, GradeName: gpInfo.GradeName, GradeMedal: gpInfo.GradeMedal,
MemberNum: mysql.Num(total), MemberMax: mysql.Num(group_power_cv.GroupPowerGradePrivilegeNum[groupPowerGrade[gp.ID].Grade][0].Num), MemberNum: mysql.Num(total), MemberMax: mysql.Num(group_power_cv.GroupPowerGradePrivilegeNum[groupPowerGrade[gp.ID].Grade][0].Num),
} }
res := group_power_cv.GroupPowerInfo{Info: info, Members: resMembers} // 补上家族之星三个榜一
stars, err := groupPower_m.GetGroupPowerMonthStartTop1(model, gp.ID)
if err != nil {
return myContext, myerr.WrapErr(err)
}
var cvStar []*group_power_cv.GroupPowerStar
if len(stars) > 0 {
var userIds []uint64
for _, star := range stars {
userIds = append(userIds, star.UserId)
}
userM, err := user_cv.GetUserTinyMap(userIds)
if err != nil {
return myContext, err
}
for _, star := range stars {
cvStar = append(cvStar, &group_power_cv.GroupPowerStar{
User: userM[star.UserId],
RankingType: groupPower_e.GroupPowerRankType(star.Type),
})
}
}
res := group_power_cv.GroupPowerInfo{Info: info, Members: resMembers, Stars: cvStar}
resp.ResponseOk(c, res) resp.ResponseOk(c, res)
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