feat: support rest data return channel result

This commit is contained in:
zhangsz
2025-04-10 15:46:09 +08:00
parent a1eaaaebd7
commit a00a7da016
7 changed files with 88 additions and 74 deletions

View File

@@ -200,3 +200,14 @@ func (r *UDMAuthUser) ParseCommandParams(item model.UDMAuthUser) string {
}
return strings.Join(conditions, ",")
}
// ResetDataWithResult 重置鉴权用户数据清空数据库重新同步Redis数据
// 通过 channel 返回 ClearAndInsert 的执行结果
func (r *UDMAuthUser) ResetDataWithResult(neId string) chan int64 {
arr := r.dataByRedis("*", neId)
resultCh := make(chan int64, 1)
go func() {
resultCh <- r.udmAuthRepository.ClearAndInsert(neId, arr)
}()
return resultCh
}

View File

@@ -362,3 +362,14 @@ func (r *UDMSubUser) ParseCommandParams(item model.UDMSubUser) string {
conditions = append(conditions, fmt.Sprintf("cag=%s", item.Cag))
return strings.Join(conditions, ",")
}
// ResetDataWithResult 重置鉴权用户数据清空数据库重新同步Redis数据
// 通过 channel 返回 ClearAndInsert 的执行结果
func (r *UDMSubUser) ResetDataWithResult(neId string) chan int64 {
arr := r.dataByRedis("*", neId)
resultCh := make(chan int64, 1)
go func() {
resultCh <- r.udmSubRepository.ClearAndInsert(neId, arr)
}()
return resultCh
}