HistoryWorkLists.php 1.4 KB

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