feat(tenant): 按租户隔离支付退款与商户配置
This commit is contained in:
@@ -274,17 +274,19 @@ func resolveTenantID(db *gorm.DB, explicitTenantID uint64, userID uint64) uint64
|
||||
if explicitTenantID > 0 {
|
||||
return explicitTenantID
|
||||
}
|
||||
if userID > 0 {
|
||||
var tenantID uint64
|
||||
if err := db.Model(&model.User{}).Select("tenant_id").Where("id = ?", userID).Scan(&tenantID).Error; err == nil && tenantID > 0 {
|
||||
return tenantID
|
||||
}
|
||||
}
|
||||
if tenantID := tenantIDFromDB(db); tenantID > 0 {
|
||||
return tenantID
|
||||
}
|
||||
if userID == 0 {
|
||||
return 0
|
||||
}
|
||||
var tenantID uint64
|
||||
if err := db.Model(&model.User{}).Select("tenant_id").Where("id = ?", userID).Scan(&tenantID).Error; err != nil {
|
||||
return 0
|
||||
}
|
||||
return tenantID
|
||||
return 0
|
||||
}
|
||||
|
||||
func tenantIDFromDB(db *gorm.DB) uint64 {
|
||||
|
||||
Reference in New Issue
Block a user