Compare commits

..

No commits in common. "350a439f89edf52ae6ff4ccc5db3d2011aba6744" and "766b58ae404f13a78f2cf827fc9d82d9a90c82d0" have entirely different histories.

1 changed files with 6 additions and 12 deletions

View File

@ -175,7 +175,6 @@ func SRMessage(c *gin.Context) {
}
}(ws, res, to_user_id)
var status_cnt int
// 从Redis中读取消息并发送到客户端
for {
if v := clients[ws]; v == true {
@ -207,17 +206,12 @@ func SRMessage(c *gin.Context) {
res3, _ = json.Marshal(msg)
}
} else {
if status_cnt > 5 {
//对方不在线
msg.Type = "offline"
msg.Msg = "offline"
msg.From_user_id = -1
msg.Session = res
res3, _ = json.Marshal(msg)
} else {
status_cnt++
}
//对方不在线
msg.Type = "offline"
msg.Msg = "offline"
msg.From_user_id = -1
msg.Session = res
res3, _ = json.Marshal(msg)
}
err2 := ws.WriteMessage(websocket.TextMessage, res3)
if err2 != nil {