fix: UDM签约cag参数允许为空
This commit is contained in:
@@ -188,10 +188,7 @@ func (s *UDMSubController) Adds(c *gin.Context) {
|
||||
// 发送MML
|
||||
cmd := fmt.Sprintf("baa udmuser:start_imsi=%s,start_msisdn=%s,sub_num=%s,", body.IMSI, body.MSISDN, num)
|
||||
cmd += s.udmSubService.ParseCommandParams(body)
|
||||
// static_ip指给4G UE分配的静态IP,没有可不带此字段名,批量添加IP会自动递增
|
||||
if body.StaticIp != "" {
|
||||
cmd += fmt.Sprintf(",static_ip=%s", body.StaticIp)
|
||||
}
|
||||
// 去除msisdn参数,避免重复
|
||||
omemsisdn := fmt.Sprintf(",msisdn=%s,", body.MSISDN)
|
||||
cmd = strings.Replace(cmd, omemsisdn, ",", 1)
|
||||
data, err := telnet.ConvertToStr(telnetClient, cmd)
|
||||
|
||||
@@ -347,6 +347,7 @@ func (r *UDMSubUser) ParseCommandParams(item model.UDMSubUser) string {
|
||||
if item.ApnContext != "" {
|
||||
conditions = append(conditions, fmt.Sprintf("apn_context=%s", item.ApnContext))
|
||||
}
|
||||
// static_ip指给4G UE分配的静态IP,没有可不带此字段名,批量添加IP会自动递增
|
||||
if item.StaticIp != "" {
|
||||
conditions = append(conditions, fmt.Sprintf("static_ip=%s", item.StaticIp))
|
||||
}
|
||||
@@ -358,8 +359,7 @@ func (r *UDMSubUser) ParseCommandParams(item model.UDMSubUser) string {
|
||||
if item.SmData != "" {
|
||||
conditions = append(conditions, fmt.Sprintf("sm_data=%s", item.SmData))
|
||||
}
|
||||
if item.Cag != "" {
|
||||
conditions = append(conditions, fmt.Sprintf("cag=%s", item.Cag))
|
||||
}
|
||||
conditions = append(conditions, fmt.Sprintf("cag=%s", item.Cag))
|
||||
|
||||
return strings.Join(conditions, ",")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user