优化装备武器和饰品接口兼容
This commit is contained in:
parent
aab05cb576
commit
3ed500cf48
@ -71,6 +71,7 @@ const (
|
|||||||
ModuleHoroscope core.M_Modules = "horoscope" //星座图
|
ModuleHoroscope core.M_Modules = "horoscope" //星座图
|
||||||
//ModuleFetter core.M_Modules = "herofetter" //好友模块
|
//ModuleFetter core.M_Modules = "herofetter" //好友模块
|
||||||
ModuleSociaty core.M_Modules = "sociaty" //公会
|
ModuleSociaty core.M_Modules = "sociaty" //公会
|
||||||
|
ModulePay core.M_Modules = "pay" //支付
|
||||||
)
|
)
|
||||||
|
|
||||||
//数据表名定义处
|
//数据表名定义处
|
||||||
@ -176,6 +177,9 @@ const (
|
|||||||
TableSociatyTask = "sociatytask"
|
TableSociatyTask = "sociatytask"
|
||||||
// 公会日志
|
// 公会日志
|
||||||
TableSociatyLog = "sociatylog"
|
TableSociatyLog = "sociatylog"
|
||||||
|
|
||||||
|
///充值数据表
|
||||||
|
TablePay = "pay"
|
||||||
)
|
)
|
||||||
|
|
||||||
//RPC服务接口定义处
|
//RPC服务接口定义处
|
||||||
|
@ -12,10 +12,9 @@ import (
|
|||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) EquipCheck(session comm.IUserSession, req *pb.EquipmentEquipReq) (code pb.ErrorCode) {
|
func (this *apiComp) EquipCheck(session comm.IUserSession, req *pb.EquipmentEquipReq) (code pb.ErrorCode) {
|
||||||
if len(req.EquipmentId) != 6 || req.HeroCardId == "" {
|
if (len(req.EquipmentId) != 6 && len(req.EquipmentId) != 8) || req.HeroCardId == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +72,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
if equipments[i].Lv < suite1Lv {
|
if equipments[i].Lv < suite1Lv {
|
||||||
suite1Lv = equipments[i].Lv
|
suite1Lv = equipments[i].Lv
|
||||||
}
|
}
|
||||||
} else {
|
} else if i < 6 {
|
||||||
if confs[i].Star < suite2Str {
|
if confs[i].Star < suite2Str {
|
||||||
suite2Str = confs[i].Star
|
suite2Str = confs[i].Star
|
||||||
}
|
}
|
||||||
@ -127,7 +126,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
} else {
|
} else {
|
||||||
if i < 4 {
|
if i < 4 {
|
||||||
msuit = false //主套装没有
|
msuit = false //主套装没有
|
||||||
} else {
|
} else if i < 6 {
|
||||||
subsit = false //辅套装没有
|
subsit = false //辅套装没有
|
||||||
}
|
}
|
||||||
hero.EquipID[i] = ""
|
hero.EquipID[i] = ""
|
||||||
@ -182,7 +181,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
if hero.SuiteExtId != 0 {
|
if hero.SuiteExtId != 0 {
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
|
||||||
}
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})
|
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
22
modules/pay/configure.go
Normal file
22
modules/pay/configure.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package pay
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ()
|
||||||
|
|
||||||
|
///背包配置管理组件
|
||||||
|
type configureComp struct {
|
||||||
|
modules.MCompConfigure
|
||||||
|
module *Pay
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
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.(*Pay)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
40
modules/pay/modelPay.go
Normal file
40
modules/pay/modelPay.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package pay
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/mgo"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
|
)
|
||||||
|
|
||||||
|
///论坛 数据组件
|
||||||
|
type modelShopComp struct {
|
||||||
|
modules.MCompModel
|
||||||
|
module *Pay
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *modelShopComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||||
|
this.MCompModel.Init(service, module, comp, opt)
|
||||||
|
this.module = module.(*Pay)
|
||||||
|
this.TableName = comm.TablePay
|
||||||
|
//创建uid索引
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询用户装备数据
|
||||||
|
func (this *modelShopComp) QueryUserShopData(uId string) (data *pb.DBShop, err error) {
|
||||||
|
data = &pb.DBShop{}
|
||||||
|
if err = this.Get(uId, data); err != nil && err != mgo.MongodbNil {
|
||||||
|
this.module.Errorf("err:%v", err)
|
||||||
|
}
|
||||||
|
err = nil
|
||||||
|
return
|
||||||
|
}
|
39
modules/pay/module.go
Normal file
39
modules/pay/module.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package pay
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
模块名:支付系统
|
||||||
|
描述:充值商城
|
||||||
|
开发:李伟
|
||||||
|
*/
|
||||||
|
func NewModule() core.IModule {
|
||||||
|
m := new(Pay)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
type Pay struct {
|
||||||
|
modules.ModuleBase
|
||||||
|
configure *configureComp
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块名
|
||||||
|
func (this *Pay) GetType() core.M_Modules {
|
||||||
|
return comm.ModulePay
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块初始化接口 注册用户创建角色事件
|
||||||
|
func (this *Pay) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备组件
|
||||||
|
func (this *Pay) OnInstallComp() {
|
||||||
|
this.ModuleBase.OnInstallComp()
|
||||||
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user