作者 lyh

gx脚本更新路由

... ... @@ -210,9 +210,21 @@ class ProjectController extends BaseController
}
}
if(!empty($this->map['search']) && !empty($this->map['search_type'])){
// 搜索名称
$query->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
$query->where(function ($subQuery) {
// 搜索域名
if ($this->map['search_type'] == 'domain') {
$parsedUrl = parse_url($this->map['search']);
$this->map['search'] = $parsedUrl['host'] ?? $this->map['search'];
$ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray();
$subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
} else if($this->map['search_type'] == 'test_domain'){
$subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%');
} else {
// 搜索名称
$subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
}
});
}
return $query;
}
... ...