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