作者 刘锟

update

@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Com; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Com;
12 use App\Helper\Common; 12 use App\Helper\Common;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\Com\UpdateLog; 14 use App\Models\Com\UpdateLog;
  15 +use App\Models\Com\UpdateOldInfo;
15 use App\Models\Domain\DomainInfo; 16 use App\Models\Domain\DomainInfo;
16 use App\Models\Project\ProjectUpdateTdk; 17 use App\Models\Project\ProjectUpdateTdk;
17 use App\Services\ProjectServer; 18 use App\Services\ProjectServer;
@@ -75,9 +76,25 @@ class UpdateController extends BaseController @@ -75,9 +76,25 @@ class UpdateController extends BaseController
75 $this->fail('非升级无法进行采集操作'); 76 $this->fail('非升级无法进行采集操作');
76 } 77 }
77 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'] ?? '';
  82 + }
  83 +
  84 + //查看项目是否已上线
  85 + $domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first();
  86 +
  87 + if ($domain_info && !$this->param['test_domain']) {
  88 + $this->fail('已上线项目需填写采集的测试站域名');
  89 + }
  90 +
78 try { 91 try {
79 DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'"); 92 DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
80 - DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''"); 93 + if ($domain_info) {
  94 + DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $this->param['test_domain'] . "' WHERE `language` = ''");
  95 + } else {
  96 + DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
  97 + }
81 } catch (\Exception $e) { 98 } catch (\Exception $e) {
82 errorLog('重新采集升级项目数据', $this->param, $e); 99 errorLog('重新采集升级项目数据', $this->param, $e);
83 100
@@ -87,9 +104,6 @@ class UpdateController extends BaseController @@ -87,9 +104,6 @@ class UpdateController extends BaseController
87 //关闭数据库 104 //关闭数据库
88 DB::disconnect('custom_mysql'); 105 DB::disconnect('custom_mysql');
89 106
90 - //查看项目是否已上线  
91 - $domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first();  
92 -  
93 $update = ['collect_status' => 0]; 107 $update = ['collect_status' => 0];
94 if ($this->param['type'] == 2 && !$domain_info) { 108 if ($this->param['type'] == 2 && !$domain_info) {
95 $update['status'] = 0; 109 $update['status'] = 0;