MemberShipDao.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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\MemberShip;
  14. /**
  15. * Class MemberShipDao
  16. * @package app\dao\user\member
  17. */
  18. class MemberShipDao extends BaseDao
  19. {
  20. /**
  21. * 设置模型
  22. * @return string
  23. */
  24. protected function setModel(): string
  25. {
  26. return MemberShip::class;
  27. }
  28. /**
  29. * 后台获取会员卡类型接口
  30. * @param array $where
  31. * @param int $page
  32. * @param int $limit
  33. * @param array $field
  34. * @return \think\Collection
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function getSearchList(array $where, int $page = 0, int $limit = 0, array $field = ['*'])
  40. {
  41. return $this->search($where)->order('sort desc,id desc')
  42. ->field($field)
  43. ->page($page, $limit)
  44. ->select();
  45. }
  46. /**
  47. * 获取会员类型api接口
  48. * @param array $where
  49. * @return mixed
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\DbException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. */
  54. public function getApiList(array $where)
  55. {
  56. return $this->search()->where($where)->order('sort desc')->select()->toArray();
  57. }
  58. }