SpreadApplyDao.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 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\agent;
  12. use app\dao\BaseDao;
  13. use app\model\agent\SpreadApply;
  14. class SpreadApplyDao extends BaseDao
  15. {
  16. protected function setModel(): string
  17. {
  18. return SpreadApply::class;
  19. }
  20. public function getConditionModel($where)
  21. {
  22. return $this->getModel()->where('is_del', 0)
  23. ->when($where['status'] !== '' && $where['status'] !== 'all', function ($query) use ($where) {
  24. $query->where('status', $where['status']);
  25. })->when($where['keyword'] !== '', function ($query) use ($where) {
  26. $query->whereLike('uid|nickname|real_name|phone', $where['keyword']);
  27. });
  28. }
  29. public function applyList($where, $page = 0, $limit = 0)
  30. {
  31. return $this->getConditionModel($where)->order('id desc')->when($page != 0, function ($query) use ($page, $limit) {
  32. $query->page($page, $limit);
  33. })->select()->toArray();
  34. }
  35. public function applyCount($where)
  36. {
  37. return $this->getConditionModel($where)->count();
  38. }
  39. }