fix
This commit is contained in:
parent
932ee1a578
commit
222b9ec155
|
@ -125,13 +125,14 @@ func (w *wsConnectItem) heartbeat() {
|
||||||
case <-w.closeChan:
|
case <-w.closeChan:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
//发送心跳信息
|
|
||||||
b, _ := json.Marshal(rsp)
|
}
|
||||||
if err := w.conn.WriteMessage(websocket.TextMessage, b); err != nil {
|
//发送心跳信息
|
||||||
logx.Error("发送心跳信息异常,关闭连接:", w.flag, err)
|
b, _ := json.Marshal(rsp)
|
||||||
w.close()
|
if err := w.conn.WriteMessage(websocket.TextMessage, b); err != nil {
|
||||||
return
|
logx.Error("发送心跳信息异常,关闭连接:", w.flag, err)
|
||||||
}
|
w.close()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,16 +171,17 @@ func (w *wsConnectItem) readLoop() {
|
||||||
case <-w.closeChan: //如果关闭了
|
case <-w.closeChan: //如果关闭了
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
_, data, err := w.conn.ReadMessage()
|
|
||||||
if err != nil {
|
|
||||||
logx.Error("接受信息错误:", err)
|
|
||||||
//关闭连接
|
|
||||||
w.close()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//消息传入缓冲通道
|
|
||||||
w.inChan <- data
|
|
||||||
}
|
}
|
||||||
|
_, data, err := w.conn.ReadMessage()
|
||||||
|
if err != nil {
|
||||||
|
logx.Error("接受信息错误:", err)
|
||||||
|
//关闭连接
|
||||||
|
w.close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//消息传入缓冲通道
|
||||||
|
w.inChan <- data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if time.Now().Unix()-120 > req.Time || req.Time > time.Now().Unix() {
|
if time.Now().Unix()-120 > req.Time /*|| req.Time > time.Now().Unix() */ {
|
||||||
httpx.OkJsonCtx(r.Context(), w, basic.Response{
|
httpx.OkJsonCtx(r.Context(), w, basic.Response{
|
||||||
Code: basic.CodeRequestParamsErr.Code,
|
Code: basic.CodeRequestParamsErr.Code,
|
||||||
Message: "invalid param,time is expired",
|
Message: "invalid param,time is expired",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user