修改英雄详情
This commit is contained in:
parent
b6feed3aba
commit
5f7d75b6af
@ -26,14 +26,16 @@ var (
|
||||
},
|
||||
enabled: true,
|
||||
}, {
|
||||
Desc: "英雄详情",
|
||||
mainType: string(comm.ModuleHero),
|
||||
subType: hero.HeroSubTypeInfo,
|
||||
req: &pb.HeroInfoReq{
|
||||
HeroId: "62baac19aa7c09b3679be57c",
|
||||
HeroId: "62c676d57deea8b9af8884a5",
|
||||
},
|
||||
rsp: &pb.HeroInfoResp{},
|
||||
// enabled: true,
|
||||
}, {
|
||||
Desc: "抽卡",
|
||||
mainType: string(comm.ModuleHero),
|
||||
subType: hero.HeroSubTypeChouka,
|
||||
req: &pb.HeroChoukaReq{
|
||||
|
@ -55,7 +55,7 @@ var (
|
||||
TaskTag: int32(comm.TASK_DAILY),
|
||||
},
|
||||
rsp: &pb.TaskActiveReceiveResp{},
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
@ -2,7 +2,6 @@ package hero
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
@ -33,12 +32,7 @@ func (this *apiComp) Chouka(session comm.IUserSession, req *pb.HeroChoukaReq) (c
|
||||
return
|
||||
}
|
||||
|
||||
heroes, err := this.module.modelHero.getHeroList(session.GetUserId())
|
||||
if err != nil {
|
||||
log.Errorf("%v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
rsp.Heroes = heroes
|
||||
rsp.Heroes = this.module.modelHero.getHeroList(session.GetUserId())
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.HeroInfoReq) (code pb.ErrorCode) {
|
||||
if req.HeroId != "" {
|
||||
if req.HeroId == "" {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
|
@ -24,13 +24,6 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.HeroListReq) (code
|
||||
utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeList, req, rsp)
|
||||
}()
|
||||
|
||||
list, err := this.module.modelHero.getHeroList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
rsp.List = list
|
||||
|
||||
rsp.List = this.module.GetHeroList(session.GetUserId())
|
||||
return
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ func TestPropertyCompute(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHeroList(t *testing.T) {
|
||||
heroes, err := module.modelHero.getHeroList("u1")
|
||||
fmt.Printf("%v %v", heroes, err)
|
||||
heroes := module.modelHero.getHeroList("u1")
|
||||
fmt.Printf("%v", heroes,)
|
||||
}
|
||||
|
||||
func TestModify(t *testing.T) {
|
||||
|
@ -93,10 +93,7 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) (err error) {
|
||||
|
||||
//创建多个指定的英雄 heroCfgIds可填入多个英雄ID
|
||||
func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
|
||||
heroes, err := this.moduleHero.modelHero.getHeroList(uid)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
heroes := this.moduleHero.modelHero.getHeroList(uid)
|
||||
|
||||
if len(heroes) == 0 {
|
||||
for _, v := range heroCfgIds {
|
||||
@ -161,13 +158,13 @@ func (this *ModelHero) modifyHeroData(uid, heroId string, data map[string]interf
|
||||
}
|
||||
|
||||
//获取玩家的英雄列表
|
||||
func (this *ModelHero) getHeroList(uid string) ([]*pb.DBHero, error) {
|
||||
func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
||||
heroes := make([]*pb.DBHero, 0)
|
||||
err := this.GetList(uid, &heroes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil
|
||||
}
|
||||
return heroes, nil
|
||||
return heroes
|
||||
}
|
||||
|
||||
//更新装备
|
||||
|
@ -110,11 +110,13 @@ func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (co
|
||||
|
||||
//英雄列表
|
||||
func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
|
||||
list, err := this.modelHero.getHeroList(uid)
|
||||
if err != nil {
|
||||
return nil
|
||||
data := []*pb.DBHero{}
|
||||
heroes := this.modelHero.getHeroList(uid)
|
||||
for _, h := range heroes {
|
||||
h.Property = this.modelHero.PropertyCompute(uid, h.Id)
|
||||
data = append(data, h)
|
||||
}
|
||||
return list
|
||||
return data
|
||||
}
|
||||
|
||||
//查询英雄数量
|
||||
|
Loading…
Reference in New Issue
Block a user