kick user log

test-v3dev1^2
wangchuxiao 1 year ago
parent 3658f2b198
commit 5dbeac7dcf

@ -146,6 +146,8 @@ func (s *Server) KickUserOffline(ctx context.Context, req *msggateway.KickUserOf
return nil, err return nil, err
} }
} }
} else {
log.ZWarn(ctx, "conn not exist", nil, "userID", v, "platformID", req.PlatformID)
} }
} }
return &msggateway.KickUserOfflineResp{}, nil return &msggateway.KickUserOfflineResp{}, nil

@ -93,14 +93,13 @@ func (s *authServer) ParseToken(ctx context.Context, req *pbAuth.ParseTokenReq)
} }
func (s *authServer) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) { func (s *authServer) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) {
resp := pbAuth.ForceLogoutResp{}
if err := tokenverify.CheckAdmin(ctx); err != nil { if err := tokenverify.CheckAdmin(ctx); err != nil {
return nil, err return nil, err
} }
if err := s.forceKickOff(ctx, req.UserID, req.PlatformID, mcontext.GetOperationID(ctx)); err != nil { if err := s.forceKickOff(ctx, req.UserID, req.PlatformID, mcontext.GetOperationID(ctx)); err != nil {
return nil, err return nil, err
} }
return &resp, nil return &pbAuth.ForceLogoutResp{}, nil
} }
func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID int32, operationID string) error { func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID int32, operationID string) error {
@ -114,5 +113,5 @@ func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID
_, err := client.KickUserOffline(ctx, kickReq) _, err := client.KickUserOffline(ctx, kickReq)
return utils.Wrap(err, "") return utils.Wrap(err, "")
} }
return errs.ErrInternalServer.Wrap() return nil
} }

@ -607,7 +607,7 @@ func (db *commonMsgDatabase) UserMsgsDestruct(ctx context.Context, userID string
//&& msgDocModel.Msg[0].Msg.SendTime > lastMsgDestructTime.UnixMilli() //&& msgDocModel.Msg[0].Msg.SendTime > lastMsgDestructTime.UnixMilli()
if len(msgDocModel.Msg) > 0 { if len(msgDocModel.Msg) > 0 {
for _, msg := range msgDocModel.Msg { for _, msg := range msgDocModel.Msg {
if msg.Msg.SendTime+destructTime*1000 <= time.Now().UnixMilli() { if msg != nil && msg.Msg != nil && msg.Msg.SendTime+destructTime*1000 <= time.Now().UnixMilli() {
if msg.Msg.SendTime > lastMsgDestructTime.UnixMilli() && !utils.Contain(userID, msg.DelList...) { if msg.Msg.SendTime > lastMsgDestructTime.UnixMilli() && !utils.Contain(userID, msg.DelList...) {
seqs = append(seqs, msg.Msg.Seq) seqs = append(seqs, msg.Msg.Seq)
} }

Loading…
Cancel
Save