From d0719dabaa06bb7614cb7a4051c351b8842709b2 Mon Sep 17 00:00:00 2001 From: "630892807@qq.com" <630892807@qq.com> Date: Mon, 8 Mar 2021 21:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=94=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/go-fly.sql | 2 +- ws/user.go | 11 +++++++---- ws/ws.go | 13 ------------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/config/go-fly.sql b/config/go-fly.sql index 3d87dbe..95d45ef 100644 --- a/config/go-fly.sql +++ b/config/go-fly.sql @@ -143,7 +143,7 @@ PRIMARY KEY (`id`), UNIQUE KEY `page` (`page`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8| INSERT INTO `about` (`id`, `title_cn`, `title_en`, `keywords_cn`, `keywords_en`, `desc_cn`, `desc_en`, `css_js`, `html_cn`, `html_en`, `page`) VALUES -(NULL, '免费开源客服系统GOFLY-演示页', 'Simple and Powerful Golang customer live chat-GOFLY-demo', 'GO-FLY,GO-FLY', 'GO-FLY,GO-FLY', 'GO-FLY,GO-FLY,一套为PHP工程师、Golang工程师准备的基于 Vue 2.0的在线客服即时通讯系统', 'GO-FLY,GO-FLY, a Vue 2.0-based online customer service instant messaging system for PHP engineers and Golang engineers', ' ', '
\n
\n

GO-FLY

\n English (United States)\n 中文版 (简体)\n Github\n 客服入口\n 接口文档\n
\n
\n
\n

极简强大的Go语言在线客服系统

\n

GO-FLY,一套为PHP工程师、Golang工程师准备的基于 Vue 2.0的在线客服即时通讯系统

\n
\n
\n \n \n \n
\n
\n
\n

主要技术架构

\n

github.com/dgrijalva/jwt-go

\n

github.com/gin-gonic/gin

\n

github.com/go-sql-driver/mysql

\n

github.com/gobuffalo/packr/v2

\n

github.com/gorilla/websocket

\n

github.com/ipipdotnet/ipdb-go

\n

github.com/jinzhu/gorm

\n

github.com/satori/go.uuid

\n

github.com/spf13/cobra

\n

github.com/swaggo/gin-swagger

\n

github.com/swaggo/swag\n

\n
\n \n
\n\n\n', '
\n
\n

GO-FLY

\n English (United States)\n 中文版 (简体)\n Github\n Agents Here\n API Documents\n
\n
\n

Simple and Powerful Go language online customer chat system

GO-FLY, a Vue 2.0-based online customer service instant messaging system for PHP engineers and Golang engineers

Main technical architecture

github.com/dgrijalva/jwt-go

github.com/gin-gonic/gin

github.com/go-sql-driver/mysql

github.com/gobuffalo/packr/v2

github.com/gorilla/websocket

github.com/ipipdotnet/ipdb-go

github.com/jinzhu/gorm

github.com/satori/go.uuid

github.com/spf13/cobra

github.com/swaggo/gin-swagger

github.com/swaggo/swag

\n\n\n', 'index')| +(NULL, '免费开源客服系统GOFLY0.3.3-演示页', 'Simple and Powerful Golang customer live chat-GOFLY-demo', 'GO-FLY,GO-FLY', 'GO-FLY,GO-FLY', 'GO-FLY,GO-FLY,一套为PHP工程师、Golang工程师准备的基于 Vue 2.0的在线客服即时通讯系统', 'GO-FLY,GO-FLY, a Vue 2.0-based online customer service instant messaging system for PHP engineers and Golang engineers', ' ', '
\n
\n

GO-FLY

\n English (United States)\n 中文版 (简体)\n Github\n 客服入口\n 接口文档\n
\n
\n
\n

极简强大的Go语言在线客服系统

\n

GO-FLY,一套为PHP工程师、Golang工程师准备的基于 Vue 2.0的在线客服即时通讯系统

\n
\n
\n \n \n \n
\n
\n
\n

主要技术架构

\n

github.com/dgrijalva/jwt-go

\n

github.com/gin-gonic/gin

\n

github.com/go-sql-driver/mysql

\n

github.com/gobuffalo/packr/v2

\n

github.com/gorilla/websocket

\n

github.com/ipipdotnet/ipdb-go

\n

github.com/jinzhu/gorm

\n

github.com/satori/go.uuid

\n

github.com/spf13/cobra

\n

github.com/swaggo/gin-swagger

\n

github.com/swaggo/swag\n

\n
\n \n
\n\n\n', '
\n
\n

GO-FLY

\n English (United States)\n 中文版 (简体)\n Github\n Agents Here\n API Documents\n
\n
\n

Simple and Powerful Go language online customer chat system

GO-FLY, a Vue 2.0-based online customer service instant messaging system for PHP engineers and Golang engineers

Main technical architecture

github.com/dgrijalva/jwt-go

github.com/gin-gonic/gin

github.com/go-sql-driver/mysql

github.com/gobuffalo/packr/v2

github.com/gorilla/websocket

github.com/ipipdotnet/ipdb-go

github.com/jinzhu/gorm

github.com/satori/go.uuid

github.com/spf13/cobra

github.com/swaggo/gin-swagger

github.com/swaggo/swag

\n\n\n', 'index')| DROP TABLE IF EXISTS `reply_group`| CREATE TABLE `reply_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, diff --git a/ws/user.go b/ws/user.go index f8cd819..12063ce 100644 --- a/ws/user.go +++ b/ws/user.go @@ -115,14 +115,17 @@ func SuperAdminMessage(str []byte) { //给指定客服发消息 func OneKefuMessage(toId string, str []byte) { //新版 - mKefuConns := KefuList[toId] - if mKefuConns != nil { + mKefuConns, ok := KefuList[toId] + if mKefuConns != nil && ok { + log.Println("OneKefuMessage lock") + Mux.Lock() + defer Mux.Unlock() + log.Println("OneKefuMessage unlock") for _, kefu := range mKefuConns { - Mux.Lock() kefu.Conn.WriteMessage(websocket.TextMessage, str) - Mux.Unlock() } } + SuperAdminMessage(str) } diff --git a/ws/ws.go b/ws/ws.go index c5a616a..4af674a 100644 --- a/ws/ws.go +++ b/ws/ws.go @@ -130,21 +130,8 @@ func WsServerBackend() { conn.WriteMessage(websocket.TextMessage, str) Mux.Unlock() case "inputing": - //msg := TypeMessage{ - // Type: "pong", - //} - //str, _ := json.Marshal(msg) - //var data SimpleMessage - //json.Unmarshal([]byte(typeMsg.Data.(string)),&data) - //log.Println(data) - //from:=typeMsg.Data["from"] to := typeMsg.Data.(map[string]interface{})["to"].(string) - //content:=typeMsg.Data["content"] - log.Println(to) - Mux.Lock() - //conn.WriteMessage(websocket.TextMessage, str) OneKefuMessage(to, message.content) - Mux.Unlock() } }