test
This commit is contained in:
parent
12f0048f70
commit
0ac4dda50d
14
obj.go
14
obj.go
@ -7,9 +7,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cacheObjCastle sync.Map
|
cacheObjCastle *sync.Map
|
||||||
cacheObjGuild sync.Map
|
cacheObjGuild *sync.Map
|
||||||
cacheObjUser sync.Map
|
cacheObjUser *sync.Map
|
||||||
)
|
)
|
||||||
|
|
||||||
func getObjTypeId(objId int64) (int64, error) {
|
func getObjTypeId(objId int64) (int64, error) {
|
||||||
@ -158,7 +158,7 @@ func addObjCastle(logo string, name string) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getObjCastleID(s string) int64 {
|
func getObjCastleID(s string) int64 {
|
||||||
v, _ = cacheObjCastle.Load(s)
|
v, _ := cacheObjCastle.Load(s)
|
||||||
c := v.(ChatWarsCastle)
|
c := v.(ChatWarsCastle)
|
||||||
return c.ObjID64
|
return c.ObjID64
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ func loadObjCastle() error {
|
|||||||
name string
|
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;`)
|
castles, err := db.Query(`SELECT oc.obj_id, oc.logo, oc.name FROM obj_castle oc;`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -266,7 +266,7 @@ func loadObjGuild() error {
|
|||||||
name string
|
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;`)
|
guilds, err := db.Query(`SELECT og.obj_id, og.tag, og.name FROM obj_guild og;`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -359,7 +359,7 @@ func loadObjUser() error {
|
|||||||
name string
|
name string
|
||||||
)
|
)
|
||||||
|
|
||||||
cacheObjUser = new(*sync.Map)
|
cacheObjUser = new(sync.Map)
|
||||||
|
|
||||||
users, err := db.Query(`SELECT ou.obj_id, ou.name FROM obj_user ou;`)
|
users, err := db.Query(`SELECT ou.obj_id, ou.name FROM obj_user ou;`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user