|
@@ -56,7 +56,7 @@ class UpdateController extends BaseController |
|
@@ -56,7 +56,7 @@ class UpdateController extends BaseController |
|
56
|
'type' => 'required',
|
56
|
'type' => 'required',
|
|
57
|
], [
|
57
|
], [
|
|
58
|
'project_id.required' => 'project_id不能为空',
|
58
|
'project_id.required' => 'project_id不能为空',
|
|
59
|
- 'type.required' => '采集类型不能为空',
|
59
|
+ 'type.required' => '是否重新采集分类不能为空',
|
|
60
|
]);
|
60
|
]);
|
|
61
|
|
61
|
|
|
62
|
$collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
|
62
|
$collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
|
|
@@ -90,10 +90,19 @@ class UpdateController extends BaseController |
|
@@ -90,10 +90,19 @@ class UpdateController extends BaseController |
|
90
|
try {
|
90
|
try {
|
|
91
|
DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
|
91
|
DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
|
|
92
|
if ($domain_info) {
|
92
|
if ($domain_info) {
|
|
|
|
93
|
+ //已上线项目
|
|
93
|
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''");
|
94
|
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''");
|
|
94
|
} else {
|
95
|
} else {
|
|
95
|
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
|
96
|
DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
|
|
96
|
}
|
97
|
}
|
|
|
|
98
|
+ if ($this->param['type'] == 1) {
|
|
|
|
99
|
+ //需要重新采集分类
|
|
|
|
100
|
+ DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`");
|
|
|
|
101
|
+ DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category_related`");
|
|
|
|
102
|
+ DB::connection('custom_mysql')->statement("TRUNCATE `gl_news_category`");
|
|
|
|
103
|
+
|
|
|
|
104
|
+ DB::connection('custom_mysql')->statement("DELETE FROM `gl_route_map` WHERE `source` = 'product_category' OR `source` = 'news_category'");
|
|
|
|
105
|
+ }
|
|
97
|
} catch (\Exception $e) {
|
106
|
} catch (\Exception $e) {
|
|
98
|
errorLog('重新采集升级项目数据', $this->param, $e);
|
107
|
errorLog('重新采集升级项目数据', $this->param, $e);
|
|
99
|
|
108
|
|
|
@@ -115,24 +124,27 @@ class UpdateController extends BaseController |
|
@@ -115,24 +124,27 @@ class UpdateController extends BaseController |
|
115
|
$old_info->save();
|
124
|
$old_info->save();
|
|
116
|
}
|
125
|
}
|
|
117
|
|
126
|
|
|
118
|
- $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->get();
|
127
|
+ if ($this->param['type'] == 1) {
|
|
|
|
128
|
+ //需要重新采集分类
|
|
|
|
129
|
+ $logs = UpdateLog::where('project_id', $this->param['project_id'])->orderBy('sort', 'asc')->get();
|
|
|
|
130
|
+ } else {
|
|
|
|
131
|
+ $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->orderBy('sort', 'asc')->get();
|
|
|
|
132
|
+ }
|
|
119
|
|
133
|
|
|
120
|
foreach ($logs as $log) {
|
134
|
foreach ($logs as $log) {
|
|
|
|
135
|
+ $log->status = 0;
|
|
|
|
136
|
+
|
|
|
|
137
|
+ if (!in_array($log->api_type, ['website_info', 'tag', 'category', 'category_news'])) {
|
|
|
|
138
|
+ $log->collect_status = 0;
|
|
|
|
139
|
+ }
|
|
|
|
140
|
+
|
|
121
|
if ($domain_info) {
|
141
|
if ($domain_info) {
|
|
|
|
142
|
+ //已上线项目
|
|
122
|
$url_arr = parse_url($log->api_url);
|
143
|
$url_arr = parse_url($log->api_url);
|
|
123
|
$api_url = str_replace($url_arr['host'], $test_domain, $log->api_url);
|
144
|
$api_url = str_replace($url_arr['host'], $test_domain, $log->api_url);
|
|
124
|
-
|
|
|
|
125
|
$log->api_url = $api_url;
|
145
|
$log->api_url = $api_url;
|
|
126
|
- $log->status = 0;
|
|
|
|
127
|
- } else {
|
|
|
|
128
|
- if ($this->param['type'] == 2) {
|
|
|
|
129
|
- $log->status = 0;
|
|
|
|
130
|
- }
|
|
|
|
131
|
}
|
146
|
}
|
|
132
|
|
147
|
|
|
133
|
- if (!in_array($log->api_type, ['website_info', 'tag'])) {
|
|
|
|
134
|
- $log->collect_status = 0;
|
|
|
|
135
|
- }
|
|
|
|
136
|
$log->save();
|
148
|
$log->save();
|
|
137
|
}
|
149
|
}
|
|
138
|
|
150
|
|