ServiceAssignWorkLists.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\model\works\ServiceWork;
  4. use app\common\lists\ListsSearchInterface;
  5. use DateTime;
  6. /**
  7. * ServiceAssignWork列表
  8. * Class ServiceAssignWorkLists
  9. * @package app\workerapi\listsworks
  10. */
  11. class ServiceAssignWorkLists extends BaseWorkerDataLists
  12. {
  13. protected $count = 0;
  14. /**
  15. * @notes 获取列表
  16. * @return array
  17. * @throws \think\db\exception\DataNotFoundException
  18. * @throws \think\db\exception\DbException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. * @author whitef
  21. * @date 2024/07/10 15:06
  22. */
  23. public function lists(): array
  24. {
  25. $where = [
  26. 'master_worker_id'=>$this->userId,
  27. 'approval'=>1,//派单的时候默认审核了
  28. 'work_status'=>1,
  29. ];
  30. $list = ServiceWork::where($where)
  31. ->where('work_pay_status','>',0)
  32. ->field(['id', 'work_sn', 'address', 'title', 'work_status', 'service_status','work_pay_status', 'appointment_time','receive_time','base_service_fee','service_fee'])
  33. ->append(['work_status_text','service_status_text'])
  34. ->limit($this->limitOffset, $this->limitLength)
  35. ->order(['appointment_time' => 'asc'])//上门时间排序
  36. ->select()
  37. ->toArray();
  38. $this->count = ServiceWork::where($where)->count();
  39. return $list;
  40. }
  41. /**
  42. * @notes 获取数量
  43. * @return int
  44. * @author whitef
  45. * @date 2024/07/10 15:06
  46. */
  47. public function count(): int
  48. {
  49. return $this->count;
  50. }
  51. }