修改卡消耗
This commit is contained in:
parent
93570f645f
commit
541ffb0d42
@ -119,14 +119,14 @@ func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//消耗一张英雄卡
|
//消耗一张英雄卡
|
||||||
func (this *ModelHero) consumeOneHeroCard(hero *pb.DBHero, count int32) error {
|
func (this *ModelHero) consumeOneHeroCard(uid, heroId string, count int32) (err error) {
|
||||||
if hero == nil {
|
for i := 0; i < int(count); i++ {
|
||||||
return fmt.Errorf("hero no exist")
|
if err := this.moduleHero.modelHero.DelListlds(uid, heroId); err != nil {
|
||||||
|
log.Errorf("%v", err)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if hero.SameCount < count {
|
return
|
||||||
return fmt.Errorf("card no enough")
|
|
||||||
}
|
|
||||||
return this.moduleHero.modelHero.DelListlds(hero.Uid, hero.Id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新英雄数据
|
//更新英雄数据
|
||||||
|
@ -58,7 +58,7 @@ func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range curList {
|
for _, v := range curList {
|
||||||
err := this.modelHero.consumeOneHeroCard(v, count)
|
err := this.modelHero.consumeOneHeroCard(v.Uid, v.Id, count)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pb.ErrorCode_DBError
|
return pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user