上传海岛协议代码
This commit is contained in:
parent
e37ebb9190
commit
ba09658fda
@ -18,6 +18,7 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.IsLandBuyReq) (
|
||||
func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
conf *cfg.GameHeroData
|
||||
coinconf *cfg.GamePuggsyRecruitData
|
||||
info *pb.DBIsland
|
||||
heros []*pb.DBHero
|
||||
hero *pb.DBHero
|
||||
@ -36,6 +37,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
|
||||
return
|
||||
}
|
||||
|
||||
if coinconf, err = this.module.configure.getGamePuggsyRecruit(conf.Star); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if info, err = this.module.model.getmodel(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
@ -43,6 +52,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errda
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if errdata = this.module.ConsumeRes(session, coinconf.Need, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if _, ok = info.Heroshop[req.Cids]; ok {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
|
@ -16,6 +16,7 @@ const (
|
||||
game_puggsyscore = "game_puggsyscore.json"
|
||||
game_puggsypasscheck = "game_puggsypasscheck.json"
|
||||
game_puggsystar = "game_puggsystar.json"
|
||||
game_puggsyrecruit = "game_puggsyrecruit.json"
|
||||
)
|
||||
|
||||
// /背包配置管理组件
|
||||
@ -34,6 +35,7 @@ func (this *ConfigureComp) Init(service core.IService, module core.IModule, comp
|
||||
err = this.LoadConfigure(game_puggsyscore, cfg.NewGamePuggsyScore)
|
||||
err = this.LoadConfigure(game_puggsypasscheck, cfg.NewGamePuggsyPasscheck)
|
||||
err = this.LoadConfigure(game_puggsystar, cfg.NewGamePuggsyStar)
|
||||
err = this.LoadConfigure(game_puggsyrecruit, cfg.NewGamePuggsyRecruit)
|
||||
return
|
||||
}
|
||||
|
||||
@ -185,3 +187,22 @@ func (this *ConfigureComp) getGamePuggsyStarData(id int32) (conf *cfg.GamePuggsy
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取伤害对应的评分组
|
||||
func (this *ConfigureComp) getGamePuggsyRecruit(id int32) (conf *cfg.GamePuggsyRecruitData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
|
||||
if v, err = this.GetConfigure(game_puggsyrecruit); err != nil {
|
||||
return
|
||||
} else {
|
||||
if conf, ok = v.(*cfg.GamePuggsyRecruit).GetDataMap()[id]; !ok {
|
||||
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_puggsyrecruit, id)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user