作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !589
... ... @@ -18,6 +18,7 @@ use App\Models\Channel\Channel;
use App\Models\Channel\User;
use App\Models\Channel\Zone;
use App\Models\Com\City;
use App\Models\Com\UpdateLog;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\HomeCount\Count;
... ... @@ -366,6 +367,8 @@ class ProjectController extends BaseController
$item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
$item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
$item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
$item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : '';
return $item;
}
... ...
... ... @@ -100,17 +100,7 @@ class ProjectLogic extends BaseLogic
$info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
}
//升级项目采集完成时间
$collect_time = '';
if($info['is_upgrade'] == 1){
$collect_un_count = UpdateLog::where('project_id',$id)->where('collect_status',0)->count();
if($collect_un_count > 0){
$collect_time = '采集中';
}else{
$collect_info = UpdateLog::where('project_id',$id)->orderBy('updated_at','desc')->first();
$collect_time = $collect_info->updated_at->format('Y-m-d H:i:s');
}
}
$info['collect_time'] = $collect_time;
$info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
return $this->success($info);
}
... ...
... ... @@ -61,4 +61,24 @@ class UpdateLog extends Model
return true;
}
/**
* 获取项目当前采集情况
* @param $project_id
* @return string
* @author Akun
* @date 2024/05/27 17:04
*/
public static function getProjectUpdate($project_id)
{
$collect_un_count = UpdateLog::where('project_id', $project_id)->where('collect_status', 0)->count();
if ($collect_un_count > 0) {
$collect_time = '采集中';
} else {
$collect_info = UpdateLog::where('project_id', $project_id)->orderBy('updated_at', 'desc')->first();
$collect_time = $collect_info->updated_at->format('Y-m-d H:i:s');
}
return $collect_time;
}
}
... ...