一次创建多个英雄接口

This commit is contained in:
meixiongfeng 2022-08-01 19:01:41 +08:00
parent 2d7ee15f07
commit 7bb39c45e2
3 changed files with 17 additions and 1 deletions

View File

@ -39,6 +39,8 @@ type (
CreateHeroes(uid string, heroCfgId ...string) error CreateHeroes(uid string, heroCfgId ...string) error
//创建指定数量 //创建指定数量
CreateRepeatHero(uid string, heroCfgId string, num int32) (*pb.DBHero, error) CreateRepeatHero(uid string, heroCfgId string, num int32) (*pb.DBHero, error)
// 批量创建英雄
CreateRepeatHeros(session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
// 获取英雄 // 获取英雄
// heroId 英雄ID // heroId 英雄ID
GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode) GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode)

View File

@ -157,3 +157,17 @@ func (this *Hero) EventUserOffline(session comm.IUserSession) {
err := this.modelHero.RemoveUserHeroInfo(session) err := this.modelHero.RemoveUserHeroInfo(session)
this.Debugf("EventUserOffline:%s err:%v", session, err) this.Debugf("EventUserOffline:%s err:%v", session, err)
} }
// 批量创建多个英雄
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode) {
for heroCfgId, num := range items {
_, err := this.modelHero.createHeroOverlying(session.GetUserId(), heroCfgId, num)
if err != nil {
code = pb.ErrorCode_HeroCreate
break
}
}
return
}

View File

@ -48,7 +48,7 @@ func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.Ma
// 修改状态 // 修改状态
this.module.modelMail.MailUpdateMailAttachmentState(req.ObjID) this.module.modelMail.MailUpdateMailAttachmentState(req.ObjID)
mail.Reward = true mail.Reward = true
return //return
} }
} }
} }