ass
This commit is contained in:
@@ -973,17 +973,20 @@ func (a *App) connectWS() {
|
||||
case "stop_webcam_stream":
|
||||
runtime.EventsEmit(a.ctx, "stop_webcam_stream")
|
||||
case "chat:message":
|
||||
if staffVal, ok := msg.Data["staffId"].(float64); ok {
|
||||
a.mu.Lock()
|
||||
a.replyStaffID = uint(staffVal)
|
||||
a.chatUnread++
|
||||
unread := a.chatUnread
|
||||
a.mu.Unlock()
|
||||
runtime.EventsEmit(a.ctx, "chat:notify", map[string]any{
|
||||
"unread": unread,
|
||||
"preview": msg.Data["body"],
|
||||
"from": msg.Data["staffName"],
|
||||
})
|
||||
senderRole, _ := msg.Data["senderRole"].(string)
|
||||
if senderRole == "staff" {
|
||||
if staffVal, ok := msg.Data["staffId"].(float64); ok {
|
||||
a.mu.Lock()
|
||||
a.replyStaffID = uint(staffVal)
|
||||
a.chatUnread++
|
||||
unread := a.chatUnread
|
||||
a.mu.Unlock()
|
||||
runtime.EventsEmit(a.ctx, "chat:notify", map[string]any{
|
||||
"unread": unread,
|
||||
"preview": msg.Data["body"],
|
||||
"from": msg.Data["staffName"],
|
||||
})
|
||||
}
|
||||
}
|
||||
runtime.EventsEmit(a.ctx, "chat:message", msg.Data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user