feat: UDM用户数据添加imsi拓展信息关联
This commit is contained in:
1 parent
01d19134fb
commit
6da5ac6c22
14 files changed
+986
-755
No files matched your search
@@ -23,7 +23,7 @@ import (
|
||||
|
||||
// 实例化控制层 UDMAuthController 结构体
|
||||
var NewUDMAuth = &UDMAuthController{
|
||||
udmAuthService: neDataService.NewUDMAuthImpl,
|
||||
udmAuthService: neDataService.NewUDMAuthUser,
|
||||
neInfoService: neService.NewNeInfoImpl,
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ var NewUDMAuth = &UDMAuthController{
|
||||
// PATH /udm/auth
|
||||
type UDMAuthController struct {
|
||||
// UDM鉴权信息服务
|
||||
udmAuthService neDataService.IUDMAuth
|
||||
udmAuthService *neDataService.UDMAuthUser
|
||||
// 网元信息服务
|
||||
neInfoService neService.INeInfo
|
||||
}
|
||||
@@ -103,26 +103,9 @@ func (s *UDMAuthController) Info(c *gin.Context) {
|
||||
}
|
||||
|
||||
neId = ""
|
||||
u := model.UDMAuth{
|
||||
IMSI: imsi,
|
||||
Amf: data["amf"],
|
||||
Status: "1",
|
||||
Ki: data["ki"],
|
||||
AlgoIndex: data["algo"],
|
||||
Opc: data["opc"],
|
||||
NeId: neId,
|
||||
}
|
||||
|
||||
// 查询imsi存在赋予id用于更新
|
||||
list := s.udmAuthService.SelectList(u)
|
||||
if len(list) > 0 {
|
||||
item := list[0]
|
||||
if item.ID != "" {
|
||||
u.ID = item.ID
|
||||
}
|
||||
}
|
||||
go s.udmAuthService.Insert(neId, u)
|
||||
|
||||
// 解析返回的数据
|
||||
u := s.udmAuthService.ParseInfo(imsi, neId, data)
|
||||
s.udmAuthService.Insert(neId, u)
|
||||
c.JSON(200, result.OkData(u))
|
||||
}
|
||||
|
||||
@@ -137,7 +120,7 @@ func (s *UDMAuthController) Add(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMAuth
|
||||
var body model.UDMAuthUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.IMSI == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
@@ -169,7 +152,7 @@ func (s *UDMAuthController) Add(c *gin.Context) {
|
||||
// 命令ok时
|
||||
if strings.Contains(data, "ok") {
|
||||
neId = ""
|
||||
go s.udmAuthService.Insert(neId, body)
|
||||
s.udmAuthService.Insert(neId, body)
|
||||
}
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
@@ -186,7 +169,7 @@ func (s *UDMAuthController) Adds(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMAuth
|
||||
var body model.UDMAuthUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.IMSI == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
@@ -234,7 +217,7 @@ func (s *UDMAuthController) Edit(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMAuth
|
||||
var body model.UDMAuthUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || body.IMSI == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
@@ -279,7 +262,7 @@ func (s *UDMAuthController) Edit(c *gin.Context) {
|
||||
// 命令ok时
|
||||
if strings.Contains(data, "ok") {
|
||||
neId = ""
|
||||
go s.udmAuthService.Insert(neId, body)
|
||||
s.udmAuthService.Insert(neId, body)
|
||||
}
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
@@ -330,7 +313,7 @@ func (s *UDMAuthController) Remove(c *gin.Context) {
|
||||
// 命令ok时
|
||||
if strings.Contains(data, "ok") {
|
||||
neId = ""
|
||||
go s.udmAuthService.Delete(neId, imsi)
|
||||
s.udmAuthService.Delete(imsi, neId)
|
||||
}
|
||||
resultData[imsi] = data
|
||||
}
|
||||
@@ -402,7 +385,7 @@ func (s *UDMAuthController) Export(c *gin.Context) {
|
||||
}
|
||||
|
||||
neId := ""
|
||||
list := s.udmAuthService.SelectList(model.UDMAuth{NeId: neId})
|
||||
list := s.udmAuthService.SelectList(model.UDMAuthUser{NeId: neId})
|
||||
// 文件名
|
||||
fileName := fmt.Sprintf("udm_auth_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), body.Type)
|
||||
filePath := fmt.Sprintf("%s/%s", file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||
|
||||
Reference in new issue
Block a user