diff --git a/config/go-fly.sql b/config/go-fly.sql index 6746b7a..1fd9f19 100644 --- a/config/go-fly.sql +++ b/config/go-fly.sql @@ -61,7 +61,7 @@ CREATE TABLE `user_role` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8| INSERT INTO `user_role` (`id`, `user_id`, `role_id`) VALUE -(1, 1, 2)| +(1, 1, 1)| DROP TABLE IF EXISTS `role`| CREATE TABLE `role` ( @@ -72,7 +72,7 @@ CREATE TABLE `role` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8| INSERT INTO `role` (`id`, `name`, `method`, `path`) VALUES -(1, '普通客服', 'GET', 'GET:/kefuinfo,GET:/kefulist,GET:/roles,POST:/notice_save,POST:/notice')| +(1, '普通客服', '*', '*')| DROP TABLE IF EXISTS `welcome`| CREATE TABLE `welcome` ( @@ -89,7 +89,7 @@ CREATE TABLE `welcome` ( INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`, `keyword`) VALUES (NULL, 'kefu2', '我暂时离线,留言已转发到我的邮箱,稍后回复~', 1, '2020-08-24 02:57:49','offline')| INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`, `keyword`) VALUES -(NULL, 'kefu2', '本客服代码开源,欢迎star,开源地址:https://github.com/taoshihan1991/go-fly', 0, '2020-08-24 02:57:49','welcome')| +(NULL, 'kefu2', '请问有什么可以帮您?', 0, '2020-08-24 02:57:49','welcome')| DROP TABLE IF EXISTS `ipblack`| CREATE TABLE `ipblack` ( diff --git a/static/css/common.css b/static/css/common.css index 67095f1..1e741ef 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -582,4 +582,19 @@ a{color: #07a9fe;text-decoration: none;} } .menuLeftItem:active, .menuLeftItem.active { background: #2b5a96; +} +.chatNotice { + text-align: center; + margin: 12px 0px; +} +.chatNoticeContent { + display: inline-block; + word-break: break-all; + color: rgba(0,0,0,.45); + margin: 0 24px; + max-width: calc(100% - 48px); + background-color: #fff; + border-radius: 16px; + font-size: 12px; + padding: 4px 16px; } \ No newline at end of file diff --git a/static/js/chat-page.js b/static/js/chat-page.js index 690c5c1..51088a8 100644 --- a/static/js/chat-page.js +++ b/static/js/chat-page.js @@ -57,8 +57,7 @@ new Vue({ return; } this.visitor.to_id=msg.id; - this.chatTitle=msg.name+","+GOFLY_LANG[LANG]['chating']; - $(".chatBox").append("
"+this.chatTitle+"
"); + this.showTitle(msg.name+","+GOFLY_LANG[LANG]['chating']); this.scrollBottom(); this.showKfonline=true; } @@ -624,7 +623,7 @@ new Vue({ }); }, showTitle:function(title){ - $(".chatBox").append("
"+title+"
"); + $(".chatBox").append("
"+title+"
"); this.scrollBottom(); }, }, diff --git a/static/templates/chat_page.html b/static/templates/chat_page.html index f26a34d..f287c5c 100644 --- a/static/templates/chat_page.html +++ b/static/templates/chat_page.html @@ -4,7 +4,7 @@ - GO语言开源客服系统-GOFLY + 开源智能在线客服系统 diff --git a/ws/user.go b/ws/user.go index 9d9cae5..d8d31b6 100644 --- a/ws/user.go +++ b/ws/user.go @@ -111,7 +111,8 @@ func SendPingToKefuClient() { kefu.Mux.Lock() defer kefu.Mux.Unlock() err := kefu.Conn.WriteMessage(websocket.TextMessage, str) - if err == nil { + if err != nil { + log.Println("定时发送ping给客服,失败",err.Error()) delete(KefuList, kefuId) } }