Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
ced2437ae4
@ -25,7 +25,7 @@ func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpec
|
|||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hero, err := this.module.modelHero.createOneHero(session.GetUserId(), req.HeroCoinfigID)
|
hero, err := this.module.modelHero.createSpecialHero(session.GetUserId(), req.HeroCoinfigID)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
code = pb.ErrorCode_HeroNoExist
|
code = pb.ErrorCode_HeroNoExist
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,14 @@ func (this *ModelHero) initHeroSkill(hero *pb.DBHero) []*pb.SkillData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建一个指定的英雄
|
//创建一个指定的英雄
|
||||||
func (this *ModelHero) createOneHero(uid string, heroCfgId string) (hero *pb.DBHero, err error) {
|
func (this *ModelHero) createSpecialHero(uid string, heroCfgId string) (hero *pb.DBHero, err error) {
|
||||||
|
list := this.getHeroList(uid)
|
||||||
|
for _, v := range list {
|
||||||
|
if v.HeroID == heroCfgId {
|
||||||
|
hero = v
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
hero = this.InitHero(uid, heroCfgId)
|
hero = this.InitHero(uid, heroCfgId)
|
||||||
if hero != nil {
|
if hero != nil {
|
||||||
if err = this.AddList(uid, hero.Id, hero); err != nil {
|
if err = this.AddList(uid, hero.Id, hero); err != nil {
|
||||||
|
@ -234,7 +234,7 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
|||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hero, err := this.modelHero.createOneHero(session.GetUserId(), heroConfId)
|
hero, err := this.modelHero.createSpecialHero(session.GetUserId(), heroConfId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pb.ErrorCode_HeroCreate
|
return pb.ErrorCode_HeroCreate
|
||||||
}
|
}
|
||||||
@ -683,7 +683,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 开始创建英雄
|
// 开始创建英雄
|
||||||
hero, err := this.modelHero.createOneHero(session.GetUserId(), v.Hid)
|
hero, err := this.modelHero.createSpecialHero(session.GetUserId(), v.Hid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pb.ErrorCode_HeroCreate
|
return pb.ErrorCode_HeroCreate
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package user
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/sys/log"
|
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -17,21 +16,12 @@ func (this *apiComp) GetTujian(session comm.IUserSession, req *pb.UserGetTujianR
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
uid := session.GetUserId()
|
|
||||||
rsp := &pb.UserGetTujianResp{}
|
rsp := &pb.UserGetTujianResp{}
|
||||||
if result, err := this.module.modelExpand.GetUserExpand(uid); err != nil {
|
list := this.module.ModuleHero.GetHeroList(session.GetUserId())
|
||||||
this.module.Error("玩家扩展数据",
|
for _, v := range list {
|
||||||
log.Field{Key: "uid", Value: uid},
|
rsp.Heroids = append(rsp.Heroids, v.HeroID)
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
|
||||||
)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
for k, v := range result.Tujian {
|
|
||||||
if v == 0 {
|
|
||||||
rsp.Heroids = append(rsp.Heroids, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := session.SendMsg(string(this.module.GetType()), UserGetTujianResp, rsp)
|
err := session.SendMsg(string(this.module.GetType()), UserGetTujianResp, rsp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
|
Loading…
Reference in New Issue
Block a user