处理道具背包接口bug

This commit is contained in:
liwei1dao 2022-07-04 13:55:49 +08:00
parent 19f9759e63
commit 0ccbf30291
2 changed files with 9 additions and 4 deletions

View File

@ -66,7 +66,6 @@ func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, usetyp
v interface{}
table *cfg.Game_item
item *cfg.Game_itemData
id int32
ok bool
err error
)
@ -76,12 +75,12 @@ func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, usetyp
} else {
table = v.(*cfg.Game_item)
for _, v := range itmes {
if item, ok = table.GetDataMap()[id]; ok {
if item, ok = table.GetDataMap()[v.ItemId]; ok {
if item.Usetype == usetype {
result = append(result, v)
}
} else {
log.Errorf("no found itemConfigure:%d", id)
log.Errorf("no found itemConfigure:%d", v.ItemId)
}
}
}

View File

@ -8,7 +8,10 @@ import (
"go_dreamfactory/lego/base/rpcx"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules/equipment"
"go_dreamfactory/modules/hero"
"go_dreamfactory/modules/items"
"go_dreamfactory/modules/user"
"go_dreamfactory/pb"
"go_dreamfactory/services"
"go_dreamfactory/sys/cache"
@ -68,6 +71,9 @@ func TestMain(m *testing.M) {
go func() {
lego.Run(service, //运行模块
module,
hero.NewModule(),
user.NewModule(),
equipment.NewModule(),
)
}()
time.Sleep(time.Second * 3)
@ -86,6 +92,6 @@ func Test_Modules_AddItems(t *testing.T) {
Module: "Test",
FuncName: "Test_Modules_AddItems",
Describe: "测试模块接口",
}, "0_62b16dda909b2f8faeff788d", map[int32]int32{10001: -1000})
}, "0_62c259916d8cf3e4e06311a8", map[int32]int32{10001: 1000})
log.Debugf("Test_Modules_AddItems:%v code:%v", code)
}