Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into meixiongfeng

This commit is contained in:
meixiongfeng 2022-12-01 15:42:05 +08:00
commit 8b3e0b900f
2 changed files with 9 additions and 8 deletions

View File

@ -284,14 +284,14 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
for k, v := range attrs { for k, v := range attrs {
if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正 if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正
code = pb.ErrorCode_ResNoEnough code = pb.ErrorCode_ResNoEnough
this.Errorf("资源不足: A: attr, T: %s, N: %d", k, v) this.Error("资源不足", log.Fields{"uid": session.GetUserId(), "T": k, "N": v})
return return
} }
} }
for k, v := range items { for k, v := range items {
if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v { if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v {
code = pb.ErrorCode_ResNoEnough code = pb.ErrorCode_ResNoEnough
this.Errorf("道具不足: A: item, T:%s, N:%d", k, v) this.Errorf("道具不足", log.Fields{"uid": session.GetUserId(), "T": k, "N": v})
return return
} }
} }
@ -301,9 +301,9 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
return return
} }
this.Debugf("消耗玩家资源: %v", attrs) this.Debug("消耗玩家资源", log.Fields{"uid": session.GetUserId(), "attrs": attrs})
if count, ok := attrs[comm.ResDiamond]; ok { if count, ok := attrs[comm.ResDiamond]; ok {
this.ModuleRtask.SendToRtask(session, comm.Rtype104, count) this.ModuleRtask.SendToRtask(session, comm.Rtype104, -count)
} }
} }
if len(items) > 0 { if len(items) > 0 {
@ -311,7 +311,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
return return
} }
this.Debugf("消耗道具资源: %v", items) this.Debug("消耗道具资源", log.Fields{"uid": session.GetUserId(), "items": items})
} }
return return

View File

@ -88,10 +88,11 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
} }
//查找任务数据 //查找任务数据
if v, ok := record.Vals[cfg.Id]; ok { if v, ok := record.Vals[cfg.Id]; ok {
newCount := make([]int32, len(vals)) newArr := make([]int32, len(vals))
newArr = vals
srcCount := v.Data[0] srcCount := v.Data[0]
newCount[0] = srcCount + vals[0] newArr[0] = srcCount + vals[0]
v.Data = toMap(newCount...) v.Data = toMap(newArr...)
v.Timestamp = configure.Now().Unix() v.Timestamp = configure.Now().Unix()
update := map[string]interface{}{ update := map[string]interface{}{