PageLinkServices.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. declare (strict_types=1);
  12. namespace app\services\diy;
  13. use app\services\BaseServices;
  14. use app\dao\diy\PageLinkDao;
  15. use crmeb\exceptions\AdminException;
  16. /**
  17. *
  18. * Class DiyServices
  19. * @package app\services\diy
  20. */
  21. class PageLinkServices extends BaseServices
  22. {
  23. /**
  24. * PageLinkServices constructor.
  25. * @param PageLinkDao $dao
  26. */
  27. public function __construct(PageLinkDao $dao)
  28. {
  29. $this->dao = $dao;
  30. }
  31. /**
  32. * 获取页面链接
  33. * @param array $where
  34. * @return array
  35. */
  36. public function getLinkList(array $where)
  37. {
  38. [$page, $limit] = $this->getPageValue();
  39. $list = $this->dao->getList($where, '*', $page, $limit);
  40. $count = $this->dao->count($where);
  41. return compact('list', 'count');
  42. }
  43. /**
  44. * 删除
  45. * @param int $id
  46. */
  47. public function del(int $id){
  48. $res = $this->dao->delete($id);
  49. if (!$res) throw new AdminException(100008);
  50. }
  51. }