获取指定星级等级英雄 接口参数调整

This commit is contained in:
meixiongfeng 2022-08-01 10:42:20 +08:00
parent 1e7dc159e4
commit 303a6969b7
2 changed files with 10 additions and 5 deletions

View File

@ -49,7 +49,7 @@ type (
//清理玩家英雄数据 //清理玩家英雄数据
CleanData(uid string) CleanData(uid string)
// 获取指定星级等级的英雄 // 获取指定星级等级的英雄
GetSpecifiedHero(uid, heroConfId string, star, lv int32) (*pb.DBHero, error) GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (*pb.DBHero, error)
} }
//玩家 //玩家

View File

@ -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) { func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (hero *pb.DBHero, err error) {
if uid == "" || heroConfId == "" || star == 0 || lv == 0 { if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 {
return nil, errors.New("parameter err") return nil, errors.New("parameter err")
} }
hero, err = this.modelHero.createOneHero(uid, heroConfId) hero, err = this.modelHero.createOneHero(session.GetUserId(), heroConfId)
if err == nil { if err == nil {
return return
} }
@ -139,11 +139,16 @@ func (this *Hero) GetSpecifiedHero(uid, heroConfId string, star, lv int32) (hero
"isOverlying": false, "isOverlying": false,
} }
// 保存数据 // 保存数据
err = this.modelHero.ChangeList(uid, hero.Id, _heroMap) err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
if err != nil { if err != nil {
log.Errorf("GetSpecified failed:%v", err) log.Errorf("GetSpecified failed:%v", err)
return return
} }
list := make([]*pb.DBHero, 0)
list = append(list, hero)
// push change
session.SendMsg("hero", "change", &pb.HeroChangePush{List: list})
return return
} }