作者 zhl

u admin project

... ... @@ -90,31 +90,22 @@ class ProjectController extends BaseController
}
/**
* @remark :type类型
* @name :searchType
* @author :lyh
* @method :post
* @time :2023/8/30 10:14
* 搜索项目状态
* @param $query
* @return mixed
*/
public function searchType(&$query){
if($this->map['type'] == Project::TYPE_ZERO){
$query->where('gl_project.type',Project::TYPE_ZERO);
}elseif ($this->map['type'] == Project::TYPE_ONE){
$query->where('gl_project.type',Project::TYPE_ONE);
}elseif ($this->map['type'] == Project::TYPE_TWO){
$query->whereIn('gl_project.type', [Project::TYPE_TWO,Project::TYPE_THREE]);
}else{
if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE]))
$query->where('gl_project.type', $this->map['type']);
else{
$query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
}
return $query;
}
/**
* @remark :查询字段处理
* @name :selectParam
* @author :lyh
* @method :post
* @time :2023/8/18 10:59
* 需要查询的字段
* @return array
*/
public function selectParam(){
$select = [
... ... @@ -154,19 +145,22 @@ class ProjectController extends BaseController
}
/**
* @remark :按需搜索
* @name :searchDomainTitle
* @author :lyh
* @method :post
* @time :2023/9/7 18:39
* 搜索框
* @param $query
* @return mixed
*/
public function searchContent(&$query){
if(!empty($this->map['search']) && !empty($this->map['search_type'])){
//搜索域名
$query->where(function ($subQuery) {
$subQuery->orwhere('gl_project_deploy_optimize.domain','like','%'.$this->map['search'].'%')
->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
// 搜索域名
if ($this->map['search_type'] == 'domain') {
$ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray();
$subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
} else {
// 搜索名称
$subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
}
});
}
return $query;
... ...