added gameban as separate thing

This commit is contained in:
2021-10-23 00:14:24 +02:00
parent 2c9dc3870f
commit cd6cd6bf58
13 changed files with 652 additions and 50 deletions

View File

@@ -131,15 +131,17 @@ type StatsResponse struct {
}
type PlayerResponse struct {
SteamID64 uint64 `json:"steamid64,string"`
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
VAC bool `json:"vac"`
VACDate int64 `json:"vac_date,omitempty"`
Tracked bool `json:"tracked"`
VanityURL string `json:"vanity_url,omitempty"`
MatchStats *MatchStats `json:"match_stats,omitempty"`
Matches []*MatchResponse `json:"matches,omitempty"`
SteamID64 uint64 `json:"steamid64,string"`
Name string `json:"name,omitempty"`
Avatar string `json:"avatar,omitempty"`
VAC bool `json:"vac"`
VACDate int64 `json:"vac_date,omitempty"`
GameBan bool `json:"game_ban"`
GameBanDate int64 `json:"game_ban_date"`
Tracked bool `json:"tracked"`
VanityURL string `json:"vanity_url,omitempty"`
MatchStats *MatchStats `json:"match_stats,omitempty"`
Matches []*MatchResponse `json:"matches,omitempty"`
}
type WeaponResponse struct {
@@ -501,6 +503,16 @@ func UpdatePlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string,
return nil, err
}
}
if ban.NumberOfGameBans > 0 {
banDate := time.Now().UTC().AddDate(0, 0, -1*int(ban.DaysSinceLastBan))
lock.Lock()
err := db.Player.UpdateOneID(ban.SteamID).SetGameBanCount(int(ban.NumberOfGameBans)).SetGameBanDate(banDate).Exec(context.Background())
lock.Unlock()
if err != nil {
return nil, err
}
}
}
return nPlayers, nil