CategoryServices.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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\services\other;
  12. use app\dao\other\CategoryDao;
  13. use app\services\BaseServices;
  14. use crmeb\traits\ServicesTrait;
  15. /**
  16. * Class CategoryServices
  17. * @package app\services\other
  18. * @mixin CategoryDao
  19. */
  20. class CategoryServices extends BaseServices
  21. {
  22. use ServicesTrait;
  23. protected $cacheName = 'crmeb_cate';
  24. /**
  25. * CategoryServices constructor.
  26. * @param CategoryDao $dao
  27. */
  28. public function __construct(CategoryDao $dao)
  29. {
  30. $this->dao = $dao;
  31. }
  32. /**
  33. * 获取分类列表
  34. * @param array $where
  35. * @return array
  36. * @throws \think\db\exception\DataNotFoundException
  37. * @throws \think\db\exception\DbException
  38. * @throws \think\db\exception\ModelNotFoundException
  39. */
  40. public function getCateList(array $where = [], array $field = ['*'], array $with = [])
  41. {
  42. [$page, $limit] = $this->getPageValue();
  43. $data = $this->dao->getCateList($where, $page, $limit, $field, $with);
  44. $count = $this->dao->count($where);
  45. return compact('data', 'count');
  46. }
  47. /**桌码管理
  48. * @param array $where
  49. * @param array $field
  50. * @param array $with
  51. * @return array
  52. * @throws \think\db\exception\DataNotFoundException
  53. * @throws \think\db\exception\DbException
  54. * @throws \think\db\exception\ModelNotFoundException
  55. */
  56. public function getTableCodeCateList(array $where = [], array $field = ['*'], array $with = [])
  57. {
  58. $data = $this->dao->getCateList($where, 0, 0, $field, $with);
  59. return $data;
  60. }
  61. }