上传商店和共鸣水晶

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
}
if hero.Lv >= passon.Passonlv {
if hero.Lv > passon.Passonlv {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
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)
return
}
}

View File

@ -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,

View File

@ -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
}
}
}

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) {
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,

View File

@ -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))
}