diff --git a/app/controller/api/store/product/StoreCategory.php b/app/controller/api/store/product/StoreCategory.php index c20a5ea5..807ef981 100644 --- a/app/controller/api/store/product/StoreCategory.php +++ b/app/controller/api/store/product/StoreCategory.php @@ -12,6 +12,7 @@ namespace app\controller\api\store\product; +use app\common\dao\store\StoreCategoryDao; use think\App; use crmeb\basic\BaseController; use app\common\repositories\store\StoreCategoryRepository as repository; @@ -76,4 +77,18 @@ class StoreCategory extends BaseController ])->order('sort DESC,create_time DESC')->select(); return app('json')->success($data); } + + /** + * @return mixed + */ + public function index() + { + $pid = $this->request->get('pid', 0); + $merId = $this->request->get('mer_id', 0); + /** @var StoreCategoryDao $dao */ + $dao = app()->make(StoreCategoryDao::class); + $data = $dao->children($pid, $merId); + return app('json')->success($data); + } + } diff --git a/route/api.php b/route/api.php index 1379e431..645c5fa0 100644 --- a/route/api.php +++ b/route/api.php @@ -438,6 +438,7 @@ Route::group('api/', function () { Route::get('seckill/detail/:id', 'StoreProductSeckill/detail')->middleware(VisitProductMiddleware::class, 1); Route::get('category/lst', 'StoreCategory/lst'); Route::get('category', 'StoreCategory/children'); + Route::get('category/index', 'StoreCategory/index'); Route::get('brand/lst', 'StoreBrand/lst'); Route::get('detail/:id', 'StoreProduct/detail')->middleware(VisitProductMiddleware::class, 0); Route::get('show/:id', 'StoreProduct/show');