SystemNoticeLogRepository.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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\common\repositories\system\notice;
  12. use app\common\dao\system\notice\SystemNoticeLogDao;
  13. use app\common\repositories\BaseRepository;
  14. /**
  15. * Class SystemNoticeLogRepository
  16. * @package app\common\repositories\system\notice
  17. * @author xaboy
  18. * @day 2020/11/6
  19. * @mixin SystemNoticeLogDao
  20. */
  21. class SystemNoticeLogRepository extends BaseRepository
  22. {
  23. public function __construct(SystemNoticeLogDao $dao)
  24. {
  25. $this->dao = $dao;
  26. }
  27. /**
  28. * 获取通知列表
  29. *
  30. * 根据给定的条件和分页信息,从数据库中检索通知列表。此方法主要用于处理数据的查询和分页逻辑。
  31. *
  32. * @param array $where 查询条件,以键值对形式提供,用于指定查询的过滤条件。
  33. * @param int $page 当前页码,用于指定要返回的页码。
  34. * @param int $limit 每页的记录数,用于指定每页返回的通知数量。
  35. * @return array 返回包含通知数量和通知列表的数组。
  36. */
  37. public function getList(array $where, $page, $limit)
  38. {
  39. // 根据提供的条件进行查询
  40. $query = $this->dao->search($where);
  41. // 统计符合查询条件的通知总数
  42. $count = $query->count();
  43. // 获取指定页码和每页记录数的通知列表,按通知ID降序排列
  44. $list = $query->page($page, $limit)->order('A.notice_log_id DESC')->select();
  45. // 返回包含通知数量和通知列表的数组
  46. return compact('count', 'list');
  47. }
  48. }