作者 周海龙

合并分支 'zhl' 到 'master'

u admin project



查看合并请求 !23
@@ -90,31 +90,22 @@ class ProjectController extends BaseController @@ -90,31 +90,22 @@ class ProjectController extends BaseController
90 } 90 }
91 91
92 /** 92 /**
93 - * @remark :type类型  
94 - * @name :searchType  
95 - * @author :lyh  
96 - * @method :post  
97 - * @time :2023/8/30 10:14 93 + * 搜索项目状态
  94 + * @param $query
  95 + * @return mixed
98 */ 96 */
99 public function searchType(&$query){ 97 public function searchType(&$query){
100 - if($this->map['type'] == Project::TYPE_ZERO){  
101 - $query->where('gl_project.type',Project::TYPE_ZERO);  
102 - }elseif ($this->map['type'] == Project::TYPE_ONE){  
103 - $query->where('gl_project.type',Project::TYPE_ONE);  
104 - }elseif ($this->map['type'] == Project::TYPE_TWO){  
105 - $query->whereIn('gl_project.type', [Project::TYPE_TWO,Project::TYPE_THREE]);  
106 - }else{ 98 + if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE]))
  99 + $query->where('gl_project.type', $this->map['type']);
  100 + else{
107 $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); 101 $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
108 } 102 }
109 return $query; 103 return $query;
110 } 104 }
111 105
112 /** 106 /**
113 - * @remark :查询字段处理  
114 - * @name :selectParam  
115 - * @author :lyh  
116 - * @method :post  
117 - * @time :2023/8/18 10:59 107 + * 需要查询的字段
  108 + * @return array
118 */ 109 */
119 public function selectParam(){ 110 public function selectParam(){
120 $select = [ 111 $select = [
@@ -154,19 +145,22 @@ class ProjectController extends BaseController @@ -154,19 +145,22 @@ class ProjectController extends BaseController
154 } 145 }
155 146
156 /** 147 /**
157 - * @remark :按需搜索  
158 - * @name :searchDomainTitle  
159 - * @author :lyh  
160 - * @method :post  
161 - * @time :2023/9/7 18:39 148 + * 搜索框
  149 + * @param $query
  150 + * @return mixed
162 */ 151 */
163 public function searchContent(&$query){ 152 public function searchContent(&$query){
164 if(!empty($this->map['search']) && !empty($this->map['search_type'])){ 153 if(!empty($this->map['search']) && !empty($this->map['search_type'])){
165 - //搜索域名  
166 $query->where(function ($subQuery) { 154 $query->where(function ($subQuery) {
167 - $subQuery->orwhere('gl_project_deploy_optimize.domain','like','%'.$this->map['search'].'%')  
168 - ->orwhere('gl_project.company','like','%'.$this->map['search'].'%')  
169 - ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); 155 + // 搜索域名
  156 + if ($this->map['search_type'] == 'domain') {
  157 + $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray();
  158 + $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
  159 + } else {
  160 + // 搜索名称
  161 + $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
  162 + ->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
  163 + }
170 }); 164 });
171 } 165 }
172 return $query; 166 return $query;