作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !296
@@ -59,13 +59,21 @@ class UpdateController extends BaseController @@ -59,13 +59,21 @@ 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) { 68 +
  69 + if(!$project){
  70 + $this->fail('项目不存在');
  71 + }
  72 +
  73 + if ($project->is_upgrade != 1) {
  74 + $this->fail('非升级无法进行采集操作');
  75 + }
  76 +
69 try { 77 try {
70 DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'"); 78 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` = ''"); 79 DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''");
@@ -74,7 +82,7 @@ class UpdateController extends BaseController @@ -74,7 +82,7 @@ class UpdateController extends BaseController
74 82
75 $this->fail('采集任务添加失败'); 83 $this->fail('采集任务添加失败');
76 } 84 }
77 - } 85 +
78 //关闭数据库 86 //关闭数据库
79 DB::disconnect('custom_mysql'); 87 DB::disconnect('custom_mysql');
80 88