From 33c8712c7225fff203d733ac81bb7f63fae41210 Mon Sep 17 00:00:00 2001 From: ayflying Date: Wed, 3 Sep 2025 13:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=9B=B4=E6=96=B0=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/gameAct/gameAct.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/logic/gameAct/gameAct.go b/internal/logic/gameAct/gameAct.go index 56ced6d..de3ae1d 100644 --- a/internal/logic/gameAct/gameAct.go +++ b/internal/logic/gameAct/gameAct.go @@ -471,9 +471,9 @@ func (s *sGameAct) Cache2Sql(ctx context.Context, add, update []*entity.GameAct) // Cache2AddChan 批量添加数据库 func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan *entity.GameAct) { //批量写入数据库计数 - var addCount int + var addCount int64 //批量更新数据库计数 - var updateCount int + var updateCount int64 //通道关闭标志 addClosed := false updateClosed := false @@ -498,11 +498,12 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * g.Log().Error(ctx, err2) continue } - if row, _ := addRes.RowsAffected(); row == 0 { - g.Log().Error(ctx, "本次新增为0,新增数据失败: %v", v) - continue - } - addCount++ + //if row, _ := addRes.RowsAffected(); row == 0 { + // g.Log().Error(ctx, "本次新增为0,新增数据失败: %v", v) + // continue + //} + row, _ := addRes.RowsAffected() + addCount += row //删除缓存 s.DelCacheKey(ctx, v.ActId, v.Uid) @@ -521,7 +522,7 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * continue } if row, _ := updateRes.RowsAffected(); row == 0 { - g.Log().Error(ctx, "本次更新为0,更新数据失败: %v", v) + //g.Log().Error(ctx, "本次更新为0,更新数据失败: %v", v) continue } //删除缓存