作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !296
@@ -59,22 +59,30 @@ class UpdateController extends BaseController @@ -59,22 +59,30 @@ class UpdateController extends BaseController
59 'type.required' => '采集类型不能为空', 59 'type.required' => '采集类型不能为空',
60 ]); 60 ]);
61 61
62 - $update_info = UpdateLog::where('project_id', $this->param['project_id'])->first();  
63 - if (!$update_info) {  
64 - $this->fail('当前项目非升级项目,无法采集'); 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 } 65 }
66 66
67 $project = ProjectServer::useProject($this->param['project_id']); 67 $project = ProjectServer::useProject($this->param['project_id']);
68 - if ($project) {  
69 - try {  
70 - DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'");  
71 - DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");  
72 - } catch (\Exception $e) {  
73 - errorLog('重新采集升级项目数据', $this->param, $e);  
74 68
75 - $this->fail('采集任务添加失败');  
76 - } 69 + if(!$project){
  70 + $this->fail('项目不存在');
77 } 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 +
78 //关闭数据库 86 //关闭数据库
79 DB::disconnect('custom_mysql'); 87 DB::disconnect('custom_mysql');
80 88