作者 lyh

更新sever_id

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateLog.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/7/10 14:44
  8 + */
  9 +
  10 +namespace App\Console\Commands\DeleteTemplate;
  11 +
  12 +use App\Models\Project\Project;
  13 +use App\Services\ProjectServer;
  14 +use Illuminate\Console\Command;
  15 +use Illuminate\Support\Facades\DB;
  16 +
  17 +class TemplateLog extends Command
  18 +{
  19 + /**
  20 + * The name and signature of the console command.
  21 + *
  22 + * @var string
  23 + */
  24 + protected $signature = 'delete_template_log';
  25 +
  26 + /**
  27 + * The console command description.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $description = '定时清理日志';
  32 +
  33 + /**
  34 + * Create a new command instance.
  35 + *
  36 + * @return void
  37 + */
  38 + public function __construct()
  39 + {
  40 + parent::__construct();
  41 + }
  42 +
  43 + public function handle(){
  44 + $projectModel = new Project();
  45 + $list = $projectModel->list(['delete_status'=>0]);
  46 + foreach ($list as $v){
  47 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  48 + ProjectServer::useProject($v['id']);
  49 + DB::disconnect('custom_mysql');
  50 + }
  51 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  52 + }
  53 +
  54 + /**
  55 + * @remark :定时清理可视化日志
  56 + * @name :deleteTemplate
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2024/7/10 14:48
  60 + */
  61 + public function deleteTemplate(){
  62 +
  63 + }
  64 +}
@@ -177,6 +177,9 @@ class ProjectLogic extends BaseLogic @@ -177,6 +177,9 @@ class ProjectLogic extends BaseLogic
177 * @time :2024/6/25 15:34 177 * @time :2024/6/25 15:34
178 */ 178 */
179 public function setServers($servers_id,$project_id){ 179 public function setServers($servers_id,$project_id){
  180 + if(empty($servers_id)){
  181 + return $this->success();
  182 + }
180 //查看當前項目服務器是否有更改 183 //查看當前項目服務器是否有更改
181 $projectModel = new Project(); 184 $projectModel = new Project();
182 $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']); 185 $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']);