This commit is contained in:
shoopea 2019-05-31 11:27:44 +08:00
parent 12f0048f70
commit 0ac4dda50d

14
obj.go
View File

@ -7,9 +7,9 @@ import (
)
var (
cacheObjCastle sync.Map
cacheObjGuild sync.Map
cacheObjUser sync.Map
cacheObjCastle *sync.Map
cacheObjGuild *sync.Map
cacheObjUser *sync.Map
)
func getObjTypeId(objId int64) (int64, error) {
@ -158,7 +158,7 @@ func addObjCastle(logo string, name string) (int64, error) {
}
func getObjCastleID(s string) int64 {
v, _ = cacheObjCastle.Load(s)
v, _ := cacheObjCastle.Load(s)
c := v.(ChatWarsCastle)
return c.ObjID64
}
@ -170,7 +170,7 @@ func loadObjCastle() error {
name string
)
cacheObjCastle = new(*sync.Map)
cacheObjCastle = new(sync.Map)
castles, err := db.Query(`SELECT oc.obj_id, oc.logo, oc.name FROM obj_castle oc;`)
if err != nil {
@ -266,7 +266,7 @@ func loadObjGuild() error {
name string
)
cacheObjGuild = new(*sync.Map)
cacheObjGuild = new(sync.Map)
guilds, err := db.Query(`SELECT og.obj_id, og.tag, og.name FROM obj_guild og;`)
if err != nil {
@ -359,7 +359,7 @@ func loadObjUser() error {
name string
)
cacheObjUser = new(*sync.Map)
cacheObjUser = new(sync.Map)
users, err := db.Query(`SELECT ou.obj_id, ou.name FROM obj_user ou;`)
if err != nil {