From 7698142adf90b35542987ea7cc5e2ad62383a44c Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Thu, 13 Jul 2023 10:02:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=95=86=E5=BA=97=E5=92=8C?= =?UTF-8?q?=E5=85=B1=E9=B8=A3=E6=B0=B4=E6=99=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/passon/api_inroom.go | 2 +- modules/passon/module.go | 1 - modules/practice/modelQiecuo.go | 3 ++- modules/shop/configure.go | 14 ++++++++------ modules/shop/core.go | 5 ----- modules/shop/module.go | 8 ++++---- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/modules/passon/api_inroom.go b/modules/passon/api_inroom.go index fb3e85053..ea9393e6c 100644 --- a/modules/passon/api_inroom.go +++ b/modules/passon/api_inroom.go @@ -77,7 +77,7 @@ func (this *apiComp) InRoom(session comm.IUserSession, req *pb.PassonInRoomReq) return } - if hero.Lv >= passon.Passonlv { + if hero.Lv > passon.Passonlv { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, Title: pb.ErrorCode_ReqParameterError.ToString(), diff --git a/modules/passon/module.go b/modules/passon/module.go index 3e8349ea9..b7dbabefd 100644 --- a/modules/passon/module.go +++ b/modules/passon/module.go @@ -131,5 +131,4 @@ func (this *Passon) HeroUpLv(session comm.IUserSession, heroid string, lv int32) this.Errorln(err) return } - } diff --git a/modules/practice/modelQiecuo.go b/modules/practice/modelQiecuo.go index b2148eb04..9c38b3c3c 100644 --- a/modules/practice/modelQiecuo.go +++ b/modules/practice/modelQiecuo.go @@ -12,7 +12,7 @@ import ( "go.mongodb.org/mongo-driver/x/bsonx" ) -///熊猫武馆数据表 +// /熊猫武馆数据表 type modelQiecuo struct { modules.MCompModel module *Practice @@ -53,6 +53,7 @@ func (this *modelQiecuo) endQiecuo(uid string) (result *pb.DBPracticeQiecuoRecor result = &pb.DBPracticeQiecuoRecord{} if err = this.Get(uid, result); err != nil { this.module.Errorln(err) + return } this.Change(uid, map[string]interface{}{ "status": 0, diff --git a/modules/shop/configure.go b/modules/shop/configure.go index 7df5cf1ab..ebd8e785f 100644 --- a/modules/shop/configure.go +++ b/modules/shop/configure.go @@ -14,13 +14,13 @@ const ( game_shopitem = "game_shopitem.json" ) -///背包配置管理组件 +// /背包配置管理组件 type configureComp struct { modules.MCompConfigure module *Shop } -//组件初始化接口 +// 组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MCompConfigure.Init(service, module, comp, options) this.module = module.(*Shop) @@ -29,7 +29,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp return } -//获取装备配置数据 +// 获取装备配置数据 func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopData, err error) { var ( v interface{} @@ -48,7 +48,7 @@ func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopDa return } -//读取商品 +// 读取商品 func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameShopitemData, err error) { var ( v interface{} @@ -67,7 +67,7 @@ func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameSho return } -//读取商品组 +// 读取商品组 func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb.DBUser) (result []*cfg.GameShopitemData, err error) { result = make([]*cfg.GameShopitemData, 0, 10) var ( @@ -92,7 +92,7 @@ func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb return } -//读取商品 +// 读取商品 func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []*cfg.GameShopitemData, err error) { result = make([]*cfg.GameShopitemData, 0, len(keys)) var ( @@ -111,6 +111,8 @@ func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []* result = append(result, item) } else { this.module.Errorf("no found GetShopItemsConfigureByIds:%d", v) + err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_shopitem, v) + return } } } diff --git a/modules/shop/core.go b/modules/shop/core.go index 3967fe607..a0a38818a 100644 --- a/modules/shop/core.go +++ b/modules/shop/core.go @@ -33,12 +33,7 @@ func randomGoods(goods []*cfg.GameShopitemData) (result *cfg.GameShopitemData) { // 转换商品对象 func transGoods(goods []*cfg.GameShopitemData, sdata *pb.UserShopData) (result []*pb.ShopItem) { result = make([]*pb.ShopItem, len(goods)) - // ok := false - // uitem := &pb.DBShopItem{} for i, v := range goods { - // if uitem, ok = ushoputem[v.Key]; !ok { - // uitem = &pb.DBShopItem{} - // } result[i] = &pb.ShopItem{ Gid: sdata.Items[i].Id, GoodsId: v.Key, diff --git a/modules/shop/module.go b/modules/shop/module.go index 6395c3ebd..3e7e75dac 100644 --- a/modules/shop/module.go +++ b/modules/shop/module.go @@ -28,12 +28,12 @@ type Shop struct { modelShop *modelShopComp } -//模块名 +// 模块名 func (this *Shop) GetType() core.M_Modules { return comm.ModuleShop } -//模块初始化接口 注册用户创建角色事件 +// 模块初始化接口 注册用户创建角色事件 func (this *Shop) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.service = service.(base.IRPCXService) @@ -53,7 +53,7 @@ func (this *Shop) Start() (err error) { return } -//装备组件 +// 装备组件 func (this *Shop) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) @@ -61,7 +61,7 @@ func (this *Shop) OnInstallComp() { this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } -//Event------------------------------------------------------------------------------------------------------------ +// Event------------------------------------------------------------------------------------------------------------ func (this *Shop) EventUserOffline(session comm.IUserSession) { this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false)) }