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
@@ -18,7 +18,10 @@ func (r *Repository) FindTenantOffer(ctx context.Context, listingID uint64) (*Te
return nil, ErrTenantRequired
}
var listing model.RentalListing
if err := r.db.WithContext(ctx).Select("id, price_cent").First(&listing, listingID).Error; err != nil {
if err := r.db.WithContext(ctx).
Select("id, price_cent").
Where("id = ? AND (distribution_site_id IS NULL OR distribution_site_id = 0)", listingID).
First(&listing).Error; err != nil {
return nil, err
}
var offer model.TenantListingOffer
@@ -50,7 +53,10 @@ func (r *Repository) UpdateTenantOffer(
return nil, ErrInvalidPrice
}
var listing model.RentalListing
if err := r.db.WithContext(ctx).Select("id, price_cent").First(&listing, listingID).Error; err != nil {
if err := r.db.WithContext(ctx).
Select("id, price_cent").
Where("id = ? AND (distribution_site_id IS NULL OR distribution_site_id = 0)", listingID).
First(&listing).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, ErrListingNotFound
}