CommunityCategory.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 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\community;
  12. use crmeb\basic\BaseController;
  13. use crmeb\traits\CategoresRepository;
  14. use think\App;
  15. use app\validate\admin\StoreCategoryValidate;
  16. use app\common\repositories\community\CommunityCategoryRepository as repository;
  17. use think\exception\ValidateException;
  18. /**
  19. * Class CommunityCategory
  20. * app\controller\api\community
  21. *
  22. */
  23. class CommunityCategory extends BaseController
  24. {
  25. /**
  26. * @var CommunityCategoryRepository
  27. */
  28. protected $repository;
  29. /**
  30. * User constructor.
  31. * @param App $app
  32. * @param $repository
  33. */
  34. public function __construct(App $app, repository $repository)
  35. {
  36. parent::__construct($app);
  37. $this->repository = $repository;
  38. if (!systemConfig('community_status') ) throw new ValidateException('未开启社区功能');
  39. }
  40. /**
  41. * 列表
  42. * @return \think\response\Json
  43. * @author Qinii
  44. * @day 10/27/21
  45. */
  46. public function lst()
  47. {
  48. return app('json')->success($this->repository->getApiList());
  49. }
  50. }