feature/main20240421
郭嘉 6 months ago
parent f8e4a65505
commit e6614a38b5
  1. 2
      app/api/controller/Category.php
  2. 8
      app/common/model/GoodsCategoryRel.php

@ -51,7 +51,7 @@ class Category extends Controller
$hasGoods = GoodsCategoryRel::getcategory($this->storeId,6);
$list = $model->getListPublic($this->request->param());
print_r($list);die;
print_r($hasGoods);die;
return $this->renderSuccess(compact('list'));
}
}

@ -52,12 +52,12 @@ class GoodsCategoryRel extends BaseModel
public static function getcategory(int $storeId = null,int $merchantId = null) {
$list = Goods::alias('a')
->join('goods_category_rel b', 'a.goods_id = b.goods_id')
->rightjoin('goods_category_rel b', 'a.goods_id = b.goods_id')
->where([
'a.store_id' => $storeId,
'b.store_id' => $storeId,
'a.merchant_id' => $merchantId
//'b.category_id' => $_GET['category_id']
])->field('b.category_id')->select()->toArray();
])->group('category_id')
->select();
return $list;
}
}

Loading…
Cancel
Save