From 99388bf759f7c56c84efe010876fe3003a455625 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 26 Jul 2022 19:53:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0mgo=20=E6=97=A5=E5=BF=97=20?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=20=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/items/modelitems.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index bd34c0153..a8e008697 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -1,6 +1,7 @@ package items import ( + "errors" "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/modules" @@ -66,9 +67,14 @@ func (this *ModelItemsComp) DelUserPack(uId string, ids ...string) (err error) { } //更新用户的背包信息 -func (this *ModelItemsComp) UpdateUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { +func (this *ModelItemsComp) UpdateUserPack(uid string, itmes ...*pb.DB_UserItemData) (err error) { + if len(uid) == 0 { + err = errors.New("UpdateUserPack uid is nil") + this.module.Panicf("err:%v", err) + return + } for _, v := range itmes { - this.ChangeList(uId, v.GridId, map[string]interface{}{ + this.ChangeList(uid, v.GridId, map[string]interface{}{ "amount": v.Amount, }) }