ServiceWorkGrabOrderLogLists.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\model\works\ServiceWorkAllocateWorkerLog;
  4. class ServiceWorkGrabOrderLogLists extends BaseWorkerDataLists
  5. {
  6. /**
  7. * 获取列表 - 15天内
  8. * @return array
  9. * @author liugc <466014217@qq.com>
  10. * @date 2025/5/8 9:16
  11. */
  12. public function lists(): array
  13. {
  14. $list = ServiceWorkAllocateWorkerLog::alias("a")
  15. ->join("service_work b","a.work_id = b.id AND a.master_worker_id = b.master_worker_id")
  16. ->where('a.type',3)
  17. ->where('a.create_time','>',(time()-15*86400))
  18. ->where('a.master_worker_id',$this->userId)
  19. ->field(['a.opera_log','b.id', 'b.work_sn', 'b.address', 'b.title', 'b.work_status', 'b.service_status','b.work_pay_status', 'b.appointment_time','b.receive_time','b.base_service_fee','b.service_fee'])
  20. ->limit($this->limitOffset, $this->limitLength)
  21. ->order(['b.appointment_time' => 'asc'])
  22. ->select()
  23. ->toArray();
  24. foreach ($list as &$item) {
  25. $item['work_status_text'] = (new \app\common\model\works\ServiceWork)->getWorkStatusTextAttr('',$item);
  26. $item['service_status_text'] = (new \app\common\model\works\ServiceWork)->getServiceStatusTextAttr('',$item);
  27. $item['appointment_time'] = (new \app\common\model\works\ServiceWork)->getAppointmentTimeAttr('',$item);
  28. }
  29. return $list;
  30. }
  31. /**
  32. * 获取数量
  33. * @return int
  34. * @author liugc <466014217@qq.com>
  35. * @date 2025/5/8 9:16
  36. */
  37. public function count(): int
  38. {
  39. return ServiceWorkAllocateWorkerLog::alias("a")
  40. ->join("service_work b","a.work_id = b.id AND a.master_worker_id = b.master_worker_id")
  41. ->where('a.type',3)
  42. ->where('a.create_time','>',(time()-15*86400))
  43. ->where('a.master_worker_id',$this->userId)->count();
  44. }
  45. }