超管获取在线用户

pull/23/head
taoshihan1991 4 years ago
parent fad3b1f75b
commit 811035cef2

@ -170,19 +170,19 @@ func SendMessageV2(c *gin.Context) {
}
str, _ := json.Marshal(msg)
conn.WriteMessage(websocket.TextMessage, str)
msg = TypeMessage{
Type: "message",
Data: ClientMessage{
Name: kefuInfo.Nickname,
Avator: kefuInfo.Avator,
Id: vistorInfo.VisitorId,
Time: time.Now().Format("2006-01-02 15:04:05"),
ToId: vistorInfo.VisitorId,
Content: content,
},
}
str2, _ := json.Marshal(msg)
ws.SuperAdminMessage(str2)
//msg = TypeMessage{
// Type: "message",
// Data: ClientMessage{
// Name: kefuInfo.Nickname,
// Avator: kefuInfo.Avator,
// Id: vistorInfo.VisitorId,
// Time: time.Now().Format("2006-01-02 15:04:05"),
// ToId: vistorInfo.VisitorId,
// Content: content,
// },
//}
//str2, _ := json.Marshal(msg)
//ws.SuperAdminMessage(str2)
}
if cType == "visitor" {

@ -225,10 +225,11 @@ func GetVisitorOnlines(c *gin.Context) {
// @Router /visitors_kefu_online [get]
func GetKefusVisitorOnlines(c *gin.Context) {
kefuName, _ := c.Get("kefu_name")
roleId, _ := c.Get("kefu_id")
users := make([]*VisitorOnline, 0)
visitorIds := make([]string, 0)
for uid, visitor := range ws.ClientList {
if visitor.To_id != kefuName {
if visitor.To_id != kefuName && roleId.(float64) != 2 {
continue
}
userInfo := new(VisitorOnline)

Loading…
Cancel
Save