正在显示
4 个修改的文件
包含
89 行增加
和
17 行删除
| @@ -68,7 +68,6 @@ class UpdateRoute extends Command | @@ -68,7 +68,6 @@ class UpdateRoute extends Command | ||
| 68 | */ | 68 | */ |
| 69 | public function getProductKeyword(){ | 69 | public function getProductKeyword(){ |
| 70 | $keywordModel = new Keyword(); | 70 | $keywordModel = new Keyword(); |
| 71 | -<<<<<<< HEAD | ||
| 72 | $lists = $keywordModel->list(['route'=>'']); | 71 | $lists = $keywordModel->list(['route'=>'']); |
| 73 | if(!empty($lists)){ | 72 | if(!empty($lists)){ |
| 74 | foreach ($lists as $v){ | 73 | foreach ($lists as $v){ |
| @@ -76,15 +75,6 @@ class UpdateRoute extends Command | @@ -76,15 +75,6 @@ class UpdateRoute extends Command | ||
| 76 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); | 75 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); |
| 77 | $this->curlDelRoute(['new_route'=>$route]); | 76 | $this->curlDelRoute(['new_route'=>$route]); |
| 78 | $this->model->edit(['route'=>$route],['id'=>$v['id']]); | 77 | $this->model->edit(['route'=>$route],['id'=>$v['id']]); |
| 79 | -======= | ||
| 80 | - $lists = $keywordModel->list(['route'=>null]); | ||
| 81 | - if(!empty($lists)){ | ||
| 82 | - foreach ($lists as $v){ | ||
| 83 | - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 84 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], 75); | ||
| 85 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 86 | - $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 87 | ->>>>>>> 8178402b9bc03df4ea9fefb41f4f06aaeb5f6cb5 | ||
| 88 | echo date('Y-m-d H:i:s') . 'end :'.$route . PHP_EOL; | 78 | echo date('Y-m-d H:i:s') . 'end :'.$route . PHP_EOL; |
| 89 | } | 79 | } |
| 90 | } | 80 | } |
| @@ -13,6 +13,8 @@ use App\Enums\Common\Code; | @@ -13,6 +13,8 @@ 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\CustomModule\CustomModuleLogic; | 14 | use App\Http\Logic\Aside\CustomModule\CustomModuleLogic; |
| 15 | use App\Models\CustomModule\CustomModule; | 15 | use App\Models\CustomModule\CustomModule; |
| 16 | +use App\Services\ProjectServer; | ||
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 16 | 18 | ||
| 17 | /** | 19 | /** |
| 18 | * @remark :自定义模块 | 20 | * @remark :自定义模块 |
| @@ -30,9 +32,12 @@ class CustomModuleController extends BaseController | @@ -30,9 +32,12 @@ class CustomModuleController extends BaseController | ||
| 30 | * @method :post | 32 | * @method :post |
| 31 | * @time :2023/12/4 15:43 | 33 | * @time :2023/12/4 15:43 |
| 32 | */ | 34 | */ |
| 33 | - public function lists(CustomModule $customModule){ | 35 | + public function lists(){ |
| 36 | + ProjectServer::useProject($this->param['project_id']); | ||
| 37 | + $customModule = new CustomModule(); | ||
| 34 | $this->map['status'] = 0; | 38 | $this->map['status'] = 0; |
| 35 | $lists = $customModule->lists($this->map,$this->page,$this->row,$this->order); | 39 | $lists = $customModule->lists($this->map,$this->page,$this->row,$this->order); |
| 40 | + DB::disconnect('custom_mysql'); | ||
| 36 | $this->response('success',Code::SUCCESS,$lists); | 41 | $this->response('success',Code::SUCCESS,$lists); |
| 37 | } | 42 | } |
| 38 | 43 |
| @@ -13,6 +13,8 @@ use App\Http\Logic\Aside\BaseLogic; | @@ -13,6 +13,8 @@ use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | use App\Models\CustomModule\CustomModule; | 13 | use App\Models\CustomModule\CustomModule; |
| 14 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 15 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 16 | +use App\Services\ProjectServer; | ||
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 16 | 18 | ||
| 17 | class CustomModuleLogic extends BaseLogic | 19 | class CustomModuleLogic extends BaseLogic |
| 18 | { | 20 | { |
| @@ -20,7 +22,6 @@ class CustomModuleLogic extends BaseLogic | @@ -20,7 +22,6 @@ class CustomModuleLogic extends BaseLogic | ||
| 20 | { | 22 | { |
| 21 | parent::__construct(); | 23 | parent::__construct(); |
| 22 | $this->param = $this->requestAll; | 24 | $this->param = $this->requestAll; |
| 23 | - $this->model = new CustomModule(); | ||
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | /** | 27 | /** |
| @@ -31,10 +32,12 @@ class CustomModuleLogic extends BaseLogic | @@ -31,10 +32,12 @@ class CustomModuleLogic extends BaseLogic | ||
| 31 | * @time :2023/12/4 16:10 | 32 | * @time :2023/12/4 16:10 |
| 32 | */ | 33 | */ |
| 33 | public function getCustomModuleInfo(){ | 34 | public function getCustomModuleInfo(){ |
| 34 | - $info = $this->model->read($this->param); | 35 | + ProjectServer::useProject($this->param['project_id']); |
| 36 | + $info = (new CustomModule())->read($this->param); | ||
| 35 | if($info === false){ | 37 | if($info === false){ |
| 36 | $this->fail('当前数据不存在或已被删除'); | 38 | $this->fail('当前数据不存在或已被删除'); |
| 37 | } | 39 | } |
| 40 | + DB::disconnect('custom_mysql'); | ||
| 38 | return $this->success($info); | 41 | return $this->success($info); |
| 39 | } | 42 | } |
| 40 | 43 | ||
| @@ -78,10 +81,12 @@ class CustomModuleLogic extends BaseLogic | @@ -78,10 +81,12 @@ class CustomModuleLogic extends BaseLogic | ||
| 78 | * @time :2023/12/5 9:39 | 81 | * @time :2023/12/5 9:39 |
| 79 | */ | 82 | */ |
| 80 | public function moduleAdd(){ | 83 | public function moduleAdd(){ |
| 81 | - $rs = $this->model->add($this->param); | 84 | + ProjectServer::useProject($this->param['project_id']); |
| 85 | + $rs = (new CustomModule())->add($this->param); | ||
| 82 | if($rs === false){ | 86 | if($rs === false){ |
| 83 | $this->fail('系统错误,请联系管理员'); | 87 | $this->fail('系统错误,请联系管理员'); |
| 84 | } | 88 | } |
| 89 | + DB::disconnect('custom_mysql'); | ||
| 85 | return $this->success(); | 90 | return $this->success(); |
| 86 | } | 91 | } |
| 87 | 92 | ||
| @@ -93,10 +98,12 @@ class CustomModuleLogic extends BaseLogic | @@ -93,10 +98,12 @@ class CustomModuleLogic extends BaseLogic | ||
| 93 | * @time :2023/12/5 9:39 | 98 | * @time :2023/12/5 9:39 |
| 94 | */ | 99 | */ |
| 95 | public function moduleEdit(){ | 100 | public function moduleEdit(){ |
| 96 | - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 101 | + ProjectServer::useProject($this->param['project_id']); |
| 102 | + $rs = (new CustomModule())->edit($this->param,['id'=>$this->param['id']]); | ||
| 97 | if($rs === false){ | 103 | if($rs === false){ |
| 98 | $this->fail('系统错误,请联系管理员'); | 104 | $this->fail('系统错误,请联系管理员'); |
| 99 | } | 105 | } |
| 106 | + DB::disconnect('custom_mysql'); | ||
| 100 | return $this->success(); | 107 | return $this->success(); |
| 101 | } | 108 | } |
| 102 | 109 | ||
| @@ -108,6 +115,7 @@ class CustomModuleLogic extends BaseLogic | @@ -108,6 +115,7 @@ class CustomModuleLogic extends BaseLogic | ||
| 108 | * @time :2023/12/4 15:47 | 115 | * @time :2023/12/4 15:47 |
| 109 | */ | 116 | */ |
| 110 | public function customModuleDel(){ | 117 | public function customModuleDel(){ |
| 118 | + ProjectServer::useProject($this->param['project_id']); | ||
| 111 | //查看当前模块是否拥有数据 | 119 | //查看当前模块是否拥有数据 |
| 112 | $contentModel = new CustomModuleContent(); | 120 | $contentModel = new CustomModuleContent(); |
| 113 | $contentInfo = $contentModel->read(['module_id'=>$this->param['id']],['id']); | 121 | $contentInfo = $contentModel->read(['module_id'=>$this->param['id']],['id']); |
| @@ -123,6 +131,7 @@ class CustomModuleLogic extends BaseLogic | @@ -123,6 +131,7 @@ class CustomModuleLogic extends BaseLogic | ||
| 123 | if($rs === false){ | 131 | if($rs === false){ |
| 124 | $this->fail('系统错误,请联系管理员'); | 132 | $this->fail('系统错误,请联系管理员'); |
| 125 | } | 133 | } |
| 134 | + DB::disconnect('custom_mysql'); | ||
| 126 | return $this->success(); | 135 | return $this->success(); |
| 127 | } | 136 | } |
| 128 | } | 137 | } |
| @@ -63,7 +63,7 @@ class BTemplateLogic extends BaseLogic | @@ -63,7 +63,7 @@ class BTemplateLogic extends BaseLogic | ||
| 63 | */ | 63 | */ |
| 64 | public function getTemplate(){ | 64 | public function getTemplate(){ |
| 65 | $settingInfo = $this->getSettingTemplate();//模版详情 | 65 | $settingInfo = $this->getSettingTemplate();//模版详情 |
| 66 | - $data = $this->getTemplateHtml($settingInfo,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0); | 66 | + $data = $this->getHtml($settingInfo,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0); |
| 67 | return $this->success($data); | 67 | return $this->success($data); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -74,7 +74,7 @@ class BTemplateLogic extends BaseLogic | @@ -74,7 +74,7 @@ class BTemplateLogic extends BaseLogic | ||
| 74 | * @method :post | 74 | * @method :post |
| 75 | * @time :2023/12/13 10:47 | 75 | * @time :2023/12/13 10:47 |
| 76 | */ | 76 | */ |
| 77 | - public function getTemplateHtml($settingInfo,$source,$source_id,$is_custom = 0){ | 77 | + public function getHtml($settingInfo,$source,$source_id,$is_custom = 0){ |
| 78 | $templateInfo = $this->webTemplateInfo($settingInfo['template_id'],$source,$source_id,$is_custom); | 78 | $templateInfo = $this->webTemplateInfo($settingInfo['template_id'],$source,$source_id,$is_custom); |
| 79 | if($templateInfo === false){ | 79 | if($templateInfo === false){ |
| 80 | if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据 | 80 | if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据 |
| @@ -327,6 +327,56 @@ class BTemplateLogic extends BaseLogic | @@ -327,6 +327,56 @@ class BTemplateLogic extends BaseLogic | ||
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | /** | 329 | /** |
| 330 | + * @remark :可视化保存html | ||
| 331 | + * @name :saveHtml | ||
| 332 | + * @author :lyh | ||
| 333 | + * @method :post | ||
| 334 | + * @time :2023/12/13 17:02 | ||
| 335 | + */ | ||
| 336 | + public function saveHtml($html,$source,$source_id,$template_id = 0,$is_custom = 0){ | ||
| 337 | + $this->saveCommonHtml($html,$source,$source_id,$template_id);//保存头部底部 | ||
| 338 | + $info = $this->webTemplateInfo($this->param['template_id'],$source,$source_id,$is_custom); | ||
| 339 | + if($info === false){ | ||
| 340 | + $data = []; | ||
| 341 | + $this->model->add($data); | ||
| 342 | + }else{ | ||
| 343 | + $data = []; | ||
| 344 | + $this->model->edit($data); | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + | ||
| 349 | + /** | ||
| 350 | + * @remark :保存公共头部底部 | ||
| 351 | + * @name :saveCommonHtml | ||
| 352 | + * @author :lyh | ||
| 353 | + * @method :post | ||
| 354 | + * @time :2023/12/13 17:05 | ||
| 355 | + */ | ||
| 356 | + public function saveCommonHtml($html,$source,$source_id,$template_id){ | ||
| 357 | + $type = $this->getType($source,$source_id);//获取头部类型1-9(首页到自定义页面) | ||
| 358 | + $templateCommonModel = new BTemplateCommon(); | ||
| 359 | + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 | ||
| 360 | + $handleInfo = $this->handleCommonParam($html); | ||
| 361 | + if($commonInfo === false){ | ||
| 362 | + $data = [ | ||
| 363 | + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 364 | + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 365 | + 'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'], | ||
| 366 | + ]; | ||
| 367 | + $templateCommonModel->add($data); | ||
| 368 | + }else{ | ||
| 369 | + $data = [ | ||
| 370 | + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 371 | + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 372 | + ]; | ||
| 373 | + $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | ||
| 374 | + } | ||
| 375 | + //更新所有界面的other | ||
| 376 | + return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]); | ||
| 377 | + } | ||
| 378 | + | ||
| 379 | + /** | ||
| 330 | * @remark :演示项目不允许修改首页 | 380 | * @remark :演示项目不允许修改首页 |
| 331 | * @name :showProject | 381 | * @name :showProject |
| 332 | * @author :lyh | 382 | * @author :lyh |
| @@ -397,6 +447,24 @@ class BTemplateLogic extends BaseLogic | @@ -397,6 +447,24 @@ class BTemplateLogic extends BaseLogic | ||
| 397 | } | 447 | } |
| 398 | 448 | ||
| 399 | /** | 449 | /** |
| 450 | + * @remark :保存时字符串处理 | ||
| 451 | + * @name :handleSaveParam | ||
| 452 | + * @author :lyh | ||
| 453 | + * @method :post | ||
| 454 | + * @time :2023/6/29 15:35 | ||
| 455 | + */ | ||
| 456 | + public function handleCommonParam($html){ | ||
| 457 | + //字符串截取 | ||
| 458 | + $param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'); | ||
| 459 | + $param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'); | ||
| 460 | + $param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'); | ||
| 461 | + $param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | ||
| 462 | + $footer_other = str_replace('<header','',characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 463 | + $param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 464 | + return $this->success($param); | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + /** | ||
| 400 | * @remark :获取设置的类型 | 468 | * @remark :获取设置的类型 |
| 401 | * @name :getType | 469 | * @name :getType |
| 402 | * @author :lyh | 470 | * @author :lyh |
-
请 注册 或 登录 后发表评论