ArticleCategory.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * User: Qinii
  4. * Date: 2020-06-05
  5. * Time: 09:41
  6. */
  7. namespace app\controller\api\article;
  8. use think\App;
  9. use app\common\repositories\article\ArticleCategoryRepository as repository;
  10. use crmeb\basic\BaseController;
  11. class ArticleCategory extends BaseController
  12. {
  13. /**
  14. * @var repository
  15. */
  16. protected $repository;
  17. protected $merId;
  18. protected $source;
  19. /**
  20. * StoreBrand constructor.
  21. * @param App $app
  22. * @param repository $repository
  23. */
  24. public function __construct(App $app, repository $repository)
  25. {
  26. parent::__construct($app);
  27. $this->repository = $repository;
  28. $this->source = $this->request->header('source');
  29. $this->merId = $this->request->header('merId');
  30. }
  31. /**
  32. * @return mixed
  33. * @throws \think\db\exception\DataNotFoundException
  34. * @throws \think\db\exception\DbException
  35. * @throws \think\db\exception\ModelNotFoundException
  36. * @author Qinii
  37. */
  38. public function lst()
  39. {
  40. $id = $this->request->param('id') ?? 0;
  41. $where['status']=1;
  42. if($this->source=='yhc'){
  43. $where['mer_id']=$this->merId;
  44. }else{
  45. $where['mer_id']=0;
  46. $where['pid']=$id;
  47. }
  48. return app('json')->success($this->repository->apiGetArtcleCategory($where));
  49. }
  50. }