This commit is contained in:
meixiongfeng 2023-09-12 15:32:10 +08:00
parent 001c93b3a0
commit 0d8d2e2775

View File

@ -980,11 +980,17 @@ func (this *User) RecoverUserPsStart(session comm.IUserSession) (recoverTime int
} else { } else {
add = yu add = yu
changed = total changed = total
if u.LastRecoverPsSec != 0 {
u.LastRecoverPsSec += int64(yu * re)
if u.LastRecoverPsSec > time.Now().Unix() {
u.LastRecoverPsSec = time.Now().Unix()
}
}
} }
} else { } else {
add = 0 add = 0
} }
u.LastRecoverPsSec = time.Now().Unix() //u.LastRecoverPsSec = time.Now().Unix()
update := map[string]interface{}{} update := map[string]interface{}{}
if add > 0 { if add > 0 {
u.Ps += add u.Ps += add
@ -993,7 +999,6 @@ func (this *User) RecoverUserPsStart(session comm.IUserSession) (recoverTime int
} }
if err := this.modelUser.Change(u.Uid, update); err == nil { if err := this.modelUser.Change(u.Uid, update); err == nil {
if changed > 0 { if changed > 0 {
this.reddot.PushReddot(session, &pb.ReddotItem{ this.reddot.PushReddot(session, &pb.ReddotItem{
Rid: int32(comm.Reddot30100), Rid: int32(comm.Reddot30100),
Nextchanagetime: u.LastRecoverPsSec + int64(re), Nextchanagetime: u.LastRecoverPsSec + int64(re),
@ -1001,7 +1006,6 @@ func (this *User) RecoverUserPsStart(session comm.IUserSession) (recoverTime int
session.Push() session.Push()
} }
} }
} }
recoverTime = u.LastRecoverPsSec + int64(re) recoverTime = u.LastRecoverPsSec + int64(re)
return recoverTime return recoverTime