PageLinkServices.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. 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. * @mixin PageLinkDao
  21. */
  22. class PageLinkServices extends BaseServices
  23. {
  24. /**
  25. * PageLinkServices constructor.
  26. * @param PageLinkDao $dao
  27. */
  28. public function __construct(PageLinkDao $dao)
  29. {
  30. $this->dao = $dao;
  31. }
  32. /**
  33. * 获取页面链接
  34. * @param array $where
  35. * @return array
  36. */
  37. public function getLinkList(array $where)
  38. {
  39. [$page, $limit] = $this->getPageValue();
  40. $list = $this->dao->getList($where, '*', $page, $limit);
  41. $count = $this->dao->count($where);
  42. return compact('list', 'count');
  43. }
  44. /**
  45. * 删除
  46. * @param int $id
  47. */
  48. public function del(int $id)
  49. {
  50. $res = $this->dao->delete($id);
  51. if (!$res) throw new AdminException('删除失败');
  52. }
  53. }