feature/main20240421
郭嘉 9 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); $hasGoods = GoodsCategoryRel::getcategory($this->storeId,6);
$list = $model->getListPublic($this->request->param()); $list = $model->getListPublic($this->request->param());
print_r($list);die; print_r($hasGoods);die;
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));
} }
} }

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

Loading…
Cancel
Save