1
0

marge: 合并代码

This commit is contained in:
TsMask
2023-11-28 10:22:37 +08:00
parent 5050f4f113
commit 3df3b5b5f7
18 changed files with 234 additions and 46 deletions

View File

@@ -23,7 +23,8 @@ type UDMAuthImpl struct {
// authDataByRedis UDM鉴权用户
func (r *UDMAuthImpl) authDataByRedis(imsi, neID string) []model.UDMAuth {
arr := []model.UDMAuth{}
ausfArr, err := redis.GetKeys("udmuser", fmt.Sprintf("ausf:%s", imsi))
key := fmt.Sprintf("ausf:%s", imsi)
ausfArr, err := redis.GetKeys("udmuser", key)
if err != nil {
return arr
}
@@ -39,10 +40,8 @@ func (r *UDMAuthImpl) authDataByRedis(imsi, neID string) []model.UDMAuth {
continue
}
status := "0"
if _, ok := m["auth_success"]; ok {
status = "1"
}
status := "1" // 默认给1
amf := ""
if v, ok := m["amf"]; ok {
amf = strings.Replace(v, "\r\n", "", 1)
@@ -166,11 +165,12 @@ func (r *UDMAuthImpl) Delete(neID, imsi string) int64 {
// Insert UDM鉴权用户-删除范围
func (r *UDMAuthImpl) Deletes(neID, imsi, num string) int64 {
prefix := imsi[:len(imsi)-len(num)]
// keys udm-sd:4600001000004*
prefix := imsi[:len(imsi)-len(num)-1]
// 直接删除前缀的记录
r.udmAuthRepository.DeletePrefixImsi(neID, prefix)
// keys ausf:4600001000004*
authArr := r.authDataByRedis(prefix+"*", neID)
if len(authArr) > 0 {
r.udmAuthRepository.DeletePrefixImsi(neID, prefix)
return r.udmAuthRepository.Inserts(authArr)
}
return 0