获取其他客服列表接口

pull/23/head
taoshihan1991 4 years ago
parent 0b0a69d749
commit b5a51f9704

@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/taoshihan1991/imaptool/models"
"github.com/taoshihan1991/imaptool/tools"
"github.com/taoshihan1991/imaptool/ws"
"strconv"
)
@ -29,6 +30,32 @@ func GetKefuInfoAll(c *gin.Context) {
"result": userinfo,
})
}
func GetOtherKefuList(c *gin.Context) {
idStr, _ := c.Get("kefu_id")
id := idStr.(float64)
result := make([]interface{}, 0)
kefus := models.FindUsers()
for _, kefu := range kefus {
if uint(id) == kefu.ID {
continue
}
item := make(map[string]interface{})
item["name"] = kefu.Name
item["avator"] = kefu.Avator
item["status"] = "offline"
_, ok := ws.KefuList[kefu.Name]
if ok {
item["status"] = "online"
}
result = append(result, item)
}
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",
"result": result,
})
}
func GetKefuInfoSetting(c *gin.Context) {
kefuId := c.Query("kefu_id")
user := models.FindUserById(kefuId)

@ -49,6 +49,7 @@ func InitApiRouter(engine *gin.Engine) {
engine.POST("/kefuinfo", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostKefuInfo)
engine.DELETE("/kefuinfo", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.DeleteKefuInfo)
engine.GET("/kefulist", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetKefuList)
engine.GET("/other_kefulist", middleware.JwtApiMiddleware, controller.GetOtherKefuList)
//角色列表
engine.GET("/roles", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.GetRoleList)
engine.POST("/role", middleware.JwtApiMiddleware, middleware.RbacAuth, controller.PostRole)

Loading…
Cancel
Save