|
@@ -139,14 +139,14 @@ class Product extends Base
|
|
|
$by = input('by', 'weigh');
|
|
|
$desc = input('desc', 'desc');
|
|
|
|
|
|
- $sid = input('sid'); // 二级分类Id
|
|
|
+// $sid = input('sid'); // 二级分类Id
|
|
|
$fid = input('fid'); // 一级分类Id
|
|
|
|
|
|
$keyword = input('keyword','');//搜索
|
|
|
|
|
|
$productModel = new productModel();
|
|
|
|
|
|
- if ($fid && !$sid) {
|
|
|
+ /* if ($fid && !$sid) {
|
|
|
$categoryModel = new \addons\unishop\model\Category();
|
|
|
$sArr = $categoryModel->where('pid', $fid)->field('id')->select();
|
|
|
$sArr = array_column($sArr, 'id');
|
|
@@ -154,7 +154,9 @@ class Product extends Base
|
|
|
$productModel->where('category_id', 'in', $sArr);
|
|
|
} else {
|
|
|
$sid && $productModel->where(['category_id' => $sid]);
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ $fid && $productModel->where(['category_id' => $fid]);
|
|
|
|
|
|
if(!empty($keyword)){
|
|
|
$productModel->where('title', 'LIKE', '%'.$keyword.'%');
|