feat: 网元数据CDR和UE事件接口新增查询删除
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"ems.agt/src/framework/i18n"
|
||||
"ems.agt/src/framework/utils/ctx"
|
||||
"ems.agt/src/framework/utils/parse"
|
||||
"ems.agt/src/framework/vo/result"
|
||||
"ems.agt/src/modules/network_data/model"
|
||||
neDataService "ems.agt/src/modules/network_data/service"
|
||||
@@ -28,8 +31,8 @@ type AMFController struct {
|
||||
|
||||
// UE会话列表
|
||||
//
|
||||
// GET /ues
|
||||
func (s *AMFController) UEs(c *gin.Context) {
|
||||
// GET /ue/list
|
||||
func (s *AMFController) UEList(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
var querys model.UEEventQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
@@ -49,3 +52,29 @@ func (s *AMFController) UEs(c *gin.Context) {
|
||||
data := s.ueEventService.SelectPage(querys)
|
||||
c.JSON(200, result.Ok(data))
|
||||
}
|
||||
|
||||
// UE会话删除
|
||||
//
|
||||
// DELETE /ue/:ueIds
|
||||
func (s *AMFController) UERemove(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
ueIds := c.Param("ueIds")
|
||||
if ueIds == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
// 处理字符转id数组后去重
|
||||
ids := strings.Split(ueIds, ",")
|
||||
uniqueIDs := parse.RemoveDuplicates(ids)
|
||||
if len(uniqueIDs) <= 0 {
|
||||
c.JSON(200, result.Err(nil))
|
||||
return
|
||||
}
|
||||
rows, err := s.ueEventService.DeleteByIds(uniqueIDs)
|
||||
if err != nil {
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
msg := i18n.TTemplate(language, "app.common.deleteSuccess", map[string]any{"num": rows})
|
||||
c.JSON(200, result.OkMsg(msg))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user