feat: ue事件推入ws

This commit is contained in:
TsMask
2024-01-26 17:35:17 +08:00
parent c3b76462b1
commit 37ebadd487
2 changed files with 15 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ import (
"ems.agt/lib/global"
"ems.agt/lib/log"
"ems.agt/lib/services"
wsService "ems.agt/src/modules/ws/service"
"github.com/gin-gonic/gin"
)
@@ -17,12 +18,12 @@ var (
)
type UEEvent struct {
NeType string `json:"-" xorm:"ne_type"`
NeName string `json:"-" xorm:"ne_name"`
RmUID string `json:"-" xorm:"rm_uid"`
Timestamp int `json:"-" xorm:"timestamp"`
EventType string `json:"-" xorm:"event_type"`
EventJson map[string]any `json:"-" xorm:"event_json"`
NeType string `json:"neType" xorm:"ne_type"`
NeName string `json:"neName" xorm:"ne_name"`
RmUID string `json:"rmUID" xorm:"rm_uid"`
Timestamp int `json:"timestamp" xorm:"timestamp"`
EventType string `json:"eventType" xorm:"event_type"`
EventJson map[string]any `json:"eventJSON" xorm:"event_json"`
}
func PostUEEventFromAMF(c *gin.Context) {
@@ -61,5 +62,8 @@ func PostUEEventFromAMF(c *gin.Context) {
return
}
// 推送到ws订阅组
wsService.NewWSSendImpl.ByGroupID(wsService.GROUP_UE, ueEvent)
services.ResponseStatusOK204NoContent(c.Writer)
}

View File

@@ -12,9 +12,11 @@ const (
// 组号-其他
GROUP_OTHER = "0"
// 组号-指标
GROUP_KPI = "1000"
// 组号-会话记录
GROUP_KPI = "1"
// 组号-CDR会话事件-IMS
GROUP_CDR = "1005"
// 组号-UE会话事件-AMF
GROUP_UE = "1010"
)
// 实例化服务层 WSSendImpl 结构体
@@ -63,7 +65,7 @@ func (s *WSSendImpl) ByGroupID(groupID string, data any) error {
uidClientIds := clientIds.(*[]string)
for _, clientId := range *uidClientIds {
err := s.ByClientID(clientId, map[string]any{
"groupID": groupID,
"groupId": groupID,
"data": data,
})
if err != nil {