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)