参数校验

This commit is contained in:
meixiongfeng 2022-06-30 20:16:55 +08:00
parent 0890e704ce
commit 0e3470b5f4

View File

@ -16,8 +16,8 @@ func (this *apiComp) StrengthenUpSkillCheck(session comm.IUserSession, req *pb.H
}
var (
tagColor int32
costColor int32
tagColor int32 // 目标卡品质
costColor int32 // 消耗卡品质
)
_hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在
if err != 0 {
@ -47,7 +47,6 @@ func (this *apiComp) StrengthenUpSkillCheck(session comm.IUserSession, req *pb.H
return
}
result = map[string]interface{}{
"heroid": _hero.HeroID,
"heroObj": _hero,
}
return
@ -56,7 +55,6 @@ func (this *apiComp) StrengthenUpSkillCheck(session comm.IUserSession, req *pb.H
/// 英雄技能升级
func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[string]interface{}, req *pb.HeroStrengthenUpSkillReq) (code pb.ErrorCode) {
var (
tagHero int32 // 操作的英雄configid
tmpUpSkillID map[int32]*pb.SkillData // 即将要升级的技能id
probability map[int32]int32 // 即将升级技能的权重
upSkillPos int32 // 升级的技能位置
@ -65,7 +63,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin
)
tmpUpSkillID = make(map[int32]*pb.SkillData, 0)
probability = make(map[int32]int32, 0)
tagHero = agrs["heroid"].(int32)
_hero := agrs["heroObj"].(*pb.DBHero)
if _hero == nil {
code = pb.ErrorCode_HeroNoExist
@ -77,7 +74,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin
session.SendMsg(string(this.moduleHero.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})
}
}()
log.Debugf("英雄:%d 技能升级", tagHero)
config, err := this.moduleHero.configure.GetHeroSkillUpConfig()
if err != nil {
return
@ -97,7 +94,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin
// 获取权重
for k, v := range tmpUpSkillID {
for _, v2 := range config.GetDataList() {
if v2.Hid == tagHero && k == v2.Skillpos && v.SkillLv == v2.Skilllevel {
if v2.Hid == _hero.HeroID && k == v2.Skillpos && v.SkillLv == v2.Skilllevel {
probability[k] = v2.Probability // 设置权重
}
}