作者 刘锟

5.0采集更新

@@ -58,9 +58,11 @@ class UpdateController extends BaseController @@ -58,9 +58,11 @@ class UpdateController extends BaseController
58 $this->request->validate([ 58 $this->request->validate([
59 'project_id' => 'required', 59 'project_id' => 'required',
60 'type' => 'required', 60 'type' => 'required',
  61 + 'old_collect' => 'required',
61 ], [ 62 ], [
62 'project_id.required' => 'project_id不能为空', 63 'project_id.required' => 'project_id不能为空',
63 'type.required' => '是否重新采集分类不能为空', 64 'type.required' => '是否重新采集分类不能为空',
  65 + 'old_collect.required' => '现有数据是否重新采集页面不能为空',
64 ]); 66 ]);
65 67
66 $collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get(); 68 $collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
@@ -92,13 +94,17 @@ class UpdateController extends BaseController @@ -92,13 +94,17 @@ class UpdateController extends BaseController
92 } 94 }
93 95
94 try { 96 try {
95 - DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");  
96 - if ($domain_info) {  
97 - //已上线项目  
98 - DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''");  
99 - } else {  
100 - DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''"); 97 + if($this->param['old_collect'] == 1){
  98 + //现有数据需要重新采集页面
  99 + DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
  100 + if ($domain_info) {
  101 + //已上线项目
  102 + DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''");
  103 + } else {
  104 + DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
  105 + }
101 } 106 }
  107 +
102 if ($this->param['type'] == 1) { 108 if ($this->param['type'] == 1) {
103 //需要重新采集分类 109 //需要重新采集分类
104 DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`"); 110 DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`");