作者 刘锟

update

... ... @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Com;
use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Models\Com\UpdateLog;
use App\Models\Com\UpdateOldInfo;
use App\Models\Domain\DomainInfo;
use App\Models\Project\ProjectUpdateTdk;
use App\Services\ProjectServer;
... ... @@ -75,9 +76,25 @@ class UpdateController extends BaseController
$this->fail('非升级无法进行采集操作');
}
if ($this->param['test_domain']) {
$test_domain_arr = parse_url($this->param['test_domain']);
$this->param['test_domain'] = $test_domain_arr['host'] ?? '';
}
//查看项目是否已上线
$domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first();
if ($domain_info && !$this->param['test_domain']) {
$this->fail('已上线项目需填写采集的测试站域名');
}
try {
DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
if ($domain_info) {
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $this->param['test_domain'] . "' WHERE `language` = ''");
} else {
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
}
} catch (\Exception $e) {
errorLog('重新采集升级项目数据', $this->param, $e);
... ... @@ -87,9 +104,6 @@ class UpdateController extends BaseController
//关闭数据库
DB::disconnect('custom_mysql');
//查看项目是否已上线
$domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first();
$update = ['collect_status' => 0];
if ($this->param['type'] == 2 && !$domain_info) {
$update['status'] = 0;
... ...