上传商店和共鸣水晶

This commit is contained in:
liwei 2023-07-13 10:02:10 +08:00
parent 48de8a84f9
commit 7698142adf
6 changed files with 15 additions and 18 deletions

View File

@ -77,7 +77,7 @@ func (this *apiComp) InRoom(session comm.IUserSession, req *pb.PassonInRoomReq)
return return
} }
if hero.Lv >= passon.Passonlv { if hero.Lv > passon.Passonlv {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),

View File

@ -131,5 +131,4 @@ func (this *Passon) HeroUpLv(session comm.IUserSession, heroid string, lv int32)
this.Errorln(err) this.Errorln(err)
return return
} }
} }

View File

@ -12,7 +12,7 @@ import (
"go.mongodb.org/mongo-driver/x/bsonx" "go.mongodb.org/mongo-driver/x/bsonx"
) )
///熊猫武馆数据表 // /熊猫武馆数据表
type modelQiecuo struct { type modelQiecuo struct {
modules.MCompModel modules.MCompModel
module *Practice module *Practice
@ -53,6 +53,7 @@ func (this *modelQiecuo) endQiecuo(uid string) (result *pb.DBPracticeQiecuoRecor
result = &pb.DBPracticeQiecuoRecord{} result = &pb.DBPracticeQiecuoRecord{}
if err = this.Get(uid, result); err != nil { if err = this.Get(uid, result); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
return
} }
this.Change(uid, map[string]interface{}{ this.Change(uid, map[string]interface{}{
"status": 0, "status": 0,

View File

@ -14,13 +14,13 @@ const (
game_shopitem = "game_shopitem.json" game_shopitem = "game_shopitem.json"
) )
///背包配置管理组件 // /背包配置管理组件
type configureComp struct { type configureComp struct {
modules.MCompConfigure modules.MCompConfigure
module *Shop module *Shop
} }
//组件初始化接口 // 组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { 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.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Shop) this.module = module.(*Shop)
@ -29,7 +29,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
return return
} }
//获取装备配置数据 // 获取装备配置数据
func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopData, err error) { func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopData, err error) {
var ( var (
v interface{} v interface{}
@ -48,7 +48,7 @@ func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopDa
return return
} }
//读取商品 // 读取商品
func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameShopitemData, err error) { func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameShopitemData, err error) {
var ( var (
v interface{} v interface{}
@ -67,7 +67,7 @@ func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameSho
return return
} }
//读取商品组 // 读取商品组
func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb.DBUser) (result []*cfg.GameShopitemData, err error) { func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb.DBUser) (result []*cfg.GameShopitemData, err error) {
result = make([]*cfg.GameShopitemData, 0, 10) result = make([]*cfg.GameShopitemData, 0, 10)
var ( var (
@ -92,7 +92,7 @@ func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb
return return
} }
//读取商品 // 读取商品
func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []*cfg.GameShopitemData, err error) { func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []*cfg.GameShopitemData, err error) {
result = make([]*cfg.GameShopitemData, 0, len(keys)) result = make([]*cfg.GameShopitemData, 0, len(keys))
var ( var (
@ -111,6 +111,8 @@ func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []*
result = append(result, item) result = append(result, item)
} else { } else {
this.module.Errorf("no found GetShopItemsConfigureByIds:%d", v) this.module.Errorf("no found GetShopItemsConfigureByIds:%d", v)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_shopitem, v)
return
} }
} }
} }

View File

@ -33,12 +33,7 @@ func randomGoods(goods []*cfg.GameShopitemData) (result *cfg.GameShopitemData) {
// 转换商品对象 // 转换商品对象
func transGoods(goods []*cfg.GameShopitemData, sdata *pb.UserShopData) (result []*pb.ShopItem) { func transGoods(goods []*cfg.GameShopitemData, sdata *pb.UserShopData) (result []*pb.ShopItem) {
result = make([]*pb.ShopItem, len(goods)) result = make([]*pb.ShopItem, len(goods))
// ok := false
// uitem := &pb.DBShopItem{}
for i, v := range goods { for i, v := range goods {
// if uitem, ok = ushoputem[v.Key]; !ok {
// uitem = &pb.DBShopItem{}
// }
result[i] = &pb.ShopItem{ result[i] = &pb.ShopItem{
Gid: sdata.Items[i].Id, Gid: sdata.Items[i].Id,
GoodsId: v.Key, GoodsId: v.Key,

View File

@ -28,12 +28,12 @@ type Shop struct {
modelShop *modelShopComp modelShop *modelShopComp
} }
//模块名 // 模块名
func (this *Shop) GetType() core.M_Modules { func (this *Shop) GetType() core.M_Modules {
return comm.ModuleShop return comm.ModuleShop
} }
//模块初始化接口 注册用户创建角色事件 // 模块初始化接口 注册用户创建角色事件
func (this *Shop) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *Shop) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options) err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService) this.service = service.(base.IRPCXService)
@ -53,7 +53,7 @@ func (this *Shop) Start() (err error) {
return return
} }
//装备组件 // 装备组件
func (this *Shop) OnInstallComp() { func (this *Shop) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
@ -61,7 +61,7 @@ func (this *Shop) OnInstallComp() {
this.configure = this.RegisterComp(new(configureComp)).(*configureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
} }
//Event------------------------------------------------------------------------------------------------------------ // Event------------------------------------------------------------------------------------------------------------
func (this *Shop) EventUserOffline(session comm.IUserSession) { func (this *Shop) EventUserOffline(session comm.IUserSession) {
this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false)) this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
} }