// +---------------------------------------------------------------------- namespace app\api\controller\v1\store; use app\services\product\product\StoreCategoryServices; use think\Request; /** * Class CategoryController * @package app\api\controller\v1\store */ class CategoryController { protected $services; public function __construct(StoreCategoryServices $services) { $this->services = $services; } /** * 获取分类列表 * @param Request $request * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function category(Request $request) { $where = $request->getMore([ ['pid', 0], ]); $category = $this->services->getCategory($where); return app('json')->success($category); } /** * @return mixed * @author 等风来 * @email 136327134@qq.com * @date 2022/11/11 */ public function getCategoryVersion() { $data = $this->services->getCategoryVersion(); return app('json')->success(['version' => $data['version'], 'is_diy' => $data['is_diy']]); } }