From d591721e4f3837560f1c965b3df83fc56d6f67e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E5=A3=AB=E6=B6=B5?= <630892807@qq.com> Date: Thu, 10 Dec 2020 22:56:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BF=AB=E6=8D=B7=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/go-fly.sql | 8 ++++++-- controller/reply.go | 11 +++++++++-- models/replys.go | 9 +++++---- router/api.go | 2 +- static/css/common.css | 23 +++++++++++++++++++++++ static/html/chat_main.html | 18 +++++++++++++++--- 6 files changed, 59 insertions(+), 12 deletions(-) diff --git a/config/go-fly.sql b/config/go-fly.sql index 4b0f170..0b1592b 100644 --- a/config/go-fly.sql +++ b/config/go-fly.sql @@ -134,12 +134,16 @@ CREATE TABLE `reply_group` ( `id` int(11) NOT NULL AUTO_INCREMENT, `group_name` varchar(50) NOT NULL DEFAULT '', `user_id` varchar(50) NOT NULL DEFAULT '', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8| DROP TABLE IF EXISTS `reply_item`| CREATE TABLE `reply_item` ( `id` int(11) NOT NULL, `content` varchar(1024) NOT NULL DEFAULT '', `group_id` int(11) NOT NULL DEFAULT '0', - `user_id` int(11) NOT NULL DEFAULT '0' + `user_id` int(11) NOT NULL DEFAULT '0', + `item_name` varchar(50) NOT NULL DEFAULT '', + KEY `user_id` (`user_id`), + KEY `group_id` (`group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8| \ No newline at end of file diff --git a/controller/reply.go b/controller/reply.go index a6b6b93..126e2ca 100644 --- a/controller/reply.go +++ b/controller/reply.go @@ -3,9 +3,16 @@ package controller import ( "github.com/gin-gonic/gin" "github.com/taoshihan1991/imaptool/models" + "log" ) func GetReplys(c *gin.Context) { - kefuId, _ := c.Get("kefu_id") - models.FindReplyByUserId(kefuId) + kefuId, _ := c.Get("kefu_name") + log.Println(kefuId) + res := models.FindReplyByUserId(kefuId) + c.JSON(200, gin.H{ + "code": 200, + "msg": "ok", + "result": res, + }) } diff --git a/models/replys.go b/models/replys.go index 9ae71e0..7bff642 100644 --- a/models/replys.go +++ b/models/replys.go @@ -1,9 +1,10 @@ package models type ReplyItem struct { - Id string `json:"item_id"` - Content string `json:"item_content"` - GroupId string `json:"group_id"` + Id string `json:"item_id"` + Content string `json:"item_content"` + GroupId string `json:"group_id"` + ItemName string `json:"item_name"` } type ReplyGroup struct { Id string `json:"group_id"` @@ -13,6 +14,6 @@ type ReplyGroup struct { func FindReplyByUserId(userId interface{}) ReplyGroup { var replyGroup ReplyGroup - DB.Raw("select a.*,b.* from reply_group a left join reply_items b on a.id=b.group_id where a.user_id=? ", userId).Scan(&replyGroup) + DB.Raw("select a.*,b.* from reply_group a left join reply_item b on a.id=b.group_id where a.user_id=? ", userId).Scan(&replyGroup) return replyGroup } diff --git a/router/api.go b/router/api.go index d5a1d9e..aa6a3ab 100644 --- a/router/api.go +++ b/router/api.go @@ -81,7 +81,7 @@ func InitApiRouter(engine *gin.Engine) { engine.GET("/configs", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetConfigs) engine.POST("/config", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostConfig) engine.GET("/config", controller.GetConfig) - engine.GET("/replys", controller.GetReplys) + engine.GET("/replys", middleware.JwtApiMiddleware, controller.GetReplys) //微信接口 engine.GET("/micro_program", middleware.JwtApiMiddleware, controller.GetCheckWeixinSign) } diff --git a/static/css/common.css b/static/css/common.css index 8fb00c0..a2039f5 100644 --- a/static/css/common.css +++ b/static/css/common.css @@ -225,6 +225,11 @@ .chatLeft .el-tabs__nav,.chatRight .el-tabs__nav { margin-left: 20px; } +.chatRight{ + height: 100%; + overflow: scroll; + overflow: scroll!important; +} .onlineUsers { padding: 5px; height: 40px; @@ -314,4 +319,22 @@ .footContact a{font-size: 12px;color: #999;text-decoration: none;} .chatTime{text-align: center;color: #bbb;margin: 5px 0;font-size: 12px;} .chatTimeHide{display: none;} +.chatRightTitle{ + color: #303133; + height: 40px; + line-height: 40px; + padding-left: 20px; + font-size: 14px; + border-bottom:1px solid #E4E7ED; + background: #E3E3E3; +} +.replyBox{ + padding: 0 10px; + font-size: 12px; + min-height: 300px; +} +.replyItem:hover{ + background-color: #f0f9eb; + color: #67C23A; +} .clear{clear:both;} \ No newline at end of file diff --git a/static/html/chat_main.html b/static/html/chat_main.html index ae7589c..d5648c6 100644 --- a/static/html/chat_main.html +++ b/static/html/chat_main.html @@ -12,8 +12,8 @@