CategoryController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\api\controller\v1\store;
  12. use app\services\product\product\StoreCategoryServices;
  13. use think\Request;
  14. /**
  15. * Class CategoryController
  16. * @package app\api\controller\v1\store
  17. */
  18. class CategoryController
  19. {
  20. protected $services;
  21. public function __construct(StoreCategoryServices $services)
  22. {
  23. $this->services = $services;
  24. }
  25. /**
  26. * 获取分类列表
  27. * @param Request $request
  28. * @return mixed
  29. * @throws \think\db\exception\DataNotFoundException
  30. * @throws \think\db\exception\DbException
  31. * @throws \think\db\exception\ModelNotFoundException
  32. */
  33. public function category(Request $request)
  34. {
  35. $where = $request->getMore([
  36. ['pid', 0],
  37. ]);
  38. $category = $this->services->getCategory($where);
  39. return app('json')->success($category);
  40. }
  41. /**
  42. * @return mixed
  43. * @author 等风来
  44. * @email 136327134@qq.com
  45. * @date 2022/11/11
  46. */
  47. public function getCategoryVersion()
  48. {
  49. $data = $this->services->getCategoryVersion();
  50. return app('json')->success(['version' => $data['version'], 'is_diy' => $data['is_diy']]);
  51. }
  52. }