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

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

View File

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

View File

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