获取指定星级等级英雄 接口参数调整
This commit is contained in:
parent
1e7dc159e4
commit
303a6969b7
@ -49,7 +49,7 @@ type (
|
||||
//清理玩家英雄数据
|
||||
CleanData(uid string)
|
||||
// 获取指定星级等级的英雄
|
||||
GetSpecifiedHero(uid, heroConfId string, star, lv int32) (*pb.DBHero, error)
|
||||
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (*pb.DBHero, error)
|
||||
}
|
||||
|
||||
//玩家
|
||||
|
@ -123,11 +123,11 @@ func (this *Hero) CleanData(uid string) {
|
||||
}
|
||||
|
||||
// 创建一些特殊的英雄
|
||||
func (this *Hero) GetSpecifiedHero(uid, heroConfId string, star, lv int32) (hero *pb.DBHero, err error) {
|
||||
if uid == "" || heroConfId == "" || star == 0 || lv == 0 {
|
||||
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (hero *pb.DBHero, err error) {
|
||||
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 {
|
||||
return nil, errors.New("parameter err")
|
||||
}
|
||||
hero, err = this.modelHero.createOneHero(uid, heroConfId)
|
||||
hero, err = this.modelHero.createOneHero(session.GetUserId(), heroConfId)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
@ -139,11 +139,16 @@ func (this *Hero) GetSpecifiedHero(uid, heroConfId string, star, lv int32) (hero
|
||||
"isOverlying": false,
|
||||
}
|
||||
// 保存数据
|
||||
err = this.modelHero.ChangeList(uid, hero.Id, _heroMap)
|
||||
err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
|
||||
if err != nil {
|
||||
log.Errorf("GetSpecified failed:%v", err)
|
||||
return
|
||||
}
|
||||
list := make([]*pb.DBHero, 0)
|
||||
|
||||
list = append(list, hero)
|
||||
// push change
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: list})
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user