方法重命名

This commit is contained in:
zhaocy 2022-06-28 15:03:09 +08:00
parent 9d47098166
commit aca7543d7e
4 changed files with 13 additions and 8 deletions

View File

@ -38,7 +38,7 @@ type (
//消耗卡片
ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode)
//创建新英雄
CreatHero(uid string, heroCfgId ...int32) error
CreateHero(uid string, heroCfgId ...int32) error
// 获取英雄
// heroId 英雄ID

View File

@ -62,14 +62,19 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) error {
//创建多个指定的英雄 heroCfgIds可填入多个英雄ID
func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
data := make(map[string]interface{})
// data := make(map[string]interface{})
for _, v := range heroCfgIds {
hero := this.initHero(uid, v)
if hero != nil {
data[hero.Id] = hero
if err := this.createOneHero(uid, v); err != nil {
return err
}
// hero := this.initHero(uid, v)
// if hero != nil {
// data[hero.Id] = hero
// }
}
return this.moduleHero.modelHero.AddLists(uid, data)
return nil
// return this.moduleHero.model_hero.AddLists(uid, data)
}
//获取一个英雄

View File

@ -40,7 +40,7 @@ func (this *Hero) OnInstallComp() {
}
//创建新英雄
func (this *Hero) CreatHero(uid string, heroCfgId ...int32) error {
func (this *Hero) CreateHero(uid string, heroCfgId ...int32) error {
return this.modelHero.createMultiHero(uid, heroCfgId...)
}

View File

@ -41,7 +41,7 @@ func (this *apiComp) Create(session comm.IUserSession, result map[string]interfa
//初始化英雄卡
defaultHero := []int32{15001, 25001} //TODO 从配置中读取
err = this.hero.CreatHero(session.GetUserId(), defaultHero...)
err = this.hero.CreateHero(session.GetUserId(), defaultHero...)
if err != nil {
code = pb.ErrorCode_HeroInitCreat
return