diff --git a/api/handler/chatimpl/chat_handler.go b/api/handler/chatimpl/chat_handler.go index 90effac7..58fcaa43 100644 --- a/api/handler/chatimpl/chat_handler.go +++ b/api/handler/chatimpl/chat_handler.go @@ -131,6 +131,7 @@ func (h *ChatHandler) ChatHandle(c *gin.Context) { c.Abort() return } + h.Init() // 保存会话连接 h.App.ChatClients.Put(sessionId, client) diff --git a/api/main.go b/api/main.go index cd1e9bda..e1a45534 100644 --- a/api/main.go +++ b/api/main.go @@ -393,9 +393,6 @@ func main() { log.Fatal(err) } }), - fx.Invoke(func(h *chatimpl.ChatHandler) { - h.Init() - }), // 注册生命周期回调函数 fx.Invoke(func(lifecycle fx.Lifecycle, lc *AppLifecycle) { lifecycle.Append(fx.Hook{ diff --git a/web/src/components/mobile/ChatReply.vue b/web/src/components/mobile/ChatReply.vue index 2c46e47e..90e0541a 100644 --- a/web/src/components/mobile/ChatReply.vue +++ b/web/src/components/mobile/ChatReply.vue @@ -15,7 +15,7 @@