$this->userId, ]; //条件搜索 $status = $this->params['status'] ?? 0; switch ($status){ case 0: //今日上门 $startOfDayTimestamp = strtotime(date("Y-m-d")); $endOfDayTimestamp = strtotime(date("Y-m-d 23:59:59")); $where[] = ['work_status','=',3]; $where[] = ['appointment_time','between',[$startOfDayTimestamp, $endOfDayTimestamp]]; break; case 1: //待完成 $where[] = ['work_status','<>',1]; $where[] = ['service_status','in','0,1,2']; break; case 2: //已完成 $where[] = ['service_status','=','3']; break; } $list = GroupServiceWork::where($where) ->field(['id', 'work_sn', 'address', 'title', 'work_status', 'service_status','appointment_time']) ->append(['work_status_text','service_status_text']) ->limit($this->limitOffset, $this->limitLength) ->order(['appointment_time' => 'asc'])//上门时间排序 ->select() ->toArray(); $this->count = GroupServiceWork::where($where)->count(); return $list; } /** * @notes 获取数量 * @return int * @author whitef * @date 2024/07/10 15:06 */ public function count(): int { return $this->count; } }