From 690685f8494b7732ef8d6917e75dc331401ec30d Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 18 Oct 2022 15:10:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=A8=E6=9C=8D=E8=8E=B7=E5=8F=96=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=8E=A9=E5=AE=B6=E8=8B=B1=E9=9B=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_info.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/hero/api_info.go b/modules/hero/api_info.go index 579c17b88..f9d6fb93a 100644 --- a/modules/hero/api_info.go +++ b/modules/hero/api_info.go @@ -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 }