|
...
|
...
|
@@ -56,7 +56,7 @@ class UpdateController extends BaseController |
|
|
|
'type' => 'required',
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'type.required' => '采集类型不能为空',
|
|
|
|
'type.required' => '是否重新采集分类不能为空',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
|
|
...
|
...
|
@@ -90,10 +90,19 @@ class UpdateController extends BaseController |
|
|
|
try {
|
|
|
|
DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
|
|
|
|
if ($domain_info) {
|
|
|
|
//已上线项目
|
|
|
|
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''");
|
|
|
|
} else {
|
|
|
|
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
|
|
|
|
}
|
|
|
|
if ($this->param['type'] == 1) {
|
|
|
|
//需要重新采集分类
|
|
|
|
DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`");
|
|
|
|
DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category_related`");
|
|
|
|
DB::connection('custom_mysql')->statement("TRUNCATE `gl_news_category`");
|
|
|
|
|
|
|
|
DB::connection('custom_mysql')->statement("DELETE FROM `gl_route_map` WHERE `source` = 'product_category' OR `source` = 'news_category'");
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
errorLog('重新采集升级项目数据', $this->param, $e);
|
|
|
|
|
|
...
|
...
|
@@ -115,24 +124,27 @@ class UpdateController extends BaseController |
|
|
|
$old_info->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
$logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->get();
|
|
|
|
if ($this->param['type'] == 1) {
|
|
|
|
//需要重新采集分类
|
|
|
|
$logs = UpdateLog::where('project_id', $this->param['project_id'])->orderBy('sort', 'asc')->get();
|
|
|
|
} else {
|
|
|
|
$logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->orderBy('sort', 'asc')->get();
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($logs as $log) {
|
|
|
|
$log->status = 0;
|
|
|
|
|
|
|
|
if (!in_array($log->api_type, ['website_info', 'tag', 'category', 'category_news'])) {
|
|
|
|
$log->collect_status = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($domain_info) {
|
|
|
|
//已上线项目
|
|
|
|
$url_arr = parse_url($log->api_url);
|
|
|
|
$api_url = str_replace($url_arr['host'], $test_domain, $log->api_url);
|
|
|
|
|
|
|
|
$log->api_url = $api_url;
|
|
|
|
$log->status = 0;
|
|
|
|
} else {
|
|
|
|
if ($this->param['type'] == 2) {
|
|
|
|
$log->status = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!in_array($log->api_type, ['website_info', 'tag'])) {
|
|
|
|
$log->collect_status = 0;
|
|
|
|
}
|
|
|
|
$log->save();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|