From cfc5d4f3969b51b55ccf8476f20cfed0c1f67c61 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 1 Dec 2022 14:39:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B6=88=E8=80=97=E7=9A=84=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=95=B0=E6=AD=A3=E6=95=B0=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/modulebase.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/modulebase.go b/modules/modulebase.go index 2af64780c..4e2a645f7 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -284,14 +284,14 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn for k, v := range attrs { if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正 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 } } for k, v := range items { if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v { 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 } } @@ -301,9 +301,9 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn if code != pb.ErrorCode_Success { return } - this.Debugf("消耗玩家资源: %v", attrs) + this.Debug("消耗玩家资源", log.Fields{"uid": session.GetUserId(), "attrs": attrs}) 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 { @@ -311,7 +311,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn if code != pb.ErrorCode_Success { return } - this.Debugf("消耗道具资源: %v", items) + this.Debug("消耗道具资源", log.Fields{"uid": session.GetUserId(), "items": items}) } return From c94006ca72d287b5b9c235a76afada8607098e25 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 1 Dec 2022 14:39:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=82=E8=80=83=E6=8B=B7=E8=B4=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/rtask/updateHandle.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/rtask/updateHandle.go b/modules/rtask/updateHandle.go index 52b91c527..96c9c46dd 100644 --- a/modules/rtask/updateHandle.go +++ b/modules/rtask/updateHandle.go @@ -88,10 +88,11 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData } //查找任务数据 if v, ok := record.Vals[cfg.Id]; ok { - newCount := make([]int32, len(vals)) + newArr := make([]int32, len(vals)) + newArr = vals srcCount := v.Data[0] - newCount[0] = srcCount + vals[0] - v.Data = toMap(newCount...) + newArr[0] = srcCount + vals[0] + v.Data = toMap(newArr...) v.Timestamp = configure.Now().Unix() update := map[string]interface{}{