diff --git a/modules/island/api_buy.go b/modules/island/api_buy.go index 1edbc7838..1b13d307e 100644 --- a/modules/island/api_buy.go +++ b/modules/island/api_buy.go @@ -17,12 +17,13 @@ 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 - info *pb.DBIsland - heros []*pb.DBHero - hero *pb.DBHero - ok bool - err error + conf *cfg.GameHeroData + coinconf *cfg.GamePuggsyRecruitData + info *pb.DBIsland + heros []*pb.DBHero + hero *pb.DBHero + ok bool + err error ) if errdata = this.BuyCheck(session, req); errdata != nil { return @@ -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, diff --git a/modules/island/configure.go b/modules/island/configure.go index baf064bb3..28818fd4e 100644 --- a/modules/island/configure.go +++ b/modules/island/configure.go @@ -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 +}