diff --git a/modules/user/module.go b/modules/user/module.go index 114507488..f69aa7120 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -1028,7 +1028,7 @@ func (this *User) BingoSetUserLv(session comm.IUserSession, lv int32) error { // } // 玩家体力恢复 -func (this *User) recoverUserPs(user *pb.DBUser) (total int32, nexttime int64) { +func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, nexttime int64) { var ( yu int32 add int32 @@ -1049,6 +1049,7 @@ func (this *User) recoverUserPs(user *pb.DBUser) (total int32, nexttime int64) { cur := time.Now().Unix() if user.LastRecoverPsSec == 0 { user.LastRecoverPsSec = cur + change = true return } else { diff := cur - user.LastRecoverPsSec @@ -1065,6 +1066,7 @@ func (this *User) recoverUserPs(user *pb.DBUser) (total int32, nexttime int64) { } user.LastRecoverPsSec = cur user.Ps += add + change = true } nexttime = user.LastRecoverPsSec + int64(ggd.PsRecovery) return @@ -1257,7 +1259,7 @@ func (this *User) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (red this.Errorln(err) return } - total, t := this.recoverUserPs(user) + change, total, t := this.recoverUserPs(user) reddot[comm.Reddot30100] = &pb.ReddotItem{ Rid: int32(comm.Reddot30100), Activated: true, @@ -1265,6 +1267,12 @@ func (this *User) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (red Progress: user.Ps, Total: total, } + if change { + this.modelUser.Change(session.GetUserId(), map[string]interface{}{ + "ps": user.Ps, + "lastRecoverPsSec": user.LastRecoverPsSec, + }) + } break }