feature/main20240421
郭嘉 8 months ago
parent 15438984a4
commit f98a278724
  1. 12
      app/api/controller/Category.php
  2. 11
      app/common/model/GoodsCategoryRel.php

@ -12,6 +12,7 @@ declare (strict_types=1);
namespace app\api\controller;
use app\common\model\GoodsCategoryRel;
use think\response\Json;
use app\api\model\Category as CategoryModel;
@ -42,4 +43,15 @@ class Category extends Controller
$list = $model->getChildrenList($this->request->param());
return $this->renderSuccess(compact('list'));
}
public function listmerchant(): Json
{
$model = new CategoryModel;
$hasGoods = GoodsCategoryRel::getcategory($this->storeId,$this->merchantId);
$list = $model->getListPublic($this->request->param());
print_r($list);die;
return $this->renderSuccess(compact('list'));
}
}

@ -48,4 +48,15 @@ class GoodsCategoryRel extends BaseModel
}
return (new static)->addAll($dataset);
}
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')
->where([
'a.store_id' => $storeId,
'a.merchant_id' => $merchantId
//'b.category_id' => $_GET['category_id']
])->field('b.category_id')->select()->toArray();
return $list;
}
}

Loading…
Cancel
Save