From e3a897e79316a0c893c3766e40a8953e6abe7c3a Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Mon, 6 Jul 2020 14:49:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95=E5=BE=80?= =?UTF-8?q?=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 2 +- controller/chat.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 0755062..889add9 100644 --- a/config/config.go +++ b/config/config.go @@ -8,7 +8,7 @@ import ( "os" ) var( - PageSize uint=2 + PageSize uint=10 ) const Dir = "config/" const AccountConf = Dir + "account.json" diff --git a/controller/chat.go b/controller/chat.go index 4af93ae..65ebc2f 100644 --- a/controller/chat.go +++ b/controller/chat.go @@ -207,6 +207,7 @@ func singleBroadcaster(){ SendKefuOnline(clientMsg, visitor.conn) case "kfChatMessage": json.Unmarshal(msgData, &clientMsg) + models.CreateMessage(clientMsg.Id,clientMsg.ToId,clientMsg.Content,"kefu") guest,ok:=clientList[clientMsg.ToId] if guest==nil||!ok{ continue @@ -226,9 +227,10 @@ func singleBroadcaster(){ } str, _ := json.Marshal(msg) conn.WriteMessage(websocket.TextMessage,str) - models.CreateMessage(clientMsg.Id,clientMsg.ToId,clientMsg.Content,"kefu") + case "chatMessage": json.Unmarshal(msgData, &clientMsg) + models.CreateMessage(clientMsg.ToId,clientMsg.Id,clientMsg.Content,"visitor") conn,ok := kefuList[clientMsg.ToId] if conn==nil||!ok{ continue @@ -246,7 +248,6 @@ func singleBroadcaster(){ } str, _ := json.Marshal(msg) conn.WriteMessage(websocket.TextMessage,str) - models.CreateMessage(clientMsg.ToId,clientMsg.Id,clientMsg.Content,"visitor") } } }