fix: not reload for batch add & delete failed imsi length < 15
This commit is contained in:
@@ -192,7 +192,10 @@ func (s *IMSUserController) Adds(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
// 命令ok时
|
||||
if strings.Contains(data, "ok") {
|
||||
s.imsUserService.LoadData(neId, body.IMSI, num)
|
||||
}
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
|
||||
@@ -206,7 +209,7 @@ func (s *IMSUserController) Edit(c *gin.Context) {
|
||||
|
||||
var body model.IMSUser
|
||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||
if err != nil || len(body.IMSI) < model.IMSI_MAX_LENGTH {
|
||||
if err != nil || (len(body.IMSI) < model.IMSI_MAX_LENGTH && body.Tag == model.TAG_VoLTE) {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
@@ -246,7 +249,7 @@ func (s *IMSUserController) Remove(c *gin.Context) {
|
||||
language := ctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
imsi := c.Param("imsi")
|
||||
if neId == "" || len(imsi) < model.IMSI_MAX_LENGTH {
|
||||
if neId == "" || imsi == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
@@ -297,7 +300,7 @@ func (s *IMSUserController) Removes(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
imsi := c.Param("imsi")
|
||||
num := c.Param("num")
|
||||
if neId == "" || len(imsi) < model.IMSI_MAX_LENGTH || num == "" {
|
||||
if neId == "" || imsi == "" || num == "" {
|
||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"be.ems/features/ue/model"
|
||||
"be.ems/features/ue/service"
|
||||
"be.ems/src/framework/constants/uploadsubpath"
|
||||
"be.ems/src/framework/i18n"
|
||||
"be.ems/src/framework/telnet"
|
||||
@@ -14,24 +16,22 @@ import (
|
||||
"be.ems/src/framework/utils/parse"
|
||||
"be.ems/src/framework/vo/result"
|
||||
neService "be.ems/src/modules/network_element/service"
|
||||
"be.ems/features/ue/service"
|
||||
"be.ems/features/ue/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
// 实例化控制层 VoIPAuthController 结构体
|
||||
var NewVoIPAuthController = &VoIPAuthController{
|
||||
voipAuthService: service.NewVoIPAuthService,
|
||||
neInfoService: neService.NewNeInfo,
|
||||
voipAuthService: service.NewVoIPAuthService,
|
||||
neInfoService: neService.NewNeInfo,
|
||||
}
|
||||
|
||||
// IMS用户信息 控制层处理
|
||||
//
|
||||
// @Description IMS用户信息 控制层处理
|
||||
type VoIPAuthController struct {
|
||||
voipAuthService *service.VoIPAuthService // VoIP Auth信息服务
|
||||
neInfoService *neService.NeInfo // 网元信息服务
|
||||
voipAuthService *service.VoIPAuthService // VoIP Auth信息服务
|
||||
neInfoService *neService.NeInfo // 网元信息服务
|
||||
}
|
||||
|
||||
func (s *VoIPAuthController) ResetData(c *gin.Context) {
|
||||
@@ -46,7 +46,6 @@ func (s *VoIPAuthController) ResetData(c *gin.Context) {
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
|
||||
|
||||
func (s *VoIPAuthController) List(c *gin.Context) {
|
||||
querys := ctx.QueryMap(c)
|
||||
// querys["userName"] = ctx.LoginUserToUserName(c)
|
||||
@@ -183,7 +182,7 @@ func (s *VoIPAuthController) Adds(c *gin.Context) {
|
||||
defer telnetClient.Close()
|
||||
|
||||
// 发送MML
|
||||
cmd := fmt.Sprintf("baa voip:start_username=%s,password=%s,sub_num=%s,",
|
||||
cmd := fmt.Sprintf("baa voip:start_username=%s,password=%s,sub_num=%s,",
|
||||
body.UserName, body.Password, num)
|
||||
cmd += s.voipAuthService.ParseCommandParams(body)
|
||||
data, err := telnet.ConvertToStr(telnetClient, cmd)
|
||||
@@ -191,7 +190,10 @@ func (s *VoIPAuthController) Adds(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
// 命令ok时
|
||||
if strings.Contains(data, "ok") {
|
||||
s.voipAuthService.LoadData(neId, body.UserName, num)
|
||||
}
|
||||
c.JSON(200, result.OkData(data))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user