test
This commit is contained in:
parent
c2a8f9b022
commit
d96c8efc54
23
obj.go
23
obj.go
@ -158,7 +158,8 @@ func addObjCastle(logo string, name string) (int64, error) {
|
||||
}
|
||||
|
||||
func getObjCastleID(s string) int64 {
|
||||
c, _ := cacheObjCastle.Load(s)
|
||||
var c *ChatWarsCastle
|
||||
c, _ = cacheObjCastle.Load(s)
|
||||
return c.ObjID64
|
||||
}
|
||||
|
||||
@ -243,16 +244,17 @@ func addObjGuild(tag string, name string) (int64, error) {
|
||||
}
|
||||
|
||||
func getObjGuildID(s string) int64 {
|
||||
var g *ChatWarsGuild
|
||||
if g, ok := cacheObjGuild.Load(s); ok {
|
||||
return g.ObjID64
|
||||
} else {
|
||||
objID64, err := addObjGuild(s, ``)
|
||||
logOnError(err, "getObjGuildID")
|
||||
g := new(ChatWarsGuild)
|
||||
g.ObjID64 = objID64
|
||||
g.Tag = s
|
||||
g.Name = ``
|
||||
cacheObjGuild.Store(s, *g)
|
||||
n := new(ChatWarsGuild)
|
||||
n.ObjID64 = objID64
|
||||
n.Tag = s
|
||||
n.Name = ``
|
||||
cacheObjGuild.Store(s, *n)
|
||||
return objID64
|
||||
}
|
||||
}
|
||||
@ -337,15 +339,16 @@ func addObjUser(name string) (int64, error) {
|
||||
}
|
||||
|
||||
func getObjUserID(s string) int64 {
|
||||
var u *ChatWarsUser
|
||||
if u, ok := cacheObjUser.Load(s); ok {
|
||||
return u.ObjID64
|
||||
} else {
|
||||
objID64, err := addObjUser(s)
|
||||
logOnError(err, "getObjUserID")
|
||||
u := new(ChatWarsUser)
|
||||
u.ObjID64 = objID64
|
||||
u.Name = s
|
||||
cacheObjUser.Store(s, *u)
|
||||
n := new(ChatWarsUser)
|
||||
n.ObjID64 = objID64
|
||||
n.Name = s
|
||||
cacheObjUser.Store(s, *n)
|
||||
return objID64
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user