Skip to content

Commit

Permalink
fix: jssdk not init (#3016)
Browse files Browse the repository at this point in the history
* pb

* fix: Modifying other fields while setting IsPrivateChat does not take effect

* fix: quote message error revoke

* refactoring scheduled tasks

* refactoring scheduled tasks

* refactoring scheduled tasks

* refactoring scheduled tasks

* refactoring scheduled tasks

* refactoring scheduled tasks

* upgrading pkg tools

* fix
  • Loading branch information
withchao authored Dec 27, 2024
1 parent 930a9fd commit 36c6b41
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
21 changes: 14 additions & 7 deletions internal/api/jssdk/jssdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ const (
defaultGetActiveConversation = 100
)

func NewJSSdkApi() *JSSdk {
return &JSSdk{}
func NewJSSdkApi(userClient *rpcli.UserClient, relationClient *rpcli.RelationClient, groupClient *rpcli.GroupClient,
conversationClient *rpcli.ConversationClient, msgClient *rpcli.MsgClient) *JSSdk {
return &JSSdk{
userClient: userClient,
relationClient: relationClient,
groupClient: groupClient,
conversationClient: conversationClient,
msgClient: msgClient,
}
}

type JSSdk struct {
userClient rpcli.UserClient
relationClient rpcli.RelationClient
groupClient rpcli.GroupClient
conversationClient rpcli.ConversationClient
msgClient rpcli.MsgClient
userClient *rpcli.UserClient
relationClient *rpcli.RelationClient
groupClient *rpcli.GroupClient
conversationClient *rpcli.ConversationClient
msgClient *rpcli.MsgClient
}

func (x *JSSdk) GetActiveConversations(c *gin.Context) {
Expand Down
6 changes: 4 additions & 2 deletions internal/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, cf
case BestSpeed:
r.Use(gzip.Gzip(gzip.BestSpeed))
}
r.Use(prommetricsGin(), gin.RecoveryWithWriter(gin.DefaultErrorWriter, mw.GinPanicErr), mw.CorsHandler(), mw.GinParseOperationID(), GinParseToken(rpcli.NewAuthClient(authConn)))
j := jssdk.NewJSSdkApi()
r.Use(prommetricsGin(), gin.RecoveryWithWriter(gin.DefaultErrorWriter, mw.GinPanicErr), mw.CorsHandler(),
mw.GinParseOperationID(), GinParseToken(rpcli.NewAuthClient(authConn)))

u := NewUserApi(user.NewUserClient(userConn), client, cfg.Discovery.RpcService)
{
Expand Down Expand Up @@ -280,6 +280,8 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, cf
}

{
j := jssdk.NewJSSdkApi(rpcli.NewUserClient(userConn), rpcli.NewRelationClient(friendConn),
rpcli.NewGroupClient(groupConn), rpcli.NewConversationClient(conversationConn), rpcli.NewMsgClient(msgConn))
jssdk := r.Group("/jssdk")
jssdk.POST("/get_conversations", j.GetConversations)
jssdk.POST("/get_active_conversations", j.GetActiveConversations)
Expand Down
2 changes: 1 addition & 1 deletion internal/msgtransfer/online_history_msg_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewOnlineHistoryRedisConsumerHandler(ctx context.Context, client discovery.
och.redisMessageBatches = b
och.historyConsumerGroup = historyConsumerGroup

return &och, err
return &och, nil
}
func (och *OnlineHistoryRedisConsumerHandler) do(ctx context.Context, channelID int, val *batcher.Msg[sarama.ConsumerMessage]) {
ctx = mcontext.WithTriggerIDContext(ctx, val.TriggerID())
Expand Down

0 comments on commit 36c6b41

Please sign in to comment.