作者 lyh
... ... @@ -10,6 +10,8 @@ use App\Models\Domain\DomainInfo;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\WebLanguage;
use App\Services\BatchExportService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
... ... @@ -52,7 +54,6 @@ class Temp extends Command
$project_list = Project::select(['id', 'serve_id', 'title'])->whereIn('serve_id', $server_ip_ids)->get();
$domain_model = new DomainInfo();
$notify_model = new Notify();
$data = [];
foreach ($project_list as $value) {
$domain_info = $domain_model->read(['project_id' => $value->id, 'status' => 1], ['id', 'domain']);
... ... @@ -72,13 +73,31 @@ class Temp extends Command
}
//获取最新一条小语种生成任务
$notify = $notify_model->read(['project_id' => $value->id, 'type' => 2, 'status' => 3, 'route' => 1], ['id']);
$notify = Notify::where(['server_id' => $server_id, 'project_id' => $value->id, 'type' => 2, 'status' => 3, 'route' => 4])->orderBy('id', 'desc')->first();
if (!$notify) {
//过滤未生成过小语种的项目
continue;
}
$notify_data = json_decode($notify->data, true);
$language = array_diff($notify_data['language'], ['1']);
$language_id = current($language);
if (!$language_id) {
continue;
}
$lan_info = WebLanguage::getLangById($language_id);
$short = $lan_info->short;
ProjectServer::useProject($value->id);
$route = RouteMap::where('source', 'product_keyword')->value('route');
if (!$route) {
//过滤没有关键词的项目
continue;
}
$url = 'https://' . $domain . '/fr';
$url = 'https://' . $domain . '/' . $short . '/' . $route . '/';
$code = check_curl_status($url);
$html = curl_c($url, false);
$is_404 = false;
... ... @@ -95,7 +114,7 @@ class Temp extends Command
}
$map = ['项目id', '名称', '访问地址', '访问状态', '是否404'];
if ($data) {
$table = new BatchExportService($server_name . '站点小语种页面访问状态');
$table = new BatchExportService($server_name . '站点小语种聚合页面访问状态');
$file = $table->head($map)->data($data)->save();
if (!$file) {
$this->output('文件生成失败,请重试');
... ...