作者 lyh

Merge branch 'master-server' of http://47.244.231.31:8099/zhl/globalso-v6

@@ -24,6 +24,9 @@ class RemainDay extends Command @@ -24,6 +24,9 @@ class RemainDay extends Command
24 */ 24 */
25 protected $signature = 'remain_day'; 25 protected $signature = 'remain_day';
26 26
  27 + /**
  28 + * @var 按上线时间统计
  29 + */
27 protected $projectId = [ 30 protected $projectId = [
28 1434,1812 31 1434,1812
29 ];//需要单独处理的项目 32 ];//需要单独处理的项目
@@ -58,6 +61,14 @@ class RemainDay extends Command @@ -58,6 +61,14 @@ class RemainDay extends Command
58 { 61 {
59 $list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get(); 62 $list = Project::whereIn('type', [Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR])->get();
60 foreach ($list as $item){ 63 foreach ($list as $item){
  64 + if(in_array($item->id,$this->ceaseProjectId)){//暂停的项目
  65 + if($item['type'] == Project::TYPE_TWO && $item->is_compliance == 1){
  66 + $item->pause_days = $item->pause_days + 1;
  67 + }
  68 + if($item['type'] != Project::TYPE_THREE){
  69 + $item->pause_days = $item->pause_days + 1;
  70 + }
  71 + }
61 if(in_array($item->id,$this->projectId)){//已开始优化的时间结算 72 if(in_array($item->id,$this->projectId)){//已开始优化的时间结算
62 $optimizeModel = new DeployOptimize(); 73 $optimizeModel = new DeployOptimize();
63 $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']); 74 $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']);
@@ -65,22 +76,16 @@ class RemainDay extends Command @@ -65,22 +76,16 @@ class RemainDay extends Command
65 continue; 76 continue;
66 } 77 }
67 $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime); 78 $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime);
68 - $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); 79 + $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24));
69 }else{ 80 }else{
70 if($item['type'] == Project::TYPE_TWO){ 81 if($item['type'] == Project::TYPE_TWO){
71 - //获取当前项目的达标天数  
72 - if(in_array($item->id,$this->ceaseProjectId) && ($item->is_compliance == 1)){  
73 - //查看今日是否达标(已达标减1)  
74 - $item->finish_remain_day = (($item->finish_remain_day - 1) < 0) ? 0 : $item->finish_remain_day - 1;  
75 - $item->pause_days = $item->pause_days + 1;  
76 - }  
77 $compliance_day = $item->finish_remain_day ?? 0; 82 $compliance_day = $item->finish_remain_day ?? 0;
78 - $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; 83 + $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - $compliance_day;
79 }else{ 84 }else{
80 if($item->uptime){ 85 if($item->uptime){
81 $diff = time() - strtotime($item->uptime); 86 $diff = time() - strtotime($item->uptime);
82 $item->finish_remain_day = floor($diff / (60 * 60 * 24)); 87 $item->finish_remain_day = floor($diff / (60 * 60 * 24));
83 - $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); 88 + $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24));
84 }else{ 89 }else{
85 $remain_day = $item['deploy_build']['service_duration']; 90 $remain_day = $item['deploy_build']['service_duration'];
86 } 91 }
@@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\ExtentModule; @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\ExtentModule;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
  14 +use App\Http\Logic\Aside\ExtensionModule\ExtensionModuleLogic;
14 use App\Models\ExtentModule\ExtensionModule; 15 use App\Models\ExtentModule\ExtensionModule;
15 16
16 class ExtensionModuleController extends BaseController 17 class ExtensionModuleController extends BaseController
@@ -27,4 +28,40 @@ class ExtensionModuleController extends BaseController @@ -27,4 +28,40 @@ class ExtensionModuleController extends BaseController
27 $list = $extensionModuleModel->list(); 28 $list = $extensionModuleModel->list();
28 $this->response('success',Code::SUCCESS,$list); 29 $this->response('success',Code::SUCCESS,$list);
29 } 30 }
  31 +
  32 + /**
  33 + * @remark :保存拓展数据模块
  34 + * @name :saveModule
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2024/8/7 15:44
  38 + */
  39 + public function saveModule(ExtensionModuleLogic $logic){
  40 + $this->request->validate([
  41 + 'title'=>'required',
  42 + 'status'=>'required',
  43 + ],[
  44 + 'title.required' => '名称不能为空',
  45 + 'status.required' => '状态不能为空',
  46 + ]);
  47 + $data = $logic->saveExtensionModule();
  48 + $this->response('success',Code::SUCCESS,$data);
  49 + }
  50 +
  51 + /**
  52 + * @remark :删除模块
  53 + * @name :delModule
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2024/8/7 16:02
  57 + */
  58 + public function delModule(ExtensionModuleLogic $logic){
  59 + $this->request->validate([
  60 + 'id'=>'required',
  61 + ],[
  62 + 'id.required' => '名称不能为空',
  63 + ]);
  64 + $logic->delExtensionModule();
  65 + $this->response('success');
  66 + }
30 } 67 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModuleController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 16:15
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\ExtensionModule;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\ExtensionModule\ExtensionModuleFieldLogic;
  15 +use App\Models\ExtentModule\ExtensionModule;
  16 +use App\Models\ExtentModule\ExtensionModuleField;
  17 +use App\Models\ExtentModule\ExtensionModuleValue;
  18 +
  19 +class ExtensionModuleController extends BaseController
  20 +{
  21 + /**
  22 + * @remark :获取扩展数据模块
  23 + * @name :getModuleList
  24 + * @author :lyh
  25 + * @method :post
  26 + * @time :2024/8/7 16:16
  27 + */
  28 + public function getModuleList(){
  29 + $moduleModel = new ExtensionModule();
  30 + $this->map['status'] = 0;
  31 + $list = $moduleModel->list($this->map);
  32 + $this->response('success',Code::SUCCESS,$list);
  33 + }
  34 +
  35 + /**
  36 + * @remark :获取当前模块字段
  37 + * @name :getModuleFiledInfo
  38 + * @author :lyh
  39 + * @method :post
  40 + * @time :2024/8/7 16:20
  41 + */
  42 + public function getModuleFiledInfo(){
  43 + $this->request->validate([
  44 + 'module_id'=>'required',
  45 + ],[
  46 + 'module_id.required' => '模块id不能为空',
  47 + ]);
  48 + $moduleFieldModel = new ExtensionModuleField();
  49 + $list = $moduleFieldModel->list(['module_id'=>$this->param['module_id']]);
  50 + $this->response('success',Code::SUCCESS,$list);
  51 + }
  52 +
  53 + /**
  54 + * @remark :添加字段
  55 + * @name :saveModuleField
  56 + * @author :lyh
  57 + * @method :post
  58 + * @time :2024/8/7 16:27
  59 + */
  60 + public function saveModuleField(ExtensionModuleFieldLogic $logic){
  61 + $this->request->validate([
  62 + 'module_id'=>'required',
  63 + 'field_name'=>'required',
  64 + 'data_type'=>'required',
  65 + 'is_required'=>'required',
  66 + ],[
  67 + 'module_id.required' => '模块id不能为空',
  68 + 'field_name.required' => '字段名称不能为空',
  69 + 'data_type.required' => '数据类型不能为空',
  70 + 'is_required.required' => '是否必填不能为空',
  71 + ]);
  72 + $data = $logic->saveModuleField();
  73 + $this->response('success',Code::SUCCESS,$data);
  74 + }
  75 +
  76 + /**
  77 + * @remark :删除字段
  78 + * @name :delModuleField
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2024/8/7 17:10
  82 + */
  83 + public function delModuleField(ExtensionModuleFieldLogic $logic){
  84 + $this->request->validate([
  85 + 'filed_id'=>'required',
  86 + ],[
  87 + 'filed_id.required' => '字段id不能为空',
  88 + ]);
  89 + $logic->delModuleField();
  90 + $this->response('success');
  91 + }
  92 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModuleLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 15:48
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\ExtensionModule;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\ExtentModule\ExtensionModule;
  14 +use App\Models\ExtentModule\ExtensionModuleField;
  15 +
  16 +class ExtensionModuleLogic extends BaseLogic
  17 +{
  18 + public function __construct()
  19 + {
  20 + parent::__construct();
  21 + $this->model = new ExtensionModule();
  22 + $this->param = $this->requestAll;
  23 + }
  24 +
  25 + /**
  26 + * @remark :保存数据
  27 + * @name :saveExtensionModule
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2024/8/7 15:50
  31 + */
  32 + public function saveExtensionModule(){
  33 + //查看数据是否存在
  34 + if(isset($this->param['id']) && !empty($this->param['id'])){
  35 + $info = $this->model->read(['title'=>$this->param['title'],'id'=>['!=',$this->param['id']]]);
  36 + }else{
  37 + $info = $this->model->read(['title'=>$this->param['title']]);
  38 + }
  39 + if($info !== false){
  40 + $this->fail('当前拓展数据名称已存在');
  41 + }
  42 + $this->param['data'] = empty($this->param['data']) ? null : json_encode($this->param['data']);
  43 + if(isset($this->param['id']) && !empty($this->param['id'])){
  44 + $id = $this->param['id'];
  45 + $this->model->edit($this->param,['id'=>$id]);
  46 + }else{
  47 + $id = $this->model->addReturnId($this->param);
  48 + }
  49 + return $this->success(['id'=>$id]);
  50 + }
  51 +
  52 + /**
  53 + * @remark :删除扩展数据模块
  54 + * @name :delExtensionModule
  55 + * @author :lyh
  56 + * @method :post
  57 + * @time :2024/8/7 16:07
  58 + */
  59 + public function delExtensionModule(){
  60 + $moduleFiledModel = new ExtensionModuleField();
  61 + $info = $moduleFiledModel->read(['module_id'=>$this->param['id']]);
  62 + if($info !== false){
  63 + $this->fail('请先删除当前模块的字段,在进行删除');
  64 + }
  65 + $this->model->del(['id'=>$this->param['id']]);
  66 + return $this->success();
  67 + }
  68 +}
@@ -149,7 +149,10 @@ class CustomTemplateLogic extends BaseLogic @@ -149,7 +149,10 @@ class CustomTemplateLogic extends BaseLogic
149 } 149 }
150 } 150 }
151 $this->editCustomRoute($this->param['url']); 151 $this->editCustomRoute($this->param['url']);
152 - unset($this->param['html'],$this->param['html_style']); 152 + $this->param['is_visualization'] = isset($this->param['is_visualization']) ? $this->param['is_visualization'] : 0;
  153 + if($this->param['is_visualization'] == 0 || $this->param['is_visualization'] == 1){
  154 + unset($this->param['html'],$this->param['html_style']);
  155 + }
153 $this->model->edit($this->param,['id'=>$id]); 156 $this->model->edit($this->param,['id'=>$id]);
154 }else{ 157 }else{
155 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ 158 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModuleFieldLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 16:30
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\ExtensionModule;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\ExtentModule\ExtensionModuleField;
  14 +
  15 +class ExtensionModuleFieldLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->param = $this->requestAll;
  21 + $this->model = new ExtensionModuleField();
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存字段
  26 + * @name :saveModuleField
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2024/8/7 16:47
  30 + */
  31 + public function saveModuleField(){
  32 + //先查看当前字段是否存在
  33 + if(isset($this->param['id']) && !empty($this->param['id'])){
  34 + $info = $this->model->read(['field_name'=>$this->param['field_name'],'id'=>['!=',$this->param['id']]]);
  35 + }else{
  36 + $info = $this->model->read(['field_name'=>$this->param['field_name']]);
  37 + }
  38 + if($info !== false){
  39 + $this->fail('当前字段名已存在');
  40 + }
  41 + $id = $this->model->addReturnId($this->param);
  42 + return $this->success(['id'=>$id]);
  43 + }
  44 +
  45 + /**
  46 + * @remark :删除字段
  47 + * @name :delModuleField
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2024/8/7 17:14
  51 + */
  52 + public function delModuleField(){
  53 +
  54 + }
  55 +}
@@ -13,7 +13,6 @@ use App\Models\Base; @@ -13,7 +13,6 @@ use App\Models\Base;
13 13
14 class ExtensionModule extends Base 14 class ExtensionModule extends Base
15 { 15 {
16 -  
17 protected $table = 'gl_extension_module'; 16 protected $table = 'gl_extension_module';
18 //连接数据库 17 //连接数据库
19 protected $connection = 'custom_mysql'; 18 protected $connection = 'custom_mysql';
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModuleField.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 16:10
  8 + */
  9 +
  10 +namespace App\Models\ExtentModule;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ExtensionModuleField extends Base
  15 +{
  16 + protected $table = 'gl_extension_module_field';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModuleValue.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 16:10
  8 + */
  9 +
  10 +namespace App\Models\ExtentModule;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ExtensionModuleValue extends Base
  15 +{
  16 + protected $table = 'gl_extension_module_value';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}