style: UDM用户数据导出文件带createTime字段
This commit is contained in:
@@ -499,13 +499,19 @@ func (s *UDMAuthController) Export(c *gin.Context) {
|
||||
if fileType == "csv" {
|
||||
// 转换数据
|
||||
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})
|
||||
}
|
||||
// 输出到文件
|
||||
if err := file.WriterFileCSV(data, filePath); err != nil {
|
||||
@@ -522,7 +528,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})
|
||||
}
|
||||
// 输出到文件
|
||||
if err := file.WriterFileTXTLine(data, ",", filePath); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user