Commit 2e556869 authored by hujiebin's avatar hujiebin

批量获取用户svip/noble/level等信息

parent f4a74aed
......@@ -493,3 +493,46 @@ func GetUserCpEntryEffect(model *domain.Model, userId mysql.ID) (*CvCpEntryEffec
}
return nil, nil
}
//用户详细信息
type CvUserDetail struct {
CvUserBase
WealthUserGrade uint32 `json:"wealthUserGrade"` //财富等级
CharmUserGrade uint32 `json:"charmUserGrade"` //魅力等级
ActivityUserGrade uint32 `json:"activityUserGrade"` //活跃等级
CurrentRoom string `json:"currentRoom"` // 当前用户所在房间(产品叫“群组”)
// ...先省略其他字段
}
// 批量获取用户svip/noble/level等信息
func MGetUserSvipNobleLevel(model *domain.Model, userIds []mysql.ID) (map[mysql.ID]CvUserDetail, error) {
type Response struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[mysql.ID]CvUserDetail `json:"data"`
}
var res = make(map[mysql.ID]CvUserDetail)
if len(userIds) <= 0 {
return res, nil
}
var userIdsStr []string
for _, userId := range userIds {
userIdsStr = append(userIdsStr, fmt.Sprintf("%d", userId))
}
_url := fmt.Sprintf("%v://%v/inner/user/svipNobleLevel", defaultUserServerScheme, getUserHost())
resp, err := HttpGet(model, _url, nil, map[string][]string{
"ids": userIdsStr,
})
if err != nil {
model.Log.Errorf("MGetUserLevel fail:%v", err)
return res, err
}
response := new(Response)
if err = json.Unmarshal(resp, response); err != nil {
model.Log.Errorf("MGetUserLevel json fail:%v", err)
return res, err
} else if response != nil && len(response.Data) > 0 {
res = response.Data
}
return res, 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