fix(tenant): 收紧双站后台边界并补齐货架管理
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user