添加用户发送消息保存

This commit is contained in:
junleea 2025-03-22 17:26:21 +08:00
parent b81ab8412d
commit 1c578fb597
1 changed files with 5 additions and 1 deletions

View File

@ -115,7 +115,6 @@ func subscribeAndHandleIMMessages(ws *websocket.Conn, userId int) {
} else {
sessionName = data.Msg
}
err, sessionID = service.CreateSession(userId, sessionName)
log.Println("create session id:", sessionID)
if err != nil {
@ -123,6 +122,11 @@ func subscribeAndHandleIMMessages(ws *websocket.Conn, userId int) {
return
}
}
//将消息存入数据库
err, _ = service.CreateMessage(1, int(sessionID), userId, 2, data.Msg, 1)
if err != nil {
return
} //机器人id为2,消息类型为1,状态为1
//需要后续处理
err, _ = service.WSReceiveMessageService(userId, int(sessionID), chanel, data)
if err != nil {