merge: main to multi-tenant

This commit is contained in:
2024-06-28 13:53:17 +08:00
parent 9bcaf996bb
commit 2aeaffb48f
10 changed files with 192 additions and 99 deletions

View File

@@ -250,10 +250,11 @@ func (r *UDMSubImpl) DeletePrefixByIMSI(neId, imsi string) int64 {
func (r *UDMSubImpl) SetTenantID(subArr *[]model.UDMSub) {
for s := 0; s < len(*subArr); s++ {
var tenantID []string
err := dborm.DefaultDB().Table("sys_tenant").
Where("status='1' and tenancy_type='IMSI' and ? like tenancy_key", (*subArr)[s].Imsi).Cols("parent_id").Distinct().Find(&tenantID)
err := datasource.DefaultDB().Table("sys_tenant").
Where("status='1' and tenancy_type='IMSI' and ? like tenancy_key", (*subArr)[s].IMSI).
Select("parent_id").Distinct().Find(&tenantID)
if err != nil {
log.Errorf("Find tenant_id err => %v", err)
logger.Errorf("Find tenant_id err => %v", err)
continue
}
if len(tenantID) > 0 {