test conn
This commit is contained in:
+12
-18
@@ -12,38 +12,32 @@ import (
|
||||
)
|
||||
|
||||
func NewAuth(discov discoveryregistry.SvcDiscoveryRegistry) *Auth {
|
||||
// conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImAuthName)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
return &Auth{discov: discov}
|
||||
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImAuthName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
client := auth.NewAuthClient(conn)
|
||||
return &Auth{discov: discov, conn: conn, client: client}
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
conn *grpc.ClientConn
|
||||
client auth.AuthClient
|
||||
discov discoveryregistry.SvcDiscoveryRegistry
|
||||
}
|
||||
|
||||
func (o *Auth) client(ctx context.Context) (auth.AuthClient, error) {
|
||||
c, err := o.discov.GetConn(ctx, config.Config.RpcRegisterName.OpenImAuthName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return auth.NewAuthClient(c), nil
|
||||
}
|
||||
|
||||
func (o *Auth) UserRegister(c *gin.Context) {
|
||||
//a2r.Call(auth.AuthClient.UserRegister, o.userClient, c) // todo
|
||||
func (o *Auth) Client(ctx context.Context) (auth.AuthClient, error) {
|
||||
return o.client, nil
|
||||
}
|
||||
|
||||
func (o *Auth) UserToken(c *gin.Context) {
|
||||
a2r.Call(auth.AuthClient.UserToken, o.client, c)
|
||||
a2r.Call(auth.AuthClient.UserToken, o.Client, c)
|
||||
}
|
||||
|
||||
func (o *Auth) ParseToken(c *gin.Context) {
|
||||
a2r.Call(auth.AuthClient.ParseToken, o.client, c)
|
||||
a2r.Call(auth.AuthClient.ParseToken, o.Client, c)
|
||||
}
|
||||
|
||||
func (o *Auth) ForceLogout(c *gin.Context) {
|
||||
a2r.Call(auth.AuthClient.ForceLogout, o.client, c)
|
||||
a2r.Call(auth.AuthClient.ForceLogout, o.Client, c)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush/fcm"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/internal/push/offlinepush/getui"
|
||||
@@ -255,6 +256,7 @@ func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData,
|
||||
for _, v := range conns {
|
||||
msgClient := msggateway.NewMsgGatewayClient(v)
|
||||
reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(ctx, &msggateway.OnlineBatchPushOneMsgReq{MsgData: msg, PushToUserIDs: pushToUserIDs})
|
||||
v.Close()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@@ -262,6 +264,7 @@ func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData,
|
||||
if reply != nil && reply.SinglePushResult != nil {
|
||||
wsResults = append(wsResults, reply.SinglePushResult...)
|
||||
}
|
||||
|
||||
}
|
||||
return wsResults, nil
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID
|
||||
client := msggateway.NewMsgGatewayClient(v)
|
||||
kickReq := &msggateway.KickUserOfflineReq{KickUserIDList: []string{userID}, PlatformID: platformID}
|
||||
_, err := client.KickUserOffline(ctx, kickReq)
|
||||
v.Close()
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
return errs.ErrInternalServer.Wrap()
|
||||
|
||||
Reference in New Issue
Block a user