mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-07-04 15:32:19 +02:00
Compare commits
2 Commits
6cb179b553
...
7dbcb18ebf
Author | SHA1 | Date | |
---|---|---|---|
|
7dbcb18ebf | ||
|
0ead2da2da |
@ -40,7 +40,6 @@ func Init(mux *http.ServeMux) {
|
|||||||
mux.HandleFunc("GET /account/logout", handleAccountLogout)
|
mux.HandleFunc("GET /account/logout", handleAccountLogout)
|
||||||
|
|
||||||
// game
|
// game
|
||||||
mux.HandleFunc("GET /game/playercount", handleGamePlayerCount)
|
|
||||||
mux.HandleFunc("GET /game/titlestats", handleGameTitleStats)
|
mux.HandleFunc("GET /game/titlestats", handleGameTitleStats)
|
||||||
mux.HandleFunc("GET /game/classicsessioncount", handleGameClassicSessionCount)
|
mux.HandleFunc("GET /game/classicsessioncount", handleGameClassicSessionCount)
|
||||||
|
|
||||||
|
@ -144,10 +144,6 @@ func handleAccountLogout(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// game
|
// game
|
||||||
|
|
||||||
func handleGamePlayerCount(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.Write([]byte(strconv.Itoa(playerCount)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleGameTitleStats(w http.ResponseWriter, r *http.Request) {
|
func handleGameTitleStats(w http.ResponseWriter, r *http.Request) {
|
||||||
err := json.NewEncoder(w).Encode(defs.TitleStats{
|
err := json.NewEncoder(w).Encode(defs.TitleStats{
|
||||||
PlayerCount: playerCount,
|
PlayerCount: playerCount,
|
||||||
|
@ -65,7 +65,7 @@ func StoreSystemSaveData(uuid []byte, data defs.SystemSaveData) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = handle.Exec("REPLACE INTO systemSaveData (uuid, data, timestamp) VALUES (?, ?, UTC_TIMESTAMP())", uuid, buf.Bytes())
|
_, err = handle.Exec("INSERT INTO systemSaveData (uuid, data, timestamp) VALUES (?, ?, UTC_TIMESTAMP()) ON DUPLICATE KEY UPDATE data = ?, timestamp = UTC_TIMESTAMP()", uuid, buf.Bytes(), buf.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ func StoreSessionSaveData(uuid []byte, data defs.SessionSaveData, slot int) erro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = handle.Exec("REPLACE INTO sessionSaveData (uuid, slot, data, timestamp) VALUES (?, ?, ?, UTC_TIMESTAMP())", uuid, slot, buf.Bytes())
|
_, err = handle.Exec("INSERT INTO sessionSaveData (uuid, slot, data, timestamp) VALUES (?, ?, ?, UTC_TIMESTAMP()) ON DUPLICATE KEY UPDATE data = ?, timestamp = UTC_TIMESTAMP()", uuid, slot, buf.Bytes(), buf.Bytes())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user