fix: UDM批量操作加载数据根据前缀重载

This commit is contained in:
TsMask
2025-10-11 09:49:49 +08:00
parent 4da212739e
commit 13b2ce3e64
10 changed files with 109 additions and 134 deletions

View File

@@ -124,7 +124,7 @@ func (s *Controller) Add(c *gin.Context) {
var body IMSUser
err := c.ShouldBindBodyWith(&body, binding.JSON)
if err != nil || (len(body.IMSI) < IMSI_MAX_LENGTH && body.Tag == TAG_VoLTE) {
if err != nil || (len(body.IMSI) < IMSI_MAX_LENGTH && body.Tag == 1) {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
@@ -171,7 +171,7 @@ func (s *Controller) Adds(c *gin.Context) {
var body IMSUser
err := c.ShouldBindBodyWith(&body, binding.JSON)
if err != nil || (len(body.IMSI) < IMSI_MAX_LENGTH && body.Tag == TAG_VoLTE) {
if err != nil || (len(body.IMSI) < IMSI_MAX_LENGTH && body.Tag == 1) {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
@@ -215,7 +215,7 @@ func (s *Controller) Edit(c *gin.Context) {
var body IMSUser
err := c.ShouldBindBodyWith(&body, binding.JSON)
if err != nil || (len(body.IMSI) < IMSI_MAX_LENGTH && body.Tag == TAG_VoLTE) {
if err != nil || (len(body.IMSI) < IMSI_MAX_LENGTH && body.Tag == 1) {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
}
@@ -412,7 +412,14 @@ func (s *Controller) Export(c *gin.Context) {
data := [][]string{}
data = append(data, []string{"IMSI", "MSISDN", "Tag", "VNI"})
for _, v := range rows {
data = append(data, []string{v.IMSI, v.MSISDN, v.Tag, v.VNI})
tag := ""
if v.Tag == 0 {
tag = "VoIP"
}
if v.Tag == 1 {
tag = "VoLTE"
}
data = append(data, []string{v.IMSI, v.MSISDN, tag, v.VNI})
}
// 输出到文件
if err := file.WriterFileCSV(data, filePath); err != nil {
@@ -425,7 +432,14 @@ func (s *Controller) Export(c *gin.Context) {
// 转换数据
data := [][]string{}
for _, v := range rows {
data = append(data, []string{v.IMSI, v.MSISDN, v.Tag, v.VNI})
tag := ""
if v.Tag == 0 {
tag = "VoIP"
}
if v.Tag == 1 {
tag = "VoLTE"
}
data = append(data, []string{v.IMSI, v.MSISDN, tag, v.VNI})
}
// 输出到文件
if err := file.WriterFileTXTLine(data, ",", filePath); err != nil {