From fab818ed16bc347f71461ab5e4c35c5375b07ae7 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Thu, 22 Oct 2020 19:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E8=B5=84=E6=96=99=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/kefu.go | 9 +++++++++ router/api.go | 2 ++ 2 files changed, 11 insertions(+) diff --git a/controller/kefu.go b/controller/kefu.go index be0e2b1..bc69db5 100644 --- a/controller/kefu.go +++ b/controller/kefu.go @@ -20,6 +20,15 @@ func GetKefuInfo(c *gin.Context) { "result": info, }) } +func GetKefuInfoAll(c *gin.Context) { + id, _ := c.Get("kefu_id") + userinfo := models.FindUserRole("user.avator,user.name,user.id, role.name role_name", id) + c.JSON(200, gin.H{ + "code": 200, + "msg": "验证成功", + "result": userinfo, + }) +} func GetKefuInfoSetting(c *gin.Context) { kefuId := c.Query("kefu_id") user := models.FindUserById(kefuId) diff --git a/router/api.go b/router/api.go index d174a82..21e37e3 100644 --- a/router/api.go +++ b/router/api.go @@ -12,6 +12,8 @@ func InitApiRouter(engine *gin.Engine) { engine.GET("/", controller.Index) engine.POST("/check", controller.LoginCheckPass) engine.POST("/check_auth", middleware.JwtApiMiddleware, controller.MainCheckAuth) + engine.GET("/userinfo", middleware.JwtApiMiddleware, controller.GetKefuInfoAll) + //前后聊天 engine.GET("/chat_server", middleware.Ipblack, controller.NewChatServer) engine.GET("/ws_kefu", middleware.JwtApiMiddleware, ws.NewKefuServer)