fix(tenant): 收紧双站后台边界并补齐货架管理

This commit is contained in:
yml
2026-11-15 22:28:40 +08:00
parent a68eb815a9
commit 0cb385d84f
42 changed files with 831 additions and 97 deletions
@@ -21,12 +21,13 @@ func (r *Repository) EnsureAdminOrderCapability(ctx context.Context, orderID uin
return nil
}
var order struct {
BuyerTenantID uint64
SourceTenantID uint64
BuyerTenantID uint64
SourceTenantID uint64
DistributionSiteID *uint64
}
if err := r.db.WithContext(ctx).
Table("rental_orders").
Select("buyer_tenant_id, source_tenant_id").
Select("buyer_tenant_id, source_tenant_id, distribution_site_id").
Where("id = ?", orderID).
Scan(&order).Error; err != nil {
return err
@@ -34,6 +35,9 @@ func (r *Repository) EnsureAdminOrderCapability(ctx context.Context, orderID uin
if order.BuyerTenantID == 0 && order.SourceTenantID == 0 {
return gorm.ErrRecordNotFound
}
if order.DistributionSiteID != nil && *order.DistributionSiteID > 0 {
return gorm.ErrRecordNotFound
}
isBuyer := order.BuyerTenantID == tenantID
isSource := order.SourceTenantID == tenantID
if !isBuyer && !isSource {