| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\workerapi\lists;
- use app\common\model\works\ServiceWork;
- /**
- * HistoryWork列表
- * Class HistoryWorkLists
- * @package app\workerapi\listsworks
- */
- class HistoryWorkLists extends BaseWorkerDataLists
- {
- protected $count = 0;
- /**
- * @notes 获取列表
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author whitef
- * @date 2024/07/10 15:06
- */
- public function lists(): array
- {
- $where = [
- 'master_worker_id'=>$this->userId,
- 'approval'=>1,//派单的时候默认审核了
- 'service_status'=>$this->params['service_status'] ?? 3,
- ];
- //查询月数
- $create_month = !empty($this->params['create_month'])?$this->params['create_month']:date('Y-m');
- $list = ServiceWork::where($where)
- ->field(['id', 'work_sn', 'address', 'title', 'work_status', 'service_status','work_pay_status','finished_time','base_service_fee','service_fee','create_time'])
- ->append(['work_status_text','service_status_text'])
- ->whereMonth('create_time', $create_month)
- ->limit($this->limitOffset, $this->limitLength)
- ->order(['id' => 'desc'])
- ->select()
- ->toArray();
- $this->count = ServiceWork::where($where)->whereMonth('create_time', $create_month)->count();
- return $list;
- }
- /**
- * @notes 获取数量
- * @return int
- * @author whitef
- * @date 2024/07/10 15:06
- */
- public function count(): int
- {
- return $this->count;
- }
- }
|