作者 刘锟

update

@@ -76,22 +76,23 @@ class UpdateController extends BaseController @@ -76,22 +76,23 @@ class UpdateController extends BaseController
76 $this->fail('非升级无法进行采集操作'); 76 $this->fail('非升级无法进行采集操作');
77 } 77 }
78 78
79 - if ($this->param['test_domain']) {  
80 - $test_domain_arr = parse_url($this->param['test_domain']);  
81 - $this->param['test_domain'] = $test_domain_arr['host'] ?? ''; 79 + $test_domain = $this->param['test_domain'] ?? '';
  80 + if ($test_domain) {
  81 + $test_domain_arr = parse_url($test_domain);
  82 + $test_domain = $test_domain_arr['host'] ?? '';
82 } 83 }
83 84
84 //查看项目是否已上线 85 //查看项目是否已上线
85 $domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first(); 86 $domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first();
86 87
87 - if ($domain_info && !$this->param['test_domain']) { 88 + if ($domain_info && !$test_domain) {
88 $this->fail('已上线项目需填写采集的测试站域名'); 89 $this->fail('已上线项目需填写采集的测试站域名');
89 } 90 }
90 91
91 try { 92 try {
92 DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'"); 93 DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
93 if ($domain_info) { 94 if ($domain_info) {
94 - DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $this->param['test_domain'] . "' WHERE `language` = ''"); 95 + DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''");
95 } else { 96 } else {
96 DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''"); 97 DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
97 } 98 }