DivisionAgentApplyDao.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\dao\agent;
  3. use app\dao\BaseDao;
  4. use app\model\agent\DivisionAgentApply;
  5. class DivisionAgentApplyDao extends BaseDao
  6. {
  7. /**
  8. * 设置模型
  9. * @return string
  10. */
  11. protected function setModel(): string
  12. {
  13. return DivisionAgentApply::class;
  14. }
  15. /**
  16. * 申请代理商列表
  17. * @param array $where
  18. * @param string $field
  19. * @param array $with
  20. * @param int $page
  21. * @param int $limit
  22. * @return array
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\DbException
  25. * @throws \think\db\exception\ModelNotFoundException
  26. */
  27. public function getList(array $where = [], int $page = 0, int $limit = 0, string $field = '*', array $with = [])
  28. {
  29. return $this->search($where)->field($field)->when($with, function ($query) use ($with) {
  30. $query->with($with);
  31. })->when($page && $limit, function ($query) use ($page, $limit) {
  32. $query->page($page, $limit);
  33. })->order('id desc')->select()->toArray();
  34. }
  35. }