MemberRightDao.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\dao\user\member;
  12. use app\dao\BaseDao;
  13. use app\model\user\member\MemberRight;
  14. /**
  15. * Class MemberRightDao
  16. * @package app\dao\user\member
  17. */
  18. class MemberRightDao extends BaseDao
  19. {
  20. /** 设置模型
  21. * @return string
  22. */
  23. protected function setModel(): string
  24. {
  25. return MemberRight::class;
  26. }
  27. /**获取会员权益接口
  28. * @param array $where
  29. * @param int $page
  30. * @param int $limit
  31. * @param array $field
  32. * @return \think\Collection
  33. * @throws \think\db\exception\DataNotFoundException
  34. * @throws \think\db\exception\DbException
  35. * @throws \think\db\exception\ModelNotFoundException
  36. */
  37. public function getSearchList(array $where, int $page = 0, int $limit = 0, array $field = ['*'])
  38. {
  39. return $this->search($where)->order('sort desc,id desc')
  40. ->field($field)
  41. ->when($page && $limit, function ($query) use ($page, $limit) {
  42. $query->page($page, $limit);
  43. })
  44. ->select()->toArray();
  45. }
  46. }