|
...
|
...
|
@@ -15,6 +15,7 @@ use App\Models\Channel\Channel; |
|
|
|
use App\Models\Channel\User;
|
|
|
|
use App\Models\Channel\Zone;
|
|
|
|
use App\Models\Com\City;
|
|
|
|
use App\Models\Com\NoticeLog;
|
|
|
|
use App\Models\Com\UpdateLog;
|
|
|
|
use App\Models\Devops\ServerConfig;
|
|
|
|
use App\Models\Devops\ServersIp;
|
|
...
|
...
|
@@ -60,6 +61,7 @@ class ProjectController extends BaseController |
|
|
|
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
|
|
|
|
->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
|
|
|
|
->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
|
|
|
|
->leftJoin('gl_project_association', 'gl_project.id', '=', 'gl_project_association.project_id')
|
|
|
|
->where('gl_project.delete_status',Project::TYPE_ZERO);
|
|
|
|
$query = $this->searchParam($query);
|
|
|
|
$query = $this->orderByList($query);
|
|
...
|
...
|
@@ -121,6 +123,7 @@ class ProjectController extends BaseController |
|
|
|
'gl_project_deploy_optimize.design_mid AS design_mid',
|
|
|
|
'gl_project_deploy_optimize.api_no AS api_no',
|
|
|
|
'gl_web_setting_template.template_id AS template_id',
|
|
|
|
'gl_project_association.friend_id as friend_id',
|
|
|
|
];
|
|
|
|
return $select;
|
|
|
|
}
|
|
...
|
...
|
@@ -171,7 +174,7 @@ class ProjectController extends BaseController |
|
|
|
*/
|
|
|
|
public function searchType(&$query){
|
|
|
|
if(isset($this->map['type'])){
|
|
|
|
$query->where('gl_project.extend_type', '!=' ,5);
|
|
|
|
$query->where('gl_project.extend_type', '!=' ,5)->where('gl_project.extend_type', '!=' ,8);
|
|
|
|
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']);
|
|
|
|
} elseif ($this->map['type'] == 8){
|
|
...
|
...
|
@@ -294,6 +297,16 @@ class ProjectController extends BaseController |
|
|
|
if(isset($this->map['plan'])){
|
|
|
|
$query = $query->where('gl_project_deploy_build.plan',$this->map['plan']);
|
|
|
|
}
|
|
|
|
if(isset($this->map['friend_id'])){
|
|
|
|
if($this->map['friend_id'] == 1){
|
|
|
|
$query = $query->where('gl_project_association.friend_id', '!=', 0);
|
|
|
|
}else{
|
|
|
|
$query = $query->where(function ($subQuery) {
|
|
|
|
$subQuery->where('gl_project_association.friend_id', 0)
|
|
|
|
->orWhereNull('gl_project_association.friend_id');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(isset($this->map['seo_plan'])){
|
|
|
|
$query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']);
|
|
|
|
}
|
|
...
|
...
|
@@ -960,14 +973,10 @@ class ProjectController extends BaseController |
|
|
|
'id'=>'required',
|
|
|
|
'aicc'=>'required',
|
|
|
|
'hagro'=>'required',
|
|
|
|
// 'exclusive_aicc_day'=>'required',
|
|
|
|
// 'exclusive_hagro_day'=>'required',
|
|
|
|
],[
|
|
|
|
'id.required' => 'id不能为空',
|
|
|
|
'aicc.required' => 'aicc是否开启不能为空',
|
|
|
|
'hagro.required' => 'hagro是否开启不能为空',
|
|
|
|
// 'exclusive_aicc_day.required' => '服务天数不能为空',
|
|
|
|
// 'exclusive_hagro_day.required' => '服务天数不能为空',
|
|
|
|
]);
|
|
|
|
$logic->saveOtherProject();
|
|
|
|
$this->response('success');
|
|
...
|
...
|
@@ -1136,7 +1145,7 @@ class ProjectController extends BaseController |
|
|
|
|
|
|
|
//获取项目数据
|
|
|
|
$projectModel = new Project();
|
|
|
|
$projectInfo = $projectModel->read(['id'=>$this->param['id']],['project_type','serve_id','site_status']);
|
|
|
|
$projectInfo = $projectModel->read(['id'=>$this->param['id']],['project_type','serve_id','site_status','site_token']);
|
|
|
|
if(!$projectInfo){
|
|
|
|
$this->fail('获取项目数据失败');
|
|
|
|
}
|
|
...
|
...
|
@@ -1144,61 +1153,75 @@ class ProjectController extends BaseController |
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取域名数据
|
|
|
|
$domainModel = new DomainInfoModel();
|
|
|
|
$domainInfo = $domainModel->read(['project_id'=>$this->param['id']],['id','domain','amp_status']);
|
|
|
|
if(!$domainInfo){
|
|
|
|
$this->fail('获取域名数据失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->param['site_status'] == 1){
|
|
|
|
//关闭站点:通知C端
|
|
|
|
$re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');
|
|
|
|
if(isset($re['status']) && $re['status'] !== 200){
|
|
|
|
$this->fail($re['message']);
|
|
|
|
if($projectInfo['serve_id'] == 8){
|
|
|
|
//自建站项目
|
|
|
|
if($this->param['site_status'] == 1){
|
|
|
|
//关闭站点
|
|
|
|
$site_token = $projectInfo['site_token'] ? $projectInfo['site_token'].'_expired' : '';
|
|
|
|
}else{
|
|
|
|
//开启站点
|
|
|
|
$site_token = str_replace('_expired','',$projectInfo['site_token']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$projectModel->edit(['site_status'=>$this->param['site_status'],'site_token'=>$site_token],['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
//开启站点:创建建站任务
|
|
|
|
$serverIpModel = new ServersIp();
|
|
|
|
$serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']);
|
|
|
|
if(!$serversIpInfo){
|
|
|
|
$this->fail('获取项目所属服务器失败');
|
|
|
|
//普通项目
|
|
|
|
//获取域名数据
|
|
|
|
$domainModel = new DomainInfoModel();
|
|
|
|
$domainInfo = $domainModel->read(['project_id'=>$this->param['id']],['id','domain','amp_status']);
|
|
|
|
if(!$domainInfo){
|
|
|
|
$this->fail('获取域名数据失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) {
|
|
|
|
$type = DomainCreateTask::TYPE_BLOG;
|
|
|
|
} else {
|
|
|
|
$type = DomainCreateTask::TYPE_MAIN;
|
|
|
|
}
|
|
|
|
if($this->param['site_status'] == 1){
|
|
|
|
//关闭站点:通知C端
|
|
|
|
$re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');
|
|
|
|
if(isset($re['status']) && $re['status'] !== 200){
|
|
|
|
$this->fail($re['message']);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//开启站点:创建建站任务
|
|
|
|
$serverIpModel = new ServersIp();
|
|
|
|
$serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']);
|
|
|
|
if(!$serversIpInfo){
|
|
|
|
$this->fail('获取项目所属服务器失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
//创建更新站点证书任务
|
|
|
|
$domainCreateTaskModel = new DomainCreateTask();
|
|
|
|
$task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
|
|
|
|
if (!$task_info) {
|
|
|
|
$domainCreateTaskModel->add([
|
|
|
|
'server_id' => $serversIpInfo['servers_id'],
|
|
|
|
'project_id' => $this->param['id'],
|
|
|
|
'domain_id' => $domainInfo['id'],
|
|
|
|
'type' => $type,
|
|
|
|
'is_open' => DomainCreateTask::IS_OPEN
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) {
|
|
|
|
$type = DomainCreateTask::TYPE_BLOG;
|
|
|
|
} else {
|
|
|
|
$type = DomainCreateTask::TYPE_MAIN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($domainInfo['amp_status']){
|
|
|
|
$task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
|
|
|
|
if (!$task_info_amp) {
|
|
|
|
//创建更新站点证书任务
|
|
|
|
$domainCreateTaskModel = new DomainCreateTask();
|
|
|
|
$task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
|
|
|
|
if (!$task_info) {
|
|
|
|
$domainCreateTaskModel->add([
|
|
|
|
'server_id' => $serversIpInfo['servers_id'],
|
|
|
|
'project_id' => $this->param['id'],
|
|
|
|
'domain_id' => $domainInfo['id'],
|
|
|
|
'type' => DomainCreateTask::TYPE_AMP,
|
|
|
|
'type' => $type,
|
|
|
|
'is_open' => DomainCreateTask::IS_OPEN
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if($domainInfo['amp_status']){
|
|
|
|
$task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
|
|
|
|
if (!$task_info_amp) {
|
|
|
|
$domainCreateTaskModel->add([
|
|
|
|
'server_id' => $serversIpInfo['servers_id'],
|
|
|
|
'project_id' => $this->param['id'],
|
|
|
|
'domain_id' => $domainInfo['id'],
|
|
|
|
'type' => DomainCreateTask::TYPE_AMP,
|
|
|
|
'is_open' => DomainCreateTask::IS_OPEN
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$projectModel->edit(['site_status'=>$this->param['site_status']],['id'=>$this->param['id']]);
|
|
|
|
$projectModel->edit(['site_status'=>$this->param['site_status']],['id'=>$this->param['id']]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
...
|
...
|
@@ -1215,4 +1238,25 @@ class ProjectController extends BaseController |
|
|
|
$this->response('success', Code::SUCCESS, $lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :生成关键词图表数据
|
|
|
|
* @name :generateCountCharts
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/6/10 10:51
|
|
|
|
*/
|
|
|
|
public function generateCountCharts(){
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id'=>'required',
|
|
|
|
],[
|
|
|
|
'project_id.required' => '项目id不能为空',
|
|
|
|
]);
|
|
|
|
$noticeModel = new NoticeLog();
|
|
|
|
$info = $noticeModel->read(['type'=>NoticeLog::TYPE_GENERATE_COUNT_CHARTS,'status'=>0,'data'=>['like','%"'.$this->param['project_id'].'"%']]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前数据在生成中');
|
|
|
|
}
|
|
|
|
NoticeLog::createLog(NoticeLog::TYPE_GENERATE_COUNT_CHARTS, ['project_id' => $this->param['project_id']]);
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|