|
...
|
...
|
@@ -33,10 +33,11 @@ class UpdateController extends BaseController |
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/19 9:25
|
|
|
|
*/
|
|
|
|
public function updateSeoTdk(){
|
|
|
|
public function updateSeoTdk()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id'=>'required',
|
|
|
|
],[
|
|
|
|
'project_id' => 'required',
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
]);
|
|
|
|
ProjectUpdateTdk::add_task($this->param['project_id']);
|
|
...
|
...
|
@@ -48,14 +49,42 @@ class UpdateController extends BaseController |
|
|
|
* @author Akun
|
|
|
|
* @date 2023/11/24 11:33
|
|
|
|
*/
|
|
|
|
public function dataCollect(){
|
|
|
|
public function dataCollect()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id'=>'required',
|
|
|
|
],[
|
|
|
|
'project_id' => 'required',
|
|
|
|
'type' => 'required',
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'type.required' => '采集类型不能为空',
|
|
|
|
]);
|
|
|
|
|
|
|
|
UpdateLog::updateLog($this->param['project_id']);
|
|
|
|
$this->response('任务添加成功');
|
|
|
|
$update_info = UpdateLog::where('project_id', $this->param['project_id'])->first();
|
|
|
|
if (!$update_info) {
|
|
|
|
$this->fail('当前项目非升级项目,无法采集');
|
|
|
|
}
|
|
|
|
|
|
|
|
$project = ProjectServer::useProject($this->param['project_id']);
|
|
|
|
if ($project) {
|
|
|
|
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` = ''");
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
errorLog('重新采集升级项目数据', $this->param, $e);
|
|
|
|
|
|
|
|
$this->fail('采集任务添加失败');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//关闭数据库
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
|
|
|
|
$update = ['collect_status' => 0];
|
|
|
|
if ($this->param['type'] == 2) {
|
|
|
|
$update['status'] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update);
|
|
|
|
|
|
|
|
$this->response('采集任务添加成功');
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|