From a9bb36576061f16fd06700c8ebd719f27db87ea5 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Sat, 26 Nov 2022 12:09:36 +0800 Subject: [PATCH] user get token add account judge --- internal/rpc/auth/auth.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index 5e929fd4e..5c47713c0 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -50,6 +50,11 @@ func (rpc *rpcAuth) UserRegister(_ context.Context, req *pbAuth.UserRegisterReq) func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String()) + _, err := imdb.GetUserByUserID(req.FromUserID) + if err != nil { + log.NewError(req.OperationID, "not this user:", req.FromUserID, req.String()) + return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: err.Error()}}, nil + } tokens, expTime, err := token_verify.CreateToken(req.FromUserID, int(req.Platform)) if err != nil { errMsg := req.OperationID + " token_verify.CreateToken failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform)