一个很坑的bug
This commit is contained in:
parent
d317cf88f9
commit
b05f9e2152
@ -287,11 +287,9 @@ func (this *ModelUser) computeLevel(change *pb.UserResChangedPush) (lvchange boo
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModelUser) changelv(session comm.IUserSession, lv int32, exp int64, name string, rewards []*cfg.Gameatn) {
|
||||
func (this *ModelUser) changelv(session comm.IUserSession, lv int32, exp int64, name string) {
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
var (
|
||||
atno []*pb.UserAtno
|
||||
errdata *pb.ErrorData
|
||||
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
|
||||
)
|
||||
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
|
||||
@ -302,17 +300,11 @@ func (this *ModelUser) changelv(session comm.IUserSession, lv int32, exp int64,
|
||||
log.Field{Key: "lv", Value: lv},
|
||||
)
|
||||
}
|
||||
if errdata, atno = this.module.DispenseAtno(session, rewards, true); errdata != nil {
|
||||
this.module.Error("资源发放",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "rewards", Value: rewards},
|
||||
)
|
||||
}
|
||||
|
||||
this.module.chat.SendSysChatToUser(session, comm.ChatSystem12, lv, 0, name)
|
||||
this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypePlatlv, lv)
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype20, lv))
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
this.module.WriteUserLog(session.GetUserId(), fmt.Sprintf(" lv :%d, exp %d, name %s", lv, exp, name), comm.GMResAddType, "changelv", atno)
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -574,7 +574,18 @@ func (this *User) change(session comm.IUserSession, attrs map[string]int32) (atn
|
||||
}
|
||||
change.Exp += int64(add)
|
||||
if lvchange, loseexp, rewards = this.modelUser.computeLevel(change); lvchange {
|
||||
this.modelUser.changelv(session, change.Lv, change.Exp, user.Name, rewards)
|
||||
this.modelUser.changelv(session, change.Lv, change.Exp, user.Name)
|
||||
defer func() {
|
||||
go func() {
|
||||
if err, res := this.DispenseAtno(session, rewards, true); err == nil {
|
||||
this.WriteUserLog(session.GetUserId(), fmt.Sprintf("userlv change"), comm.GMResAddType, "changelv", res)
|
||||
} else {
|
||||
this.Errorf("err:%v", err)
|
||||
}
|
||||
|
||||
}()
|
||||
}()
|
||||
|
||||
}
|
||||
temp.N = temp.N - loseexp
|
||||
case comm.VipExp:
|
||||
|
Loading…
Reference in New Issue
Block a user