perf: 更新UDM签约数据表,同步数据支持MICO和RAT操作修改

This commit is contained in:
TsMask
2024-10-12 15:26:55 +08:00
parent b5e7317ee7
commit 5dd0ea9143
9 changed files with 311 additions and 230 deletions

View File

@@ -142,7 +142,8 @@ func (s *UDMAuthController) Add(c *gin.Context) {
defer telnetClient.Close()
// 发送MML
cmd := fmt.Sprintf("add authdat:imsi=%s,ki=%s,amf=%s,algo=%s,opc=%s", body.IMSI, body.Ki, body.Amf, body.AlgoIndex, body.Opc)
cmd := fmt.Sprintf("add authdat:imsi=%s,", body.IMSI)
cmd += s.udmAuthService.ParseCommandParams(body)
data, err := telnet.ConvertToStr(telnetClient, cmd)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))
@@ -191,7 +192,8 @@ func (s *UDMAuthController) Adds(c *gin.Context) {
defer telnetClient.Close()
// 发送MML
cmd := fmt.Sprintf("baa authdat:start_imsi=%s,sub_num=%s,ki=%s,amf=%s,algo=%s,opc=%s", body.IMSI, num, body.Ki, body.Amf, body.AlgoIndex, body.Opc)
cmd := fmt.Sprintf("baa authdat:start_imsi=%s,sub_num=%s,", body.IMSI, num)
cmd += s.udmAuthService.ParseCommandParams(body)
data, err := telnet.ConvertToStr(telnetClient, cmd)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))
@@ -239,20 +241,8 @@ func (s *UDMAuthController) Edit(c *gin.Context) {
defer telnetClient.Close()
// 发送MML
cmd := fmt.Sprintf("mod authdata:imsi=%s", body.IMSI)
// 修改的参数名称
if body.Ki != "" {
cmd += fmt.Sprintf(",ki=%s", body.Ki)
}
if body.Amf != "" {
cmd += fmt.Sprintf(",amf=%s", body.Amf)
}
if body.AlgoIndex != "" {
cmd += fmt.Sprintf(",algo=%s", body.AlgoIndex)
}
if body.Opc != "" {
cmd += fmt.Sprintf(",opc=%s", body.Opc)
}
cmd := fmt.Sprintf("mod authdata:imsi=%s,", body.IMSI)
cmd += s.udmAuthService.ParseCommandParams(body)
data, err := telnet.ConvertToStr(telnetClient, cmd)
if err != nil {
c.JSON(200, result.ErrMsg(err.Error()))