2024-10-28 02:58:26 +08:00

68 lines
2.8 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package steamplaying
type SteamUser struct {
ID int64 `json:"id" db:"id"`
QQID int64 `json:"qqid" db:"qqid"`
SteamID string `json:"steamid" db:"steamid"`
}
type SteamUserForGroup struct {
ID int64 `json:"id" db:"id"`
GroupID string `json:"group_id" db:"group_id"`
SteamID string `json:"steamid" db:"steamid"`
}
type PlayerSummary struct {
SteamID string `json:"steamid"` // 64位SteamID
PersonaName string `json:"personaname"` // 显示名称
ProfileURL string `json:"profileurl"` // Steam社区个人资料链接
Avatar string `json:"avatar"` // 32x32px头像URL
AvatarMedium string `json:"avatarmedium"` // 64x64px头像URL
AvatarFull string `json:"avatarfull"` // 184x184px头像URL
PersonaState int `json:"personastate"` // 用户状态
CommunityVisibilityState int `json:"communityvisibilitystate"` // 社区可见性状态
ProfileState int `json:"profilestate,omitempty"` // 用户是否配置了社区个人资料
LastLogOff int64 `json:"lastlogoff,omitempty"` // 上次在线时间Unix时间戳
CommentPermission int `json:"commentpermission,omitempty"` // 是否允许评论
// 私有数据,可能根据用户隐私设置而不可见
RealName string `json:"realname,omitempty"` // 真实姓名
PrimaryClanID string `json:"primaryclanid,omitempty"` // 用户的主要组ID
TimeCreated int64 `json:"timecreated,omitempty"` // 账号创建时间
GameID string `json:"gameid,omitempty"` // 当前游戏ID
GameServerIP string `json:"gameserverip,omitempty"` // 游戏服务器IP
GameExtraInfo string `json:"gameextrainfo,omitempty"` // 当前游戏名称
CityID int `json:"cityid,omitempty"` // 已弃用
LocCountryCode string `json:"loccountrycode,omitempty"` // 用户的国家代码
LocStateCode string `json:"locstatecode,omitempty"` // 用户的州/省代码
LocCityID int `json:"loccityid,omitempty"` // 用户的城市ID
}
// 封装返回的数据结构,用于处理 API 的整体返回
type GetPlayerSummariesResponse struct {
Response struct {
Players []PlayerSummary `json:"players"`
} `json:"response"`
}
func (s PlayerSummary) ToGameStatus() string {
UserName := s.PersonaName
GameName := s.GameExtraInfo
if GameName == "" {
return ""
}
if UserName == "" {
UserName = s.RealName
}
if UserName == "" {
UserName = s.SteamID
}
return UserName + "正在玩" + GameName
}
type LastTimeStatus struct {
SteamID string `json:"steamid"`
GameID string `json:"gameid"`
Trigger bool `json:"trigger"`
}