|
|
@@ -27,24 +27,17 @@ use app\common\model\works\ServiceWork;
|
|
|
class ServiceOrderLists extends BaseApiDataLists
|
|
|
{
|
|
|
protected $count = 0;
|
|
|
-
|
|
|
- public function setSearch(): array
|
|
|
- {
|
|
|
- return [
|
|
|
- '=' => ['service_status'],
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
public function queryWhere()
|
|
|
{
|
|
|
$where = [];
|
|
|
if (isset($this->params['service_status'])) {
|
|
|
- $work_ids = ServiceWork::where(['user_id' => $this->userId])->where(function ($query) {
|
|
|
- if($this->params['service_status'] != 'all'){
|
|
|
- $query->where(['service_status' => $this->params['service_status']]);
|
|
|
+ $service_status = $this->params['service_status'];
|
|
|
+ $work_ids = ServiceWork::where(['user_id' => $this->userId])->where(function ($query) use($service_status) {
|
|
|
+ if($service_status != 'all'){
|
|
|
+ $query->where(['service_status' => $service_status]);
|
|
|
}
|
|
|
})->column('id');
|
|
|
- $where['work_id'] = ['in', $work_ids];
|
|
|
+ $where['work_id'] = ['in', !empty($work_ids)?$work_ids:5];
|
|
|
}
|
|
|
return $where;
|
|
|
}
|