TenantRegisterLists.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\model\tenant\TenantRegister;
  4. use app\common\lists\ListsSearchInterface;
  5. use app\workerapi\logic\SaleLogic;
  6. /**
  7. * TenantRegister列表
  8. * Class TenantRegisterLists
  9. * @package app\workerapi\lists
  10. */
  11. class TenantRegisterLists extends BaseWorkerDataLists implements ListsSearchInterface
  12. {
  13. /**
  14. * @notes 设置搜索条件
  15. * @return \string[][]
  16. * @author likeadmin
  17. * @date 2025/02/25 09:29
  18. */
  19. public function setSearch(): array
  20. {
  21. $sale_id = SaleLogic::getSaleIdByToken($this->params['sale_token']??'00000');
  22. $this->params['sale_id'] = $sale_id;
  23. return [
  24. '=' => ['door_images', 'business_images', 'province', 'city', 'area_name', 'lon', 'lat', 'status', 'sale_id', 'openid'],
  25. '%like%' => ['name', 'head_name','mobile'],
  26. ];
  27. }
  28. /**
  29. * @notes 获取列表
  30. * @return array
  31. * @throws \think\db\exception\DataNotFoundException
  32. * @throws \think\db\exception\DbException
  33. * @throws \think\db\exception\ModelNotFoundException
  34. * @author likeadmin
  35. * @date 2025/02/25 09:29
  36. */
  37. public function lists(): array
  38. {
  39. return TenantRegister::with(['sale'])->where($this->searchWhere)
  40. ->field(['*'])
  41. ->limit($this->limitOffset, $this->limitLength)
  42. ->order(['id' => 'desc'])
  43. ->select()
  44. ->toArray();
  45. }
  46. /**
  47. * @notes 获取数量
  48. * @return int
  49. * @author likeadmin
  50. * @date 2025/02/25 09:29
  51. */
  52. public function count(): int
  53. {
  54. return TenantRegister::where($this->searchWhere)->count();
  55. }
  56. }