|
...
|
...
|
@@ -18,6 +18,7 @@ use App\Models\ASide\APublicModel; |
|
|
|
use App\Models\Channel\Channel;
|
|
|
|
use App\Models\HomeCount\Count;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use App\Models\Project\DeployBuild;
|
|
|
|
use App\Models\Project\DeployOptimize;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\Task\Task;
|
|
...
|
...
|
@@ -32,27 +33,65 @@ class RenewProjectController extends BaseController |
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/11 10:22
|
|
|
|
*/
|
|
|
|
public function lists(ProjectLogic $logic){
|
|
|
|
public function lists(Project $project){
|
|
|
|
$arr = $this->getLessThanFifteenProjectId();
|
|
|
|
$map = [];
|
|
|
|
if(!empty($arr)){
|
|
|
|
$this->searchParam($map,$this->map,$arr);
|
|
|
|
//按类型搜索
|
|
|
|
$map['id'] = ['in', $arr];
|
|
|
|
}
|
|
|
|
$filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'];
|
|
|
|
$lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build')
|
|
|
|
->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
|
|
|
|
if(!empty($lists)){
|
|
|
|
$lists = $lists->toArray();
|
|
|
|
foreach ($lists['list'] as $k=>$item){
|
|
|
|
$item = $this->handleParam($item);
|
|
|
|
$lists['list'][$k] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取小于15天的项目id
|
|
|
|
* @name :getlessThanFifteenProjectId
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 11:49
|
|
|
|
*/
|
|
|
|
public function getLessThanFifteenProjectId(){
|
|
|
|
$count = new Count();
|
|
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
|
|
$count_list = $count->list(['date'=>$yesterday,'service_day'=>['<=',15]],'id',['project_id']);
|
|
|
|
$arr = [];
|
|
|
|
if(!empty($count_list)){
|
|
|
|
foreach ($count_list as $v){
|
|
|
|
$arr[] = $v['project_id'];
|
|
|
|
}
|
|
|
|
$sort = ['id' => 'desc'];
|
|
|
|
}
|
|
|
|
return $arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :搜索参数处理
|
|
|
|
* @name :searchParam
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 10:30
|
|
|
|
*/
|
|
|
|
public function searchParam(&$map,$param,&$arr){
|
|
|
|
//按类型搜索
|
|
|
|
$map[] = ['id', 'in', $arr];
|
|
|
|
if(!empty($this->param['search']) && !empty($this->param['search_type'])){
|
|
|
|
if(!empty($param['search']) && !empty($param['search_type'])){
|
|
|
|
if($this->param['search_type'] == 'domain'){
|
|
|
|
//搜索域名
|
|
|
|
$map[] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->where('id','in',$arr)->pluck('project_id')->toArray()];
|
|
|
|
$map['id'] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$param['search']}%")->where('id','in',$arr)->pluck('project_id')->toArray()];
|
|
|
|
}else{
|
|
|
|
$map[] = [$this->param['search_type'], 'like', "%{$this->param['search']}%"];
|
|
|
|
$map[$this->param['search_type']] = ['like', "%{$this->param['search']}%"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = $logic->getList($map, $sort,['*'],$this->row);
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
return $map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|