fix: export csv file contain tenant name

This commit is contained in:
2024-10-15 10:10:19 +08:00
parent 25232876b0
commit f592f1c544
11 changed files with 39 additions and 4 deletions

View File

@@ -134,6 +134,7 @@ func (s *SMFController) CDRExport(c *gin.Context) {
"H1": "Duration",
"I1": "Invocation Time",
"J1": "PDU Session Charging Information",
"K1": "Tenant Name", // for multi-tenancy
}
// 从第二行开始的数据
dataCells := make([]map[string]any, 0)
@@ -243,6 +244,11 @@ PDU Type: %s
PDU IPv4 Address: %s
PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID, PDU_Type, PDU_IPv4, PDU_IPv6)
}
// Tenant Name
tenantName := ""
if v, ok := cdrJSON["tenantName"]; ok && v != nil {
tenantName = v.(string)
}
dataCells = append(dataCells, map[string]any{
"A" + idx: row.ID,
@@ -255,6 +261,7 @@ PDU IPv6 Addres Swith Prefix: %s`, User_Identifier, SSC_Mode, RAT_Type, DNN_ID,
"H" + idx: duration,
"I" + idx: invocationTimestamp,
"J" + idx: pduSessionChargingInformation,
"K" + idx: tenantName,
})
}