修改扣除资源接口参数
This commit is contained in:
parent
08d12b0f36
commit
31fc23c945
@ -107,7 +107,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, agrs map[string]interf
|
||||
if v.A == "attr" { // 查询玩家身上资源是否满足
|
||||
value := this.moduleHero.api.user.QueryAttributeValue(session.GetUserId(), v.T)
|
||||
if value >= v.N { // 直接删除财富
|
||||
code = this.user.AddAttributeValue(session.GetUserId(), v.T, -v.N) // 扣除资源
|
||||
code = this.user.AddAttributeValue(session.GetUserId(), v.T, value-v.N) // 扣除资源
|
||||
break
|
||||
} else {
|
||||
code = pb.ErrorCode_ResNoEnough
|
||||
|
@ -97,6 +97,7 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He
|
||||
result = map[string]interface{}{
|
||||
"costGold": target.Gold,
|
||||
"heroObj": tagHero,
|
||||
"curGold": curGold,
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -106,6 +107,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string
|
||||
|
||||
costGold := agrs["costGold"].(int32)
|
||||
_hero := agrs["heroObj"].(*pb.DBHero)
|
||||
curGold := agrs["curGold"].(int32)
|
||||
if _hero == nil {
|
||||
code = pb.ErrorCode_HeroNoExist
|
||||
return
|
||||
@ -117,7 +119,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string
|
||||
}()
|
||||
|
||||
// 消耗道具
|
||||
code = this.user.AddAttributeValue(session.GetUserId(), "gold", -costGold) // 减少金币
|
||||
code = this.user.AddAttributeValue(session.GetUserId(), "gold", curGold-costGold) // 减少金币
|
||||
if code != pb.ErrorCode_Success {
|
||||
log.Errorf("cost gold failed ,count = %d", costGold)
|
||||
code = pb.ErrorCode_GoldNoEnough
|
||||
|
@ -21,8 +21,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero
|
||||
atn = map[string]interface{}{}
|
||||
)
|
||||
atn = make(map[string]interface{}, 0)
|
||||
curGold = 0
|
||||
costRes = 0
|
||||
|
||||
_hero, err := this.moduleHero.GetHero(session.GetUserId(), req.HeroObjID) // 校验升级的对象是否存在
|
||||
|
||||
if err != pb.ErrorCode_Success {
|
||||
@ -155,15 +154,12 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i
|
||||
return
|
||||
}
|
||||
// 删除经验卡
|
||||
err := this.moduleHero.modelHero.DelListlds(session.GetUserId(), req.ExpCardID)
|
||||
err := this.moduleHero.modelHero.consumeOneHeroCard(session.GetUserId(), req.ExpCardID, req.Amount)
|
||||
if err != nil {
|
||||
log.Errorf("delete err failed err:%T!", err)
|
||||
return
|
||||
}
|
||||
//code = this.moduleHero.modelHero.moduleHero.DelCard(req.ExpCardID, req.Amount)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
err = this.moduleHero.modelHero.PushHeroProperty(session, _hero.Id) // 推送属性变化
|
||||
if err != nil {
|
||||
log.Errorf("PushHeroProperty err!")
|
||||
|
Loading…
Reference in New Issue
Block a user