|
@@ -429,7 +429,7 @@ func (p *actorPlayer) refreshRoll() {
|
|
|
}
|
|
|
|
|
|
func (p *actorPlayer) playerSessionClose() {
|
|
|
- deadline := time.Now().Add(-p.exitTime).Unix()
|
|
|
+ deadline := mhayaTime.Now().Add(-p.exitTime).Unix()
|
|
|
if p.LastAt() < deadline {
|
|
|
p.sessionClose()
|
|
|
}
|
|
@@ -443,7 +443,6 @@ func (p *actorPlayer) sessionClose() {
|
|
|
//p.SetRewardToDB()
|
|
|
p.setRedisAll()
|
|
|
//logoutEvent := event.NewPlayerLogout(p.ActorID(), p.playerId, p.targetPath)
|
|
|
- // todo 暂时屏蔽
|
|
|
p.isOnline = false
|
|
|
p.Exit()
|
|
|
//models.SetServerRecord(p.App().NodeId(), online.Count())
|
|
@@ -469,12 +468,11 @@ func (p *actorPlayer) Init(req *token.Token) bool {
|
|
|
}
|
|
|
p.Account = &account
|
|
|
} else {
|
|
|
- //dbErr := mdb.MDB.Collection(constant.CNameAccount).FindOne(context.Background(), bson.M{"openId": req.OpenID}).Decode(&account).Error()
|
|
|
- mdb.MDB.Collection(constant.CNameAccount).FindOne(context.Background(), bson.M{"openId": req.OpenID}).Decode(&account)
|
|
|
- //if dbErr != "" {
|
|
|
- // clog.Debugf("[actorPlayer] read account data by db error: %v", err)
|
|
|
- // return false
|
|
|
- //}
|
|
|
+ err = mdb.MDB.Collection(constant.CNameAccount).FindOne(ctx, bson.M{"openId": req.OpenID}).Decode(&account)
|
|
|
+ if err != nil {
|
|
|
+ clog.Debugf("[actorPlayer] read account data by db error: %v", err)
|
|
|
+ return false
|
|
|
+ }
|
|
|
p.Account = &account
|
|
|
}
|
|
|
|
|
@@ -492,8 +490,8 @@ func (p *actorPlayer) Init(req *token.Token) bool {
|
|
|
}
|
|
|
p.Player = &player
|
|
|
} else {
|
|
|
- dbErr := mdb.MDB.Collection(constant.CNamePlayer).FindOne(context.Background(), bson.M{"userName": req.PlayerID}).Decode(&player).Error()
|
|
|
- if dbErr != "" {
|
|
|
+ err = mdb.MDB.Collection(constant.CNamePlayer).FindOne(ctx, bson.M{"userName": req.PlayerID}).Decode(&player)
|
|
|
+ if err != nil {
|
|
|
clog.Debugf("[actorPlayer] read player data by db error: %v", err)
|
|
|
return false
|
|
|
}
|