coachId]; $where[] = ['pay_status','=',PayEnum::ISPAID]; $where[] = ['order_status','in',[ OrderEnum::ORDER_STATUS_WAIT_RECEIVING, OrderEnum::ORDER_STATUS_WAIT_DEPART, OrderEnum::ORDER_STATUS_DEPART, OrderEnum::ORDER_STATUS_START_SERVER, OrderEnum::ORDER_STATUS_ARRIVE, OrderEnum::ORDER_STATUS_SERVER_FINISH ]]; return $where; } public function lists(): array { $lists = Order::field('id,sn,order_status,user_remark,pay_status,appoint_time,order_amount,user_remark,address_snap,server_finish_time,create_time,coach_id,order_distance') ->order('appoint_time','asc') ->append(['order_distance_desc','appoint_time','appoint_date','order_status_desc','order_cancel_time']) ->with(['order_goods' => function($query){ $query->field('order_id,goods_snap,duration,goods_image,goods_name,goods_price')->hidden(['goods_snap']); }]) ->where($this->setWhere()) ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); return $lists; } public function count(): int { return Order::where($this->setWhere()) ->limit($this->limitOffset, $this->limitLength) ->count(); } }