From 5ed0a4ca03663248d30837f1783c72415ec890b5 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Tue, 16 Mar 2021 15:04:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=90=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ws/ws.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ws/ws.go b/ws/ws.go index 76686af..0fc1f47 100644 --- a/ws/ws.go +++ b/ws/ws.go @@ -126,8 +126,13 @@ func WsServerBackend() { defer message.Mux.Unlock() conn.WriteMessage(websocket.TextMessage, str) case "inputing": - to := typeMsg.Data.(map[string]interface{})["to"].(string) - OneKefuMessage(to, message.content) + data := typeMsg.Data.(map[string]interface{}) + from := data["from"].(string) + to := data["to"].(string) + //限流 + if tools.LimitFreqSingle("inputing:"+from, 1, 2) { + OneKefuMessage(to, message.content) + } } }