Merge remote-tracking branch 'origin/master' into akun
正在显示
14 个修改的文件
包含
476 行增加
和
30 行删除
| @@ -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 | } |
| @@ -55,13 +55,13 @@ class UpdateRoute extends Command | @@ -55,13 +55,13 @@ class UpdateRoute extends Command | ||
| 55 | */ | 55 | */ |
| 56 | public function handle(){ | 56 | public function handle(){ |
| 57 | $projectModel = new Project(); | 57 | $projectModel = new Project(); |
| 58 | - $list = $projectModel->list(['id'=>['in',[802]]]); | 58 | + $list = $projectModel->list(['id'=>['in',[147]]]); |
| 59 | $data = []; | 59 | $data = []; |
| 60 | foreach ($list as $v){ | 60 | foreach ($list as $v){ |
| 61 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 61 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 62 | ProjectServer::useProject($v['id']); | 62 | ProjectServer::useProject($v['id']); |
| 63 | -// $this->getProduct(); | ||
| 64 | - $this->setProductKeyword(); | 63 | + $this->getProduct(); |
| 64 | +// $this->setProductKeyword(); | ||
| 65 | // $this->getBlog(); | 65 | // $this->getBlog(); |
| 66 | DB::disconnect('custom_mysql'); | 66 | DB::disconnect('custom_mysql'); |
| 67 | } | 67 | } |
| @@ -215,7 +215,7 @@ class UpdateRoute extends Command | @@ -215,7 +215,7 @@ class UpdateRoute extends Command | ||
| 215 | 215 | ||
| 216 | public function getProduct(){ | 216 | public function getProduct(){ |
| 217 | $productModel = new Product(); | 217 | $productModel = new Product(); |
| 218 | - $lists = $productModel->list(['status'=>1,'id'=>['<=',501]]); | 218 | + $lists = $productModel->list(['status'=>2]); |
| 219 | if(!empty($lists)){ | 219 | if(!empty($lists)){ |
| 220 | foreach ($lists as $v){ | 220 | foreach ($lists as $v){ |
| 221 | if(!empty($v['route'])){ | 221 | if(!empty($v['route'])){ |
| @@ -227,14 +227,15 @@ class UpdateRoute extends Command | @@ -227,14 +227,15 @@ class UpdateRoute extends Command | ||
| 227 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | 227 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); |
| 228 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 228 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 229 | }else{ | 229 | }else{ |
| 230 | -// echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 231 | -// $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 232 | -// $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 230 | + echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| 231 | + $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 232 | + $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 233 | } | 233 | } |
| 234 | continue; | 234 | continue; |
| 235 | }else{ | 235 | }else{ |
| 236 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 236 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| 237 | $v['title'] = Translate::tran($v['title'], 'en'); | 237 | $v['title'] = Translate::tran($v['title'], 'en'); |
| 238 | + $v['title'] = str_replace('.','',$v['title']).'-product'; | ||
| 238 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | 239 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); |
| 239 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 240 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 240 | } | 241 | } |
| @@ -11,7 +11,10 @@ namespace App\Http\Controllers\Aside\ExtentModule; | @@ -11,7 +11,10 @@ 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; |
| 16 | +use App\Services\ProjectServer; | ||
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 15 | 18 | ||
| 16 | class ExtensionModuleController extends BaseController | 19 | class ExtensionModuleController extends BaseController |
| 17 | { | 20 | { |
| @@ -23,8 +26,46 @@ class ExtensionModuleController extends BaseController | @@ -23,8 +26,46 @@ class ExtensionModuleController extends BaseController | ||
| 23 | * @time :2024/8/7 11:48 | 26 | * @time :2024/8/7 11:48 |
| 24 | */ | 27 | */ |
| 25 | public function getModuleLists(){ | 28 | public function getModuleLists(){ |
| 29 | + ProjectServer::useProject($this->map['project_id']); | ||
| 26 | $extensionModuleModel = new ExtensionModule(); | 30 | $extensionModuleModel = new ExtensionModule(); |
| 27 | $list = $extensionModuleModel->list(); | 31 | $list = $extensionModuleModel->list(); |
| 32 | + DB::disconnect('custom_mysql'); | ||
| 28 | $this->response('success',Code::SUCCESS,$list); | 33 | $this->response('success',Code::SUCCESS,$list); |
| 29 | } | 34 | } |
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @remark :保存拓展数据模块 | ||
| 38 | + * @name :saveModule | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2024/8/7 15:44 | ||
| 42 | + */ | ||
| 43 | + public function saveModule(ExtensionModuleLogic $logic){ | ||
| 44 | + $this->request->validate([ | ||
| 45 | + 'title'=>'required', | ||
| 46 | + 'status'=>'required', | ||
| 47 | + ],[ | ||
| 48 | + 'title.required' => '名称不能为空', | ||
| 49 | + 'status.required' => '状态不能为空', | ||
| 50 | + ]); | ||
| 51 | + $data = $logic->saveExtensionModule(); | ||
| 52 | + $this->response('success',Code::SUCCESS,$data); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * @remark :删除模块 | ||
| 57 | + * @name :delModule | ||
| 58 | + * @author :lyh | ||
| 59 | + * @method :post | ||
| 60 | + * @time :2024/8/7 16:02 | ||
| 61 | + */ | ||
| 62 | + public function delModule(ExtensionModuleLogic $logic){ | ||
| 63 | + $this->request->validate([ | ||
| 64 | + 'id'=>'required', | ||
| 65 | + ],[ | ||
| 66 | + 'id.required' => '名称不能为空', | ||
| 67 | + ]); | ||
| 68 | + $logic->delExtensionModule(); | ||
| 69 | + $this->response('success'); | ||
| 70 | + } | ||
| 30 | } | 71 | } |
| 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 | +use Illuminate\Support\Facades\DB; | ||
| 19 | + | ||
| 20 | +class ExtensionModuleController extends BaseController | ||
| 21 | +{ | ||
| 22 | + /** | ||
| 23 | + * @remark :获取扩展数据模块 | ||
| 24 | + * @name :getModuleList | ||
| 25 | + * @author :lyh | ||
| 26 | + * @method :post | ||
| 27 | + * @time :2024/8/7 16:16 | ||
| 28 | + */ | ||
| 29 | + public function getModuleList(){ | ||
| 30 | + $moduleModel = new ExtensionModule(); | ||
| 31 | + $this->map['status'] = 0; | ||
| 32 | + $list = $moduleModel->list($this->map); | ||
| 33 | + $this->response('success',Code::SUCCESS,$list); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @remark :获取数据类型 | ||
| 38 | + * @name :getDataType | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2024/8/7 17:31 | ||
| 42 | + */ | ||
| 43 | + public function getDataType(){ | ||
| 44 | + $data = [ | ||
| 45 | + '1'=>'文本框', | ||
| 46 | + '2'=>'多文本输入框', | ||
| 47 | + '3'=>'图片框', | ||
| 48 | + '4'=>'文件框', | ||
| 49 | + '5'=>'下拉框', | ||
| 50 | + '6'=>'自动生成订单框' | ||
| 51 | + ]; | ||
| 52 | + $this->response('success',Code::SUCCESS,$data); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * @remark :获取当前模块字段 | ||
| 57 | + * @name :getModuleFiledInfo | ||
| 58 | + * @author :lyh | ||
| 59 | + * @method :post | ||
| 60 | + * @time :2024/8/7 16:20 | ||
| 61 | + */ | ||
| 62 | + public function getModuleFiledInfo(){ | ||
| 63 | + $this->request->validate([ | ||
| 64 | + 'module_id'=>'required', | ||
| 65 | + ],[ | ||
| 66 | + 'module_id.required' => '模块id不能为空', | ||
| 67 | + ]); | ||
| 68 | + $moduleFieldModel = new ExtensionModuleField(); | ||
| 69 | + $list = $moduleFieldModel->list(['module_id'=>$this->param['module_id']]); | ||
| 70 | + $this->response('success',Code::SUCCESS,$list); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * @remark :添加字段 | ||
| 75 | + * @name :saveModuleField | ||
| 76 | + * @author :lyh | ||
| 77 | + * @method :post | ||
| 78 | + * @time :2024/8/7 16:27 | ||
| 79 | + */ | ||
| 80 | + public function saveModuleField(ExtensionModuleFieldLogic $logic){ | ||
| 81 | + $this->request->validate([ | ||
| 82 | + 'module_id'=>'required', | ||
| 83 | + 'field_name'=>'required', | ||
| 84 | + 'data_type'=>'required', | ||
| 85 | + 'is_required'=>'required', | ||
| 86 | + ],[ | ||
| 87 | + 'module_id.required' => '模块id不能为空', | ||
| 88 | + 'field_name.required' => '字段名称不能为空', | ||
| 89 | + 'data_type.required' => '数据类型不能为空', | ||
| 90 | + 'is_required.required' => '是否必填不能为空', | ||
| 91 | + ]); | ||
| 92 | + $data = $logic->saveModuleField(); | ||
| 93 | + $this->response('success',Code::SUCCESS,$data); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * @remark :删除字段 | ||
| 98 | + * @name :delModuleField | ||
| 99 | + * @author :lyh | ||
| 100 | + * @method :post | ||
| 101 | + * @time :2024/8/7 17:10 | ||
| 102 | + */ | ||
| 103 | + public function delModuleField(ExtensionModuleFieldLogic $logic){ | ||
| 104 | + $this->request->validate([ | ||
| 105 | + 'field_id'=>'required', | ||
| 106 | + ],[ | ||
| 107 | + 'field_id.required' => '字段id不能为空', | ||
| 108 | + ]); | ||
| 109 | + $logic->delModuleField(); | ||
| 110 | + $this->response('success'); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @remark :获取当前模块的所有数据 | ||
| 115 | + * @name :getModuleValueList | ||
| 116 | + * @author :lyh | ||
| 117 | + * @method :post | ||
| 118 | + * @time :2024/8/7 17:37 | ||
| 119 | + */ | ||
| 120 | + public function getModuleValueList(){ | ||
| 121 | + $this->request->validate([ | ||
| 122 | + 'module_id'=>'required', | ||
| 123 | + ],[ | ||
| 124 | + 'module_id.required' => '模块id不能为空', | ||
| 125 | + ]); | ||
| 126 | + $data = []; | ||
| 127 | + $moduleValueModel = new ExtensionModuleValue(); | ||
| 128 | + $lists = $moduleValueModel->list(['module_id'=>$this->param['module_id']]); | ||
| 129 | + if(!empty($lists)){ | ||
| 130 | + foreach ($lists as $k => $v){ | ||
| 131 | + $data[$v['uuid']][$v['field_id']] = $v['value']; | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + $this->response('success',Code::SUCCESS,$data); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * @remark :保存数据 | ||
| 139 | + * @name :saveModuleValue | ||
| 140 | + * @author :lyh | ||
| 141 | + * @method :post | ||
| 142 | + * @time :2024/8/7 17:59 | ||
| 143 | + */ | ||
| 144 | + public function editModuleValue(){ | ||
| 145 | + $this->request->validate([ | ||
| 146 | + 'module_id'=>'required', | ||
| 147 | + ],[ | ||
| 148 | + 'module_id.required' => '模块id不能为空', | ||
| 149 | + ]); | ||
| 150 | + $data = $this->param['data']; | ||
| 151 | + $moduleValueModel = new ExtensionModuleValue(); | ||
| 152 | + foreach ($data as $k => $v){ | ||
| 153 | + $info = $moduleValueModel->read(['uuid'=>$this->param['uuid'],'field_id'=>$v['field_id'],'module_id'=>$this->param['module_id']]); | ||
| 154 | + if($info === false){ | ||
| 155 | + $data = [ | ||
| 156 | + 'uuid'=>$this->param['uuid'], | ||
| 157 | + 'module_id'=>$this->param['module_id'], | ||
| 158 | + 'field_id'=>$v['field_id'], | ||
| 159 | + 'value'=>$v['value'] | ||
| 160 | + ]; | ||
| 161 | + $moduleValueModel->addReturnId($data); | ||
| 162 | + }else{ | ||
| 163 | + $moduleValueModel->edit(['value'=>$v['value']],['id'=>$info['id']]); | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + $this->response('success',Code::SUCCESS,['uuid'=>$this->param['uuid']]); | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * @remark :新增數據 | ||
| 171 | + * @name :addModuleValue | ||
| 172 | + * @author :lyh | ||
| 173 | + * @method :post | ||
| 174 | + * @time :2024/8/8 10:00 | ||
| 175 | + */ | ||
| 176 | + public function addModuleValue(){ | ||
| 177 | + $this->request->validate([ | ||
| 178 | + 'module_id'=>'required', | ||
| 179 | + ],[ | ||
| 180 | + 'module_id.required' => '模块id不能为空', | ||
| 181 | + ]); | ||
| 182 | + $moduleValueModel = new ExtensionModuleValue(); | ||
| 183 | + $info = $moduleValueModel->where('module_id',$this->param['module_id'])->orderBy('uuid','desc')->first()->toArray(); | ||
| 184 | + if(empty($info)){ | ||
| 185 | + $uuid = 1; | ||
| 186 | + }else{ | ||
| 187 | + $uuid = $info['uuid'] + 1; | ||
| 188 | + } | ||
| 189 | + $data = $this->param['data']; | ||
| 190 | + $moduleValueModel = new ExtensionModuleValue(); | ||
| 191 | + foreach ($data as $k => $v){ | ||
| 192 | + $data = [ | ||
| 193 | + 'uuid'=>$uuid, | ||
| 194 | + 'module_id'=>$this->param['module_id'], | ||
| 195 | + 'field_id'=>$v['field_id'], | ||
| 196 | + 'value'=>$v['value'] | ||
| 197 | + ]; | ||
| 198 | + $moduleValueModel->addReturnId($data); | ||
| 199 | + } | ||
| 200 | + $this->response('success',Code::SUCCESS,['uuid'=>$this->param['uuid']]); | ||
| 201 | + } | ||
| 202 | +} |
| @@ -85,6 +85,7 @@ class KeywordController extends BaseController | @@ -85,6 +85,7 @@ class KeywordController extends BaseController | ||
| 85 | } | 85 | } |
| 86 | $map['route'] = ['<>','']; | 86 | $map['route'] = ['<>','']; |
| 87 | $map['project_id'] = $this->user['project_id']; | 87 | $map['project_id'] = $this->user['project_id']; |
| 88 | + $map['deleted_at'] = null; | ||
| 88 | return $this->success($map); | 89 | return $this->success($map); |
| 89 | } | 90 | } |
| 90 | 91 |
| 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 | +use App\Services\ProjectServer; | ||
| 16 | +use Illuminate\Support\Facades\DB; | ||
| 17 | + | ||
| 18 | +class ExtensionModuleLogic extends BaseLogic | ||
| 19 | +{ | ||
| 20 | + public function __construct() | ||
| 21 | + { | ||
| 22 | + parent::__construct(); | ||
| 23 | + $this->param = $this->requestAll; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @remark :保存数据 | ||
| 28 | + * @name :saveExtensionModule | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2024/8/7 15:50 | ||
| 32 | + */ | ||
| 33 | + public function saveExtensionModule(){ | ||
| 34 | + ProjectServer::useProject($this->param['project_id']); | ||
| 35 | + unset($this->param['project_id']); | ||
| 36 | + $this->model = new ExtensionModule(); | ||
| 37 | + //查看数据是否存在 | ||
| 38 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 39 | + $info = $this->model->read(['title'=>$this->param['title'],'id'=>['!=',$this->param['id']]]); | ||
| 40 | + }else{ | ||
| 41 | + $info = $this->model->read(['title'=>$this->param['title']]); | ||
| 42 | + } | ||
| 43 | + if($info !== false){ | ||
| 44 | + $this->fail('当前拓展数据名称已存在'); | ||
| 45 | + } | ||
| 46 | + $this->param['data'] = empty($this->param['data']) ? null : json_encode($this->param['data']); | ||
| 47 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 48 | + $id = $this->param['id']; | ||
| 49 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 50 | + }else{ | ||
| 51 | + $id = $this->model->addReturnId($this->param); | ||
| 52 | + } | ||
| 53 | + DB::disconnect('custom_mysql'); | ||
| 54 | + return $this->success(['id'=>$id]); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @remark :删除扩展数据模块 | ||
| 59 | + * @name :delExtensionModule | ||
| 60 | + * @author :lyh | ||
| 61 | + * @method :post | ||
| 62 | + * @time :2024/8/7 16:07 | ||
| 63 | + */ | ||
| 64 | + public function delExtensionModule(){ | ||
| 65 | + ProjectServer::useProject($this->param['project_id']); | ||
| 66 | + unset($this->param['project_id']); | ||
| 67 | + $moduleFiledModel = new ExtensionModuleField(); | ||
| 68 | + $info = $moduleFiledModel->read(['module_id'=>$this->param['id']]); | ||
| 69 | + if($info !== false){ | ||
| 70 | + $this->fail('请先删除当前模块的字段,在进行删除'); | ||
| 71 | + } | ||
| 72 | + $this->model = new ExtensionModule(); | ||
| 73 | + $this->model->del(['id'=>$this->param['id']]); | ||
| 74 | + DB::disconnect('custom_mysql'); | ||
| 75 | + return $this->success(); | ||
| 76 | + } | ||
| 77 | +} |
| @@ -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){ |
| @@ -213,7 +216,6 @@ class CustomTemplateLogic extends BaseLogic | @@ -213,7 +216,6 @@ class CustomTemplateLogic extends BaseLogic | ||
| 213 | if($bSettingInfo === false){ | 216 | if($bSettingInfo === false){ |
| 214 | $this->fail('请先选择模版'); | 217 | $this->fail('请先选择模版'); |
| 215 | } | 218 | } |
| 216 | - | ||
| 217 | $handleInfo = $this->handleResultParam($html); | 219 | $handleInfo = $this->handleResultParam($html); |
| 218 | if(!isset($this->param['template_status'])){//代表直接替换模版 不更新头部底部 | 220 | if(!isset($this->param['template_status'])){//代表直接替换模版 不更新头部底部 |
| 219 | $this->saveTemplateCom($handleInfo,$bSettingInfo['template_id']); | 221 | $this->saveTemplateCom($handleInfo,$bSettingInfo['template_id']); |
| @@ -304,8 +306,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -304,8 +306,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 304 | }else{ | 306 | }else{ |
| 305 | $param['html'] = $handleInfo['other']; | 307 | $param['html'] = $handleInfo['other']; |
| 306 | $param['html_style'] = null; | 308 | $param['html_style'] = null; |
| 307 | - $type == BTemplate::COMMON_HEAD; | ||
| 308 | - $typeSource = $this->getType($type); | 309 | + $typeSource = $this->getType(); |
| 309 | } | 310 | } |
| 310 | //查看当前数据是否还存在 | 311 | //查看当前数据是否还存在 |
| 311 | $condition = ['template_id'=>$template_id,'source'=>$typeSource,'common_type'=>$type]; | 312 | $condition = ['template_id'=>$template_id,'source'=>$typeSource,'common_type'=>$type]; |
| @@ -477,15 +478,14 @@ class CustomTemplateLogic extends BaseLogic | @@ -477,15 +478,14 @@ class CustomTemplateLogic extends BaseLogic | ||
| 477 | //获取当前数据详情 | 478 | //获取当前数据详情 |
| 478 | $info = $this->model->read(['id'=>$logInfo['source_id']],['is_visualization']); | 479 | $info = $this->model->read(['id'=>$logInfo['source_id']],['is_visualization']); |
| 479 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ | 480 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ |
| 480 | - //还原头部底部 | ||
| 481 | - $type = $this->getType(); | ||
| 482 | //还原头部+底部 | 481 | //还原头部+底部 |
| 483 | - $commonData = [ | ||
| 484 | - 'head_html'=>$logInfo['head_html'], 'head_css'=>$logInfo['head_css'], | ||
| 485 | - 'footer_html'=>$logInfo['footer_html'], 'footer_css'=>$logInfo['footer_css'] | ||
| 486 | - ]; | ||
| 487 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 488 | - $commonTemplateModel->edit($commonData,['template_id'=>$logInfo['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]); | 482 | + $comTemplateModel = new BTemplateCom(); |
| 483 | + //还原头部底部 | ||
| 484 | + $header_type = $this->getType(BTemplate::COMMON_HEAD); | ||
| 485 | + $comTemplateModel->edit(['html'=>$logInfo['other']],['template_id'=>$logInfo['template_id'],'source'=>$header_type,'project_id'=>$this->user['project_id'],'common_type'=>BTemplate::COMMON_OTHER]); | ||
| 486 | + $comTemplateModel->edit(['html'=>$logInfo['head_html'], 'html_style'=>$logInfo['head_css']],['template_id'=>$logInfo['template_id'],'source'=>$header_type,'project_id'=>$this->user['project_id'],'common_type'=>BTemplate::COMMON_HEAD]); | ||
| 487 | + $footer_type = $this->getType(BTemplate::COMMON_FOOTER); | ||
| 488 | + $comTemplateModel->edit(['html'=>$logInfo['footer_html'], 'html_style'=>$logInfo['footer_css']],['template_id'=>$logInfo['template_id'],'source'=>$footer_type,'project_id'=>$this->user['project_id'],'common_type'=>BTemplate::COMMON_FOOTER]); | ||
| 489 | $this->model->edit(['html'=>$logInfo['main_html'],'html_style'=>$logInfo['main_css']],['id'=>$logInfo['source_id']]); | 489 | $this->model->edit(['html'=>$logInfo['main_html'],'html_style'=>$logInfo['main_css']],['id'=>$logInfo['source_id']]); |
| 490 | }else{ | 490 | }else{ |
| 491 | $this->model->edit(['html'=>$logInfo['text']],['id'=>$logInfo['source_id']]); | 491 | $this->model->edit(['html'=>$logInfo['text']],['id'=>$logInfo['source_id']]); |
| 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 | +use App\Models\ExtentModule\ExtensionModuleValue; | ||
| 15 | + | ||
| 16 | +class ExtensionModuleFieldLogic extends BaseLogic | ||
| 17 | +{ | ||
| 18 | + public function __construct() | ||
| 19 | + { | ||
| 20 | + parent::__construct(); | ||
| 21 | + $this->param = $this->requestAll; | ||
| 22 | + $this->model = new ExtensionModuleField(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark :保存字段 | ||
| 27 | + * @name :saveModuleField | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2024/8/7 16:47 | ||
| 31 | + */ | ||
| 32 | + public function saveModuleField(){ | ||
| 33 | + //先查看当前字段是否存在 | ||
| 34 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 35 | + $info = $this->model->read(['field_name'=>$this->param['field_name'],'id'=>['!=',$this->param['id']]]); | ||
| 36 | + }else{ | ||
| 37 | + $info = $this->model->read(['field_name'=>$this->param['field_name']]); | ||
| 38 | + } | ||
| 39 | + if($info !== false){ | ||
| 40 | + $this->fail('当前字段名已存在'); | ||
| 41 | + } | ||
| 42 | + $id = $this->model->addReturnId($this->param); | ||
| 43 | + return $this->success(['id'=>$id]); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @remark :删除字段 | ||
| 48 | + * @name :delModuleField | ||
| 49 | + * @author :lyh | ||
| 50 | + * @method :post | ||
| 51 | + * @time :2024/8/7 17:14 | ||
| 52 | + */ | ||
| 53 | + public function delModuleField(){ | ||
| 54 | + //查看当前字段是否在使用 | ||
| 55 | + $moduleValueModel = new ExtensionModuleValue(); | ||
| 56 | + $info = $moduleValueModel->read(['filed_id'=>$this->param['filed_id']]); | ||
| 57 | + if($info !== false){ | ||
| 58 | + $this->fail('当前字段正在使用中,不允许删除'); | ||
| 59 | + } | ||
| 60 | + $this->model->del(['id'=>$this->param['filed_id']]); | ||
| 61 | + return $this->success(); | ||
| 62 | + } | ||
| 63 | +} |
| @@ -215,7 +215,6 @@ class ProductLogic extends BaseLogic | @@ -215,7 +215,6 @@ class ProductLogic extends BaseLogic | ||
| 215 | try { | 215 | try { |
| 216 | if(isset($this->param['route']) && !empty($this->param['route'])){ | 216 | if(isset($this->param['route']) && !empty($this->param['route'])){ |
| 217 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 217 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 218 | -// $this->editProductRoute($this->param['id'],$this->param['route']); | ||
| 219 | } | 218 | } |
| 220 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 219 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 221 | //产品分类关联 | 220 | //产品分类关联 |
| @@ -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 | +} |
| @@ -454,6 +454,14 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -454,6 +454,14 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 454 | Route::any('/info', [Aside\Devops\ServersIpController::class, 'info'])->name('admin.servers_info'); | 454 | Route::any('/info', [Aside\Devops\ServersIpController::class, 'info'])->name('admin.servers_info'); |
| 455 | Route::any('/downloadFile', [Aside\Devops\ServersIpController::class, 'downloadFile'])->name('admin.servers_downloadFile'); | 455 | Route::any('/downloadFile', [Aside\Devops\ServersIpController::class, 'downloadFile'])->name('admin.servers_downloadFile'); |
| 456 | }); | 456 | }); |
| 457 | + /** | ||
| 458 | + * 拓展数据模块 | ||
| 459 | + */ | ||
| 460 | + Route::prefix('extension_module')->group(function () { | ||
| 461 | + Route::any('/', [Aside\ExtentModule\ExtensionModuleController::class, 'getModuleLists'])->name('admin.extension_module_getModuleLists'); | ||
| 462 | + Route::any('/saveModule', [Aside\ExtentModule\ExtensionModuleController::class, 'saveModule'])->name('admin.extension_module_saveModule'); | ||
| 463 | + Route::any('/delModule', [Aside\ExtentModule\ExtensionModuleController::class, 'delModule'])->name('admin.extension_module_delModule'); | ||
| 464 | + }); | ||
| 457 | }); | 465 | }); |
| 458 | 466 | ||
| 459 | //无需登录验证的路由组 | 467 | //无需登录验证的路由组 |
| @@ -566,6 +566,18 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -566,6 +566,18 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 566 | Route::any('/saveLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'saveLanguageTxt'])->name('language_txt_saveLanguageTxt'); | 566 | Route::any('/saveLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'saveLanguageTxt'])->name('language_txt_saveLanguageTxt'); |
| 567 | Route::any('/delLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'delLanguageTxt'])->name('language_txt_delLanguageTxt'); | 567 | Route::any('/delLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'delLanguageTxt'])->name('language_txt_delLanguageTxt'); |
| 568 | }); | 568 | }); |
| 569 | + | ||
| 570 | + //获取拓展数据模块 | ||
| 571 | + Route::prefix('extension_module')->group(function () { | ||
| 572 | + Route::any('/getModuleList', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getModuleList'])->name('extension_module_getModuleList'); | ||
| 573 | + Route::any('/getDataType', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getDataType'])->name('extension_module_getDataType'); | ||
| 574 | + Route::any('/getModuleFiledInfo', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getModuleFiledInfo'])->name('extension_module_getModuleFiledInfo'); | ||
| 575 | + Route::any('/saveModuleField', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'saveModuleField'])->name('extension_module_saveModuleField'); | ||
| 576 | + Route::any('/delModuleField', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'delModuleField'])->name('extension_module_delModuleField'); | ||
| 577 | + Route::any('/getModuleValueList', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getModuleValueList'])->name('extension_module_getModuleValueList'); | ||
| 578 | + Route::any('/addModuleValue', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'addModuleValue'])->name('extension_module_addModuleValue'); | ||
| 579 | + Route::any('/editModuleValue', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'editModuleValue'])->name('extension_module_editModuleValue'); | ||
| 580 | + }); | ||
| 569 | }); | 581 | }); |
| 570 | //无需登录验证的路由组 | 582 | //无需登录验证的路由组 |
| 571 | Route::group([], function () { | 583 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论