This commit is contained in:
liwei 2022-10-18 15:20:00 +08:00
commit 0fd5845428

View File

@ -3,6 +3,9 @@ package hero
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"go_dreamfactory/utils"
"time"
"google.golang.org/protobuf/proto"
)
@ -19,6 +22,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (code
var (
uid string
)
hero := &pb.DBHero{}
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success {
return
}
@ -29,12 +33,19 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (code
} else {
uid = req.Uid
}
hero := this.module.modelHero.getOneHero(uid, req.HeroId)
if hero == nil {
code = pb.ErrorCode_HeroNoExist
return
tag, _, b := utils.UIdSplit(uid)
if b {
if conn, err := db.ServerDBConn(tag); err == nil {
dbModel := db.NewDBModel(comm.TableHero, time.Hour, conn)
if err = dbModel.GetListObj(uid, req.HeroId, hero); err == nil {
rsp.Base = hero
} else {
this.module.Errorf("err:%v", err)
}
}
}
rsp.Base = hero
session.SendMsg(string(this.module.GetType()), HeroSubTypeInfo, rsp)
return
}