From d247d3e72344339971c5d0b0d8d54b4000531f1f Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 10 Aug 2023 16:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8E=A8=E9=80=81=E7=A4=BC?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pushgiftbag/module.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/pushgiftbag/module.go b/modules/pushgiftbag/module.go index b5a13ceca..033ea550d 100644 --- a/modules/pushgiftbag/module.go +++ b/modules/pushgiftbag/module.go @@ -167,17 +167,25 @@ func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.C if len(targets) > 0 { item = make([]*pb.DBPushGiftbagItem, 0) - for _, v := range info.Item { - if _, ok = targets[v.Id]; ok { - v.Stime = configure.Now().Unix() - } else { + for _, target := range targets { + ok = false + for _, v := range info.Item { + if target.Id == v.Id { + v.Stime = configure.Now().Unix() + ok = true + break + } + } + if !ok { item = append(item, &pb.DBPushGiftbagItem{ - Id: v.Id, + Id: target.Id, Stime: configure.Now().Unix(), }) } } - info.Item = append(info.Item, item...) + if len(item) > 0 { + info.Item = append(info.Item, item...) + } session.SendMsg(string(this.GetType()), "chanage", &pb.PushGiftbagChanagePush{Item: info.Item}) } }