feat: UDM鉴权导出格式修改,权限控制

This commit is contained in:
TsMask
2025-09-23 10:48:41 +08:00
parent 1ab2d97756
commit d60bb0d3d4
3 changed files with 18 additions and 4 deletions

View File

@@ -485,15 +485,21 @@ func (s *UDMAuthController) Export(c *gin.Context) {
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
if fileType == "csv" {
// 转换数据
// 转换数据 imsi,ki,algo,amf,opc,create_time
data := [][]string{}
data = append(data, []string{"imsi", "ki", "algo", "amf", "opc"})
data = append(data, []string{"imsi", "ki", "algo", "amf", "opc", "create_time"})
for _, v := range rows {
opc := v.Opc
if opc == "-" {
opc = ""
}
data = append(data, []string{v.IMSI, v.Ki, v.AlgoIndex, v.Amf, opc})
createTime := ""
if v.CreateTime == 0 {
createTime = time.Now().Format(time.RFC3339)
} else {
createTime = time.UnixMilli(v.CreateTime).Format(time.RFC3339)
}
data = append(data, []string{v.IMSI, v.Ki, v.AlgoIndex, v.Amf, opc, createTime})
}
// 输出到文件
err := file.WriterFileCSV(data, filePath)
@@ -511,7 +517,13 @@ func (s *UDMAuthController) Export(c *gin.Context) {
if opc == "-" {
opc = ""
}
data = append(data, []string{v.IMSI, v.Ki, v.AlgoIndex, v.Amf, opc})
createTime := ""
if v.CreateTime == 0 {
createTime = time.Now().Format(time.RFC3339)
} else {
createTime = time.UnixMilli(v.CreateTime).Format(time.RFC3339)
}
data = append(data, []string{v.IMSI, v.Ki, v.AlgoIndex, v.Amf, opc, createTime})
}
// 输出到文件