作者 刘锟

5.0采集更新

... ... @@ -58,9 +58,11 @@ class UpdateController extends BaseController
$this->request->validate([
'project_id' => 'required',
'type' => 'required',
'old_collect' => 'required',
], [
'project_id.required' => 'project_id不能为空',
'type.required' => '是否重新采集分类不能为空',
'old_collect.required' => '现有数据是否重新采集页面不能为空',
]);
$collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
... ... @@ -92,13 +94,17 @@ 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['old_collect'] == 1){
//现有数据需要重新采集页面
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`");
... ...