CategoryController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\api\v1\store;
  12. use app\services\product\category\StoreProductCategoryServices;
  13. use think\Request;
  14. /**
  15. * Class CategoryController
  16. * @package app\controller\api\v1\store
  17. */
  18. class CategoryController
  19. {
  20. protected $services;
  21. public function __construct(StoreProductCategoryServices $services)
  22. {
  23. $this->services = $services;
  24. }
  25. /**
  26. * 获取分类列表
  27. * @return mixed
  28. */
  29. public function category(Request $request)
  30. {
  31. $where = $request->getMore([
  32. ['pid', 0],
  33. ]);
  34. $category = $this->services->getCategory($where);
  35. return app('json')->success($category);
  36. }
  37. }