mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-02 02:57:15 +08:00
chore: Remove unused log statements and remove unused UpdateAccountStats
This commit is contained in:
parent
ce54f57f53
commit
c7191bb343
13
cache/account.go
vendored
13
cache/account.go
vendored
@ -19,7 +19,6 @@ package cache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -49,19 +48,7 @@ func UpdateAccountLastActivity(uuid []byte) bool {
|
|||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
|
||||||
func UpdateAccountStats(uuid []byte, battles, classicSessionsPlayed int) bool {
|
|
||||||
key := fmt.Sprintf("account:%s", uuid)
|
|
||||||
err := rdb.HIncrBy(key, "battles", int64(battles)).Err()
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
err = rdb.HIncrBy(key, "classicSessionsPlayed", int64(classicSessionsPlayed)).Err()
|
|
||||||
return err == nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func FetchTrainerIds(uuid []byte) (int, int, bool) {
|
func FetchTrainerIds(uuid []byte) (int, int, bool) {
|
||||||
log.Println("FetchTrainerIds", uuid)
|
|
||||||
key := fmt.Sprintf("account:%s", uuid)
|
key := fmt.Sprintf("account:%s", uuid)
|
||||||
vals, err := rdb.HMGet(key, "trainerId", "secretId").Result()
|
vals, err := rdb.HMGet(key, "trainerId", "secretId").Result()
|
||||||
if err == nil && len(vals) == 2 && vals[0] != nil && vals[1] != nil {
|
if err == nil && len(vals) == 2 && vals[0] != nil && vals[1] != nil {
|
||||||
|
@ -266,9 +266,6 @@ func UpdateAccountStats(uuid []byte, stats defs.GameStats, voucherCounts map[str
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Update cache battle count and classic session count
|
|
||||||
cache.UpdateAccountStats(uuid, int(statValues[1].(float64)), int(statValues[2].(float64)))
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,6 @@ func FetchPlayerCount() (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FetchBattleCount() (int, error) {
|
func FetchBattleCount() (int, error) {
|
||||||
// if cachedBattleCount, ok := cache.FetchBattleCount(); ok {
|
|
||||||
// return cachedBattleCount, nil
|
|
||||||
// }
|
|
||||||
|
|
||||||
var battleCount int
|
var battleCount int
|
||||||
err := handle.QueryRow("SELECT COALESCE(SUM(s.battles), 0) FROM accountStats s JOIN accounts a ON a.uuid = s.uuid WHERE a.banned = 0").Scan(&battleCount)
|
err := handle.QueryRow("SELECT COALESCE(SUM(s.battles), 0) FROM accountStats s JOIN accounts a ON a.uuid = s.uuid WHERE a.banned = 0").Scan(&battleCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user