From 50c50a4490a3d2f5e07df2738e8ae576eeb389f3 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 2 Aug 2022 09:46:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=83=8C=E5=8C=85=E6=A0=BC?= =?UTF-8?q?=E5=AD=90=E4=BD=BF=E7=94=A8=20=E5=AE=8C=E6=AF=95=20=E6=B8=85?= =?UTF-8?q?=E7=90=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/items/modelitems.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index bce48794e..752cc353a 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -57,14 +57,6 @@ func (this *ModelItemsComp) AddUserPack(uId string, itmes ...*pb.DB_UserItemData return } -//更新用户的背包信息 -func (this *ModelItemsComp) DelUserPack(uId string, ids ...string) (err error) { - if err = this.DelListlds(uId, ids...); err != nil { - this.module.Errorf("err:%v", err) - } - return -} - //更新用户的背包信息 func (this *ModelItemsComp) UpdateUserPack(uid string, itmes ...*pb.DB_UserItemData) (err error) { for _, v := range itmes { @@ -239,7 +231,12 @@ func (this *ModelItemsComp) AddItemToUserPackByGrid(uId string, gridid string, a return } else { itme.Amount = uint32(num) - this.UpdateUserPack(uId, itme) + if itme.Amount > 0 { + this.UpdateUserPack(uId, itme) + } else { + this.DeleteUserPack(uId, itme) + } + change = append(change, itme) } }