Commit 9f484583 authored by hujiebin's avatar hujiebin

Merge branch 'feature/user-svip-vip-level' into 'master'

Feature/user svip vip level

See merge request !26
parents 3b64f2b4 2b3539ad
......@@ -77,6 +77,7 @@ func InitRouter() *gin.Engine {
innerUser.GET("/cpRelations", wrapper(user_r.MGetUserCpRelation))
innerUser.GET("/cp/pair", wrapper(user_r.GetUserCpPair))
innerUser.GET("/cp/entryEffect", wrapper(user_r.GetUserCpEntryEffect)) // 获取cp进场特效信息,高频接口,需要额外处理
innerUser.GET("/svipNobleLevel", wrapper(user_r.MGetUserSvipNobleLevel)) // 获取用户svip/noble/level等信息
}
// 道具相关
innerProp := inner.Group("/prop")
......
......@@ -4,9 +4,11 @@ import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/rpc"
"github.com/gin-gonic/gin"
"hilo-user/_const/enum/cp_e"
"hilo-user/cv/cp_cv"
"hilo-user/cv/noble_cv"
"hilo-user/cv/user_cv"
"hilo-user/domain/cache/user_c"
"hilo-user/domain/model/bag_m"
......@@ -56,6 +58,62 @@ func MGetUserLevels(c *gin.Context) (*mycontext.MyContext, error) {
return myCtx, nil
}
type MGetUserSvipVipLevelReq struct {
Ids []mysql.ID `form:"ids" binding:"required"`
}
// @Tags 用户-内部
// @Summary 批量获取用户等级
// @Param ids query string true "用户id,如:ids=1&ids=2&ids=3"
// @Success 200 {object} user_cv.CvUserDetail
// @Router /inner/user/svipNobleLevel [get]
func MGetUserSvipNobleLevel(c *gin.Context) (*mycontext.MyContext, error) {
myCtx := mycontext.CreateMyContext(c.Keys)
var model = domain.CreateModelContext(myCtx)
var req MGetUserLevelReq
if err := c.ShouldBindQuery(&req); err != nil {
return myCtx, err
}
wealthGrade, err := user_m.MGetWealthGrade(model, req.Ids)
if err != nil {
return myCtx, err
}
charmGrade, err := user_m.MGetCharmGrade(model, req.Ids)
activeGrade, err := user_m.MGetActiveGrade(model, req.Ids)
nobleLevel, err := noble_m.BatchGetNobleLevel(model, req.Ids)
svip, err := rpc.MGetUserSvip(model, req.Ids)
users, err := user_m.GetUserMapByIds(model, req.Ids)
response := make(map[uint64]user_cv.CvUserDetail)
for _, userId := range req.Ids {
user := users[userId]
response[userId] = user_cv.CvUserDetail{
CvUserBase: user_cv.CvUserBase{
Id: &user.ID,
Avatar: &user.Avatar,
ExternalId: &user.ExternalId,
Nick: &user.Nick,
Sex: &user.Sex,
Country: &user.Country,
CountryIcon: &user.CountryIcon,
Code: &user.Code,
Birthday: &user.Birthday,
Svip: rpc.CvSvip{
SvipLevel: svip[userId].SvipLevel,
},
Noble: noble_cv.CvNoble{
Level: nobleLevel[userId],
},
},
WealthUserGrade: wealthGrade[userId],
CharmUserGrade: charmGrade[userId],
ActivityUserGrade: activeGrade[userId],
}
}
resp.ResponseOk(c, response)
return myCtx, nil
}
type GetUserBagReq struct {
BagId mysql.ID `form:"bagId" binding:"required"`
}
......
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