39 lines
911 B
Go
39 lines
911 B
Go
package player
|
|
|
|
import (
|
|
"f5"
|
|
"fmt"
|
|
//"github.com/golang/protobuf/proto"
|
|
"main/constant"
|
|
//"main/ss"
|
|
//"q5"
|
|
)
|
|
|
|
func (pm *PlayerMgr) LoadPlayer(accountId string, cb func(err error, p *Player)) {
|
|
sql := fmt.Sprintf("SELECT accountid, blobdata FROM account_data WHERE accountid='%s'", accountId)
|
|
f5.GetGoStyleDb().SyncSelectCustomQuery(
|
|
constant.MAIL_DB,
|
|
sql,
|
|
func(err error, rows *f5.DataSet) {
|
|
if err != nil {
|
|
f5.GetSysLog().Info("loadPlayer err:%v \n", err)
|
|
cb(fmt.Errorf("loadPlayer err"), nil)
|
|
return
|
|
}
|
|
/*
|
|
if rows.Next() {
|
|
aId := q5.ToString(*rows.GetByName("accountid"))
|
|
data := q5.ToString(*rows.GetByName("blobdata"))
|
|
|
|
profile := NewPlayer(aId)
|
|
accountPB := &ss.MFAccountData{}
|
|
err = proto.Unmarshal([]byte(data), accountPB)
|
|
profile.Deserialize(accountPB)
|
|
cb(nil, profile)
|
|
} else {
|
|
cb(fmt.Errorf("player nil"), nil)
|
|
}*/
|
|
},
|
|
)
|
|
}
|