This commit is contained in:
苏尹岚
2020-12-31 09:33:19 +08:00
parent fd6fdd3960
commit 01797b9932
3 changed files with 2 additions and 6 deletions

View File

@@ -120,14 +120,10 @@ func ImMessage(userID string, ws *websocket.Conn) (err error) {
err := ws.ReadJSON(&s)
if err != nil {
globals.SugarLogger.Debugf("页面可能断开啦 ws.ReadJSON error: %v", err.Error())
wsClient.s.RLock()
for k, _ := range wsClient.Clients {
delete(wsClient.Clients[k], userID)
}
wsClient.s.RUnlock()
wsClient.s.Lock()
delete(wsClient.ClientsHeart, userID)
wsClient.s.Unlock()
// delete(clients, ws) //删除map中的客户端
break //结束循环
} else {

View File

@@ -63,7 +63,7 @@ type ImMessageRecord struct {
GroupID int `orm:"column(group_id)" json:"groupID"` //组ID
Content string `orm:"type(text)" json:"content"` //消息内容
MessageType int `json:"messageType"` //消息类型1文字2图片,3音频
Seq int `json:"seq"`
Seq int64 `json:"seq"`
Weight int `json:"weight"`
Height int `json:"height"`
AudioLength string `json:"audioLength"`

View File

@@ -75,8 +75,8 @@ func (c *EventController) TestWebsocket() {
}
globals.SugarLogger.Debugf("TestWebsocket connection...")
}
event.ImMessage(userID, ws)
c.EnableRender = false //Beego不启用渲染
event.ImMessage(userID, ws)
}
// @Title 查询聊天记录