作者 lyh

gx脚本更新路由

@@ -210,9 +210,21 @@ class ProjectController extends BaseController @@ -210,9 +210,21 @@ class ProjectController extends BaseController
210 } 210 }
211 } 211 }
212 if(!empty($this->map['search']) && !empty($this->map['search_type'])){ 212 if(!empty($this->map['search']) && !empty($this->map['search_type'])){
213 - // 搜索名称  
214 - $query->orwhere('gl_project.company','like','%'.$this->map['search'].'%')  
215 - ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); 213 + $query->where(function ($subQuery) {
  214 + // 搜索域名
  215 + if ($this->map['search_type'] == 'domain') {
  216 + $parsedUrl = parse_url($this->map['search']);
  217 + $this->map['search'] = $parsedUrl['host'] ?? $this->map['search'];
  218 + $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray();
  219 + $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
  220 + } else if($this->map['search_type'] == 'test_domain'){
  221 + $subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%');
  222 + } else {
  223 + // 搜索名称
  224 + $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
  225 + ->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
  226 + }
  227 + });
216 } 228 }
217 return $query; 229 return $query;
218 } 230 }