更新任务数据
This commit is contained in:
parent
ddc356cad0
commit
ba29beb85f
@ -20,11 +20,9 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond
|
||||
}
|
||||
|
||||
record := &pb.DBRtaskRecord{}
|
||||
if err2 := this.Get(uid, record); err2 != nil {
|
||||
if err2 != mongo.ErrNoDocuments {
|
||||
if err := this.Get(uid, record); err != nil {
|
||||
if err != mongo.ErrNoDocuments {
|
||||
return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
} else {
|
||||
err = err2
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,11 +32,15 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond
|
||||
|
||||
if v, ok := record.Vals[cfg.Id]; ok {
|
||||
m := hasUpdateData(paramLen, v, vals...)
|
||||
v.Data = m
|
||||
if len(m) > 0 {
|
||||
update := map[string]interface{}{
|
||||
"vals": m,
|
||||
"vals": v,
|
||||
}
|
||||
err = this.Change(uid, update)
|
||||
if err = this.Change(uid, update); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
data := &pb.RtaskData{
|
||||
@ -51,7 +53,9 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond
|
||||
update := map[string]interface{}{
|
||||
"vals": record.Vals,
|
||||
}
|
||||
err = this.Change(uid, update)
|
||||
if err = this.Change(uid, update); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.listenTask(uid, cfg.Id)
|
||||
|
Loading…
Reference in New Issue
Block a user