正在显示
1 个修改的文件
包含
12 行增加
和
20 行删除
| @@ -199,28 +199,20 @@ class ProjectController extends BaseController | @@ -199,28 +199,20 @@ class ProjectController extends BaseController | ||
| 199 | * @return mixed | 199 | * @return mixed |
| 200 | */ | 200 | */ |
| 201 | public function searchContent(&$query){ | 201 | public function searchContent(&$query){ |
| 202 | - if(!empty($this->map['domain'])){ | ||
| 203 | - $parsedUrl = parse_url($this->map['domain']); | ||
| 204 | - $domain = $parsedUrl['host'] ?? $this->map['domain']; | ||
| 205 | - $ids = DomainInfo::where('domain', 'like', '%'.$domain.'%')->pluck('id')->toArray(); | ||
| 206 | - $query->whereIn('gl_project_deploy_optimize.domain', $ids); | 202 | + if(!empty($this->map['domain_type']) && !empty($this->map['domain_search'])){ |
| 203 | + if($this->map['domain_type'] == 'domain'){ | ||
| 204 | + $parsedUrl = parse_url($this->map['domain_search']); | ||
| 205 | + $this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search']; | ||
| 206 | + $ids = DomainInfo::where('domain', 'like', '%'.$this->map['domain_search'].'%')->pluck('id')->toArray(); | ||
| 207 | + $query->whereIn('gl_project_deploy_optimize.domain', $ids); | ||
| 208 | + }else{ | ||
| 209 | + $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['domain_search'].'%'); | ||
| 210 | + } | ||
| 207 | } | 211 | } |
| 208 | if(!empty($this->map['search']) && !empty($this->map['search_type'])){ | 212 | if(!empty($this->map['search']) && !empty($this->map['search_type'])){ |
| 209 | - $query->where(function ($subQuery) { | ||
| 210 | - // 搜索域名 | ||
| 211 | - if ($this->map['search_type'] == 'domain') { | ||
| 212 | - $parsedUrl = parse_url($this->map['search']); | ||
| 213 | - $this->map['search'] = $parsedUrl['host'] ?? $this->map['search']; | ||
| 214 | - $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray(); | ||
| 215 | - $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids); | ||
| 216 | - } else if($this->map['search_type'] == 'test_domain'){ | ||
| 217 | - $subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%'); | ||
| 218 | - } else { | ||
| 219 | - // 搜索名称 | ||
| 220 | - $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%') | ||
| 221 | - ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); | ||
| 222 | - } | ||
| 223 | - }); | 213 | + // 搜索名称 |
| 214 | + $query->orwhere('gl_project.company','like','%'.$this->map['search'].'%') | ||
| 215 | + ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); | ||
| 224 | } | 216 | } |
| 225 | return $query; | 217 | return $query; |
| 226 | } | 218 | } |
-
请 注册 或 登录 后发表评论