作者 李小龙

合并分支 'develop' 到 'master'

lyh 合并请求



查看合并请求 !331
@@ -55,7 +55,7 @@ class InitProject extends Command @@ -55,7 +55,7 @@ class InitProject extends Command
55 $project = Project::find($item['data']['project_id']); 55 $project = Project::find($item['data']['project_id']);
56 $project_logic = new ProjectLogic(); 56 $project_logic = new ProjectLogic();
57 //初始化数据库 57 //初始化数据库
58 - if(!empty($project['mysql_id'])){ 58 + if(!empty($project['mysql_id']) && ($project['type'] == 1)){
59 $project_logic->initializationMysql($project['id']); 59 $project_logic->initializationMysql($project['id']);
60 } 60 }
61 //初始账号 61 //初始账号
@@ -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;
@@ -212,8 +212,8 @@ class ProofreadingController extends BaseController @@ -212,8 +212,8 @@ class ProofreadingController extends BaseController
212 $data[] = $trimmedString; 212 $data[] = $trimmedString;
213 } 213 }
214 $data = array_values($data); 214 $data = array_values($data);
215 - $uniqueArray = array_unique($data);  
216 - $data = array_values($uniqueArray); 215 +// $uniqueArray = array_unique($data);
  216 +// $data = array_values($uniqueArray);
217 return $data; 217 return $data;
218 } 218 }
219 219
@@ -105,7 +105,7 @@ class ProjectServer @@ -105,7 +105,7 @@ class ProjectServer
105 $created_at = date('Y-m-d H:i:s'); 105 $created_at = date('Y-m-d H:i:s');
106 self::initGroup($project_id,$created_at); 106 self::initGroup($project_id,$created_at);
107 //初始化单页 107 //初始化单页
108 - self::init404Page($project_id); 108 + self::init404Page($project_id,$created_at);
109 //初始化模块数据 109 //初始化模块数据
110 self::initModule($project_id); 110 self::initModule($project_id);
111 DB::disconnect('custom_mysql'); 111 DB::disconnect('custom_mysql');
@@ -172,7 +172,7 @@ class ProjectServer @@ -172,7 +172,7 @@ class ProjectServer
172 * @method :post 172 * @method :post
173 * @time :2023/12/29 9:32 173 * @time :2023/12/29 9:32
174 */ 174 */
175 - public function init404Page($project_id){ 175 + public function init404Page($project_id,$created_at){
176 $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first(); 176 $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
177 if(empty($info)) { 177 if(empty($info)) {
178 $main_404_html = '<main> 178 $main_404_html = '<main>
@@ -208,7 +208,10 @@ class ProjectServer @@ -208,7 +208,10 @@ class ProjectServer
208 'status' => 1, 208 'status' => 1,
209 'url' => BCustomTemplate::NOT_FOUND_PAGE_URL, 209 'url' => BCustomTemplate::NOT_FOUND_PAGE_URL,
210 'html' => $main_404_html, 210 'html' => $main_404_html,
211 - 'html_style' => '<style id="globalsojs-styles"></style>','title' => '404-Page not found', 'description' => 'Sorry. The page has either moved or cannot be found.', 'created_at' => $created_at, 'updated_at' => $created_at]; 211 + 'html_style' => '<style id="globalsojs-styles"></style>',
  212 + 'title' => '404-Page not found',
  213 + 'description' => 'Sorry. The page has either moved or cannot be found.',
  214 + 'created_at' => $created_at, 'updated_at' => $created_at];
212 $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data); 215 $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data);
213 //路由 216 //路由
214 $info = DB::connection('custom_mysql')->table('gl_route_map')->first(); 217 $info = DB::connection('custom_mysql')->table('gl_route_map')->first();