refactor: 修改产品分类列表接口加入语言查询条件

This commit is contained in:
2025-02-12 09:40:22 +08:00
parent e660b13ce6
commit cfaa5d5203
2 changed files with 8 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ class ProductCategory
'level',
'is_show'
])
->language(request()->lang_id)
->withSearch(['name_nullable'], [
'name_nullable' => $params['keywords']
])

View File

@@ -22,7 +22,13 @@ class ProductCategoryModel extends ProductCategoryBaseModel
// 根据pid查询
public function scopePid($query, $pid)
{
$query->where('pid', $pid);
$query->where('pid', '=', $pid);
}
// 所属语言查询
public function scopeLanguage($query, $value)
{
$query->where('language_id', '=', $value);
}
// 搜索分类名称