作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !947
... ... @@ -6,15 +6,16 @@ use App\Helper\Arr;
use App\Models\Com\Notify;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\ServersIp;
use App\Models\Domain\DomainCreateTask;
use App\Models\Domain\DomainInfo;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
use App\Services\BatchExportService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
class Temp extends Command
{
... ... @@ -33,6 +34,88 @@ class Temp extends Command
protected $description = '临时脚本';
/**
* 伍欣组推广项目:开启AMP站点,首页不强制跳转,批量生成AMP站点页面
* @author Akun
* @date 2024/12/10 10:43
*/
public function handle()
{
//获取所有组内推广项目
$leader_mid = 16;
$project_ids = DeployBuild::where('leader_mid', $leader_mid)->pluck('project_id')->toArray();
$project_list = Project::where('type', 2)->whereIn('id', $project_ids)->get();
$task_model = new DomainCreateTask();
foreach ($project_list as $project) {
$project_id = $project->id;
$this->output('项目id:' . $project_id . ',start');
//获取项目域名情况
$domain_info = DomainInfo::where('project_id', $project_id)->where('status', 1)->first();
if (!$domain_info) {
$this->output('未绑定正式域名');
continue;
}
$domain_id = $domain_info->id;
$domain = $domain_info->domain;
//获取项目所在服务器
$serve_ip_info = ServersIp::where('id', $project->serve_id)->first();
if (!$serve_ip_info) {
$this->output('未查询到服务器数据');
continue;
}
$servers_id = $serve_ip_info->servers_id;
if ($servers_id == ServerConfig::SELF_SITE_ID) {
$this->output('自建站项目过滤');
continue;
}
//开启AMP站点
if ($domain_info->amp_status == 0) {
$domain_info->amp_status = 1;
$domain_info->amp_type = 1;
}
//首页不强制跳转
$domain_info->is_redirect = 0;
$domain_info->save();
//创建主站建站任务
$task_model->add([
'server_id' => $servers_id,
'project_id' => $project_id,
'domain_id' => $domain_id,
'type' => DomainCreateTask::TYPE_MAIN
]);
//创建AMP站建站任务
$task_model->add([
'server_id' => $servers_id,
'project_id' => $project_id,
'domain_id' => $domain_id,
'type' => DomainCreateTask::TYPE_AMP
]);
//请求对应C端页面更新接口
$c_url = $domain . '/api/update_page/';
$c_params = [
'project_id' => $project_id,
'type' => 3
];
$re = http_post($c_url, json_encode($c_params), [], true);
if (isset($re['status']) && $re['status'] == 200) {
$this->output($c_url . ' | 请求成功');
} else {
$this->output($c_url . ' | ' . ($re['message'] ?? '未返回失败原因'));
}
$this->output('项目id:' . $project_id . ',end');
}
}
/**
* 关联所有项目关键词
* @author Akun
* @date 2024/11/18 15:07
... ... @@ -236,7 +319,7 @@ class Temp extends Command
* @author Akun
* @date 2024/09/26 10:48
*/
public function handle()
public function handle1()
{
$notify_model = new Notify();
$project_model = new Project();
... ...