|
@@ -33,10 +33,11 @@ class UpdateController extends BaseController |
|
@@ -33,10 +33,11 @@ class UpdateController extends BaseController |
|
33
|
* @method :post
|
33
|
* @method :post
|
|
34
|
* @time :2023/8/19 9:25
|
34
|
* @time :2023/8/19 9:25
|
|
35
|
*/
|
35
|
*/
|
|
36
|
- public function updateSeoTdk(){
|
36
|
+ public function updateSeoTdk()
|
|
|
|
37
|
+ {
|
|
37
|
$this->request->validate([
|
38
|
$this->request->validate([
|
|
38
|
- 'project_id'=>'required',
|
|
|
|
39
|
- ],[
|
39
|
+ 'project_id' => 'required',
|
|
|
|
40
|
+ ], [
|
|
40
|
'project_id.required' => 'project_id不能为空',
|
41
|
'project_id.required' => 'project_id不能为空',
|
|
41
|
]);
|
42
|
]);
|
|
42
|
ProjectUpdateTdk::add_task($this->param['project_id']);
|
43
|
ProjectUpdateTdk::add_task($this->param['project_id']);
|
|
@@ -48,14 +49,50 @@ class UpdateController extends BaseController |
|
@@ -48,14 +49,50 @@ class UpdateController extends BaseController |
|
48
|
* @author Akun
|
49
|
* @author Akun
|
|
49
|
* @date 2023/11/24 11:33
|
50
|
* @date 2023/11/24 11:33
|
|
50
|
*/
|
51
|
*/
|
|
51
|
- public function dataCollect(){
|
52
|
+ public function dataCollect()
|
|
|
|
53
|
+ {
|
|
52
|
$this->request->validate([
|
54
|
$this->request->validate([
|
|
53
|
- 'project_id'=>'required',
|
|
|
|
54
|
- ],[
|
55
|
+ 'project_id' => 'required',
|
|
|
|
56
|
+ 'type' => 'required',
|
|
|
|
57
|
+ ], [
|
|
55
|
'project_id.required' => 'project_id不能为空',
|
58
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
59
|
+ 'type.required' => '采集类型不能为空',
|
|
56
|
]);
|
60
|
]);
|
|
57
|
|
61
|
|
|
58
|
- UpdateLog::updateLog($this->param['project_id']);
|
|
|
|
59
|
- $this->response('任务添加成功');
|
62
|
+ $collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get();
|
|
|
|
63
|
+ if ($collect_un->count() > 0) {
|
|
|
|
64
|
+ $this->fail('项目正在采集中');
|
|
|
|
65
|
+ }
|
|
|
|
66
|
+
|
|
|
|
67
|
+ $project = ProjectServer::useProject($this->param['project_id']);
|
|
|
|
68
|
+
|
|
|
|
69
|
+ if(!$project){
|
|
|
|
70
|
+ $this->fail('项目不存在');
|
|
|
|
71
|
+ }
|
|
|
|
72
|
+
|
|
|
|
73
|
+ if ($project->is_upgrade != 1) {
|
|
|
|
74
|
+ $this->fail('非升级无法进行采集操作');
|
|
|
|
75
|
+ }
|
|
|
|
76
|
+
|
|
|
|
77
|
+ try {
|
|
|
|
78
|
+ DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");
|
|
|
|
79
|
+ DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
|
|
|
|
80
|
+ } catch (\Exception $e) {
|
|
|
|
81
|
+ errorLog('重新采集升级项目数据', $this->param, $e);
|
|
|
|
82
|
+
|
|
|
|
83
|
+ $this->fail('采集任务添加失败');
|
|
|
|
84
|
+ }
|
|
|
|
85
|
+
|
|
|
|
86
|
+ //关闭数据库
|
|
|
|
87
|
+ DB::disconnect('custom_mysql');
|
|
|
|
88
|
+
|
|
|
|
89
|
+ $update = ['collect_status' => 0];
|
|
|
|
90
|
+ if ($this->param['type'] == 2) {
|
|
|
|
91
|
+ $update['status'] = 0;
|
|
|
|
92
|
+ }
|
|
|
|
93
|
+
|
|
|
|
94
|
+ UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update);
|
|
|
|
95
|
+
|
|
|
|
96
|
+ $this->response('采集任务添加成功');
|
|
60
|
}
|
97
|
}
|
|
61
|
} |
98
|
} |