正在显示
1 个修改的文件
包含
13 行增加
和
1 行删除
| @@ -210,10 +210,22 @@ class ProjectController extends BaseController | @@ -210,10 +210,22 @@ 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 | + $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 { | ||
| 213 | // 搜索名称 | 223 | // 搜索名称 |
| 214 | - $query->orwhere('gl_project.company','like','%'.$this->map['search'].'%') | 224 | + $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%') |
| 215 | ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); | 225 | ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); |
| 216 | } | 226 | } |
| 227 | + }); | ||
| 228 | + } | ||
| 217 | return $query; | 229 | return $query; |
| 218 | } | 230 | } |
| 219 | 231 |
-
请 注册 或 登录 后发表评论