From 31bebb2b3e40693a3c8613b75bd047f12316cc91 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Tue, 30 Jun 2020 14:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/chat.go | 8 ++++---- server.go | 1 + static/html/chat_main.html | 17 +++++++++++------ static/html/chat_page.html | 2 +- static/images/0.jpg | Bin 0 -> 11212 bytes static/images/1.jpg | Bin 0 -> 5507 bytes static/images/10.jpg | Bin 0 -> 2371 bytes static/images/11.jpg | Bin 0 -> 11916 bytes static/images/12.jpg | Bin 0 -> 8292 bytes static/images/13.jpg | Bin 0 -> 7313 bytes static/images/14.jpg | Bin 0 -> 3876 bytes static/images/2.jpg | Bin 0 -> 4509 bytes static/images/3.jpg | Bin 0 -> 8189 bytes static/images/4.jpg | Bin 0 -> 11527 bytes static/images/5.jpg | Bin 0 -> 11931 bytes static/images/6.jpg | Bin 0 -> 6485 bytes static/images/7.jpg | Bin 0 -> 7630 bytes static/images/8.jpg | Bin 0 -> 5468 bytes static/images/9.jpg | Bin 0 -> 5672 bytes 19 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 static/images/0.jpg create mode 100644 static/images/1.jpg create mode 100644 static/images/10.jpg create mode 100644 static/images/11.jpg create mode 100644 static/images/12.jpg create mode 100644 static/images/13.jpg create mode 100644 static/images/14.jpg create mode 100644 static/images/2.jpg create mode 100644 static/images/3.jpg create mode 100644 static/images/4.jpg create mode 100644 static/images/5.jpg create mode 100644 static/images/6.jpg create mode 100644 static/images/7.jpg create mode 100644 static/images/8.jpg create mode 100644 static/images/9.jpg diff --git a/controller/chat.go b/controller/chat.go index 0ee4fb1..9c416c5 100644 --- a/controller/chat.go +++ b/controller/chat.go @@ -109,7 +109,7 @@ func sendPingToClient() { SendNoticeToAllKefu() } } - time.Sleep(10 * time.Second) + time.Sleep(3 * time.Second) } }() @@ -124,7 +124,7 @@ func sendPingUpdateStatus() { models.UpdateVisitorStatus(visitor.VisitorId,0) } } - time.Sleep(10 * time.Second) + time.Sleep(20 * time.Second) } } //定时推送当前在线用户 @@ -146,7 +146,7 @@ func sendPingOnlineUsers() { for _, kfConn := range kefuList { kfConn.WriteMessage(websocket.TextMessage,str) } - time.Sleep(10 * time.Second) + time.Sleep(3 * time.Second) } } func SendNoticeToAllKefu() { @@ -167,7 +167,7 @@ func SendNoticeToAllKefu() { func singleBroadcaster(){ for { message:=<-message - log.Println("debug:",message) + //log.Println("debug:",message) var typeMsg TypeMessage var clientMsg ClientMessage diff --git a/server.go b/server.go index 3474f06..3f9a71f 100644 --- a/server.go +++ b/server.go @@ -15,6 +15,7 @@ func main() { log.Println("start server...\r\ngo:http://" + baseServer) engine := gin.Default() engine.LoadHTMLGlob("static/html/*") + engine.Static("/static", "./static") //首页 engine.GET("/", controller.Index) //登陆界面 diff --git a/static/html/chat_main.html b/static/html/chat_main.html index 295fcce..e9ca03f 100644 --- a/static/html/chat_main.html +++ b/static/html/chat_main.html @@ -13,8 +13,10 @@