package recook import ( "net/url" "strconv" ) const ( actionUserinfo = "/live/user/userinfo" ) type user struct { } var User *user func init() { User = &user{} } type Userinfo struct { UserId uint `json:"userId"` } func (u *user) GetUserId(id uint, token string) uint { userinfo := &Userinfo{} if err := RecookClient.Exec(actionUserinfo, url.Values{}, userinfo, map[string]string{ "X-Recook-ID": strconv.FormatUint(uint64(id), 10), "X-Recook-Token": token, }); err != nil { return 0 } return userinfo.UserId }