mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 23:44:52 +01:00
Use Go's naming recommendations
This commit is contained in:
@@ -31,17 +31,17 @@ type User struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Character struct {
|
type Character struct {
|
||||||
Id uint32 `json:"id"`
|
ID uint32 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
IsFemale bool `json:"isFemale" db:"is_female"`
|
IsFemale bool `json:"isFemale" db:"is_female"`
|
||||||
Weapon uint32 `json:"weapon" db:"weapon_type"`
|
Weapon uint32 `json:"weapon" db:"weapon_type"`
|
||||||
Hr uint32 `json:"hr" db:"hrp"`
|
HR uint32 `json:"hr" db:"hrp"`
|
||||||
Gr uint32 `json:"gr"`
|
GR uint32 `json:"gr"`
|
||||||
LastLogin int64 `json:"lastLogin" db:"last_login"`
|
LastLogin int64 `json:"lastLogin" db:"last_login"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MezFes struct {
|
type MezFes struct {
|
||||||
Id uint32 `json:"id"`
|
ID uint32 `json:"id"`
|
||||||
Start uint32 `json:"start"`
|
Start uint32 `json:"start"`
|
||||||
End uint32 `json:"end"`
|
End uint32 `json:"end"`
|
||||||
SoloTickets uint32 `json:"soloTickets"`
|
SoloTickets uint32 `json:"soloTickets"`
|
||||||
@@ -50,8 +50,8 @@ type MezFes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AuthData struct {
|
type AuthData struct {
|
||||||
CurrentTs uint32 `json:"currentTs"`
|
CurrentTS uint32 `json:"currentTs"`
|
||||||
ExpiryTs uint32 `json:"expiryTs"`
|
ExpiryTS uint32 `json:"expiryTs"`
|
||||||
EntranceCount uint32 `json:"entranceCount"`
|
EntranceCount uint32 `json:"entranceCount"`
|
||||||
Notifications []string `json:"notifications"`
|
Notifications []string `json:"notifications"`
|
||||||
User User `json:"user"`
|
User User `json:"user"`
|
||||||
@@ -61,8 +61,8 @@ type AuthData struct {
|
|||||||
|
|
||||||
func (s *Server) newAuthData(userID uint32, userRights uint32, userToken string, characters []Character) AuthData {
|
func (s *Server) newAuthData(userID uint32, userRights uint32, userToken string, characters []Character) AuthData {
|
||||||
resp := AuthData{
|
resp := AuthData{
|
||||||
CurrentTs: uint32(channelserver.TimeAdjusted().Unix()),
|
CurrentTS: uint32(channelserver.TimeAdjusted().Unix()),
|
||||||
ExpiryTs: uint32(s.getReturnExpiry(userID).Unix()),
|
ExpiryTS: uint32(s.getReturnExpiry(userID).Unix()),
|
||||||
EntranceCount: 1,
|
EntranceCount: 1,
|
||||||
User: User{
|
User: User{
|
||||||
Rights: userRights,
|
Rights: userRights,
|
||||||
@@ -76,7 +76,7 @@ func (s *Server) newAuthData(userID uint32, userRights uint32, userToken string,
|
|||||||
stalls[4] = 2
|
stalls[4] = 2
|
||||||
}
|
}
|
||||||
resp.MezFes = &MezFes{
|
resp.MezFes = &MezFes{
|
||||||
Id: uint32(channelserver.TimeWeekStart().Unix()),
|
ID: uint32(channelserver.TimeWeekStart().Unix()),
|
||||||
Start: uint32(channelserver.TimeWeekStart().Unix()),
|
Start: uint32(channelserver.TimeWeekStart().Unix()),
|
||||||
End: uint32(channelserver.TimeWeekNext().Unix()),
|
End: uint32(channelserver.TimeWeekNext().Unix()),
|
||||||
SoloTickets: s.erupeConfig.GameplayOptions.MezfesSoloTickets,
|
SoloTickets: s.erupeConfig.GameplayOptions.MezfesSoloTickets,
|
||||||
@@ -238,7 +238,7 @@ func (s *Server) DeleteCharacter(w http.ResponseWriter, r *http.Request) {
|
|||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
var reqData struct {
|
var reqData struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
CharId uint32 `json:"charId"`
|
CharID uint32 `json:"charId"`
|
||||||
}
|
}
|
||||||
if err := json.NewDecoder(r.Body).Decode(&reqData); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&reqData); err != nil {
|
||||||
s.logger.Error("JSON decode error", zap.Error(err))
|
s.logger.Error("JSON decode error", zap.Error(err))
|
||||||
@@ -251,8 +251,8 @@ func (s *Server) DeleteCharacter(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := s.deleteCharacter(ctx, userID, reqData.CharId); err != nil {
|
if err := s.deleteCharacter(ctx, userID, reqData.CharID); err != nil {
|
||||||
s.logger.Error("Failed to delete character", zap.Error(err), zap.String("token", reqData.Token), zap.Uint32("charID", reqData.CharId))
|
s.logger.Error("Failed to delete character", zap.Error(err), zap.String("token", reqData.Token), zap.Uint32("charID", reqData.CharID))
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user