fix: pc header修复产品分类关联推荐产品未过滤已禁用的
Some checks failed
Gitea Actions Official-website / deploy-dev (push) Failing after 3s

This commit is contained in:
2026-04-15 14:05:56 +08:00
parent cf670b24f8
commit 4b5dae8714
2 changed files with 6 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ abstract class Common extends BaseController
])
->when($with_recommends, function($query) {
$query->with(['recommends' => function($query) {
$query->field(['id', 'category_id', 'title', 'image', 'desc', 'link'])
$query->field(['id', 'category_id', 'title', 'image', 'desc', 'link'])->disabled(false)
->order(['sort' => 'asc', 'id' => 'desc']);
}]);
})

View File

@@ -22,4 +22,9 @@ class ProductCategoryRecommendModel extends ProductCategoryRecommendBaseModel
{
$query->where($this->getTable() . '.language_id', '=', $language);
}
public function scopeDisabled($query, $disabled = true)
{
$query->where($this->getTable() . '.disabled', '=', (int)$disabled);
}
}