正在显示
1 个修改的文件
包含
28 行增加
和
10 行删除
| @@ -37,11 +37,14 @@ class VisualizationLogic extends BaseLogic | @@ -37,11 +37,14 @@ class VisualizationLogic extends BaseLogic | ||
| 37 | * @time :2023/11/17 14:44 | 37 | * @time :2023/11/17 14:44 |
| 38 | */ | 38 | */ |
| 39 | public function getVisualizationInfo(){ | 39 | public function getVisualizationInfo(){ |
| 40 | - $type = $this->getType($this->param['source'],$this->param['source_id']); | 40 | + $data = $this->getSource($this->param['type']); |
| 41 | + $source = $data['source']; | ||
| 42 | + $source_id = $data['source_id']; | ||
| 43 | + $type = $this->getType($source,$source_id); | ||
| 41 | $typeArray = [1,3,5,7];//单页数据 | 44 | $typeArray = [1,3,5,7];//单页数据 |
| 42 | if(in_array($type,$typeArray)){ | 45 | if(in_array($type,$typeArray)){ |
| 43 | $bTemplateModel = new BTemplate(); | 46 | $bTemplateModel = new BTemplate(); |
| 44 | - $info = $bTemplateModel->read(['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]); | 47 | + $info = $bTemplateModel->read(['source'=>$source,'source_id'=>$source_id,'template_id'=>0]); |
| 45 | }else{//模块数据 | 48 | }else{//模块数据 |
| 46 | $bTemplateMainModel = new BTemplateMain(); | 49 | $bTemplateMainModel = new BTemplateMain(); |
| 47 | $info = $bTemplateMainModel->read(['type'=>$type]); | 50 | $info = $bTemplateMainModel->read(['type'=>$type]); |
| @@ -49,6 +52,18 @@ class VisualizationLogic extends BaseLogic | @@ -49,6 +52,18 @@ class VisualizationLogic extends BaseLogic | ||
| 49 | return $this->success($info); | 52 | return $this->success($info); |
| 50 | } | 53 | } |
| 51 | 54 | ||
| 55 | + public function getSource($type){ | ||
| 56 | + $source_id = 0; | ||
| 57 | + if ($type == 2){$source = 2;$source_id = 1; | ||
| 58 | + }elseif ($type == 3){$source = 2; | ||
| 59 | + }elseif ($type == 4){$source = 3;$source_id = 1; | ||
| 60 | + }elseif ($type == 5){$source = 3; | ||
| 61 | + }elseif ($type == 6){$source = 4;$source_id = 1; | ||
| 62 | + }elseif ($type == 7){$source = 4; | ||
| 63 | + }else{$source = 1;} | ||
| 64 | + return ['source'=>$source,'source_id'=>$source_id]; | ||
| 65 | + } | ||
| 66 | + | ||
| 52 | /** | 67 | /** |
| 53 | * @remark :保存定制html | 68 | * @remark :保存定制html |
| 54 | * @name :saveHtml | 69 | * @name :saveHtml |
| @@ -57,18 +72,21 @@ class VisualizationLogic extends BaseLogic | @@ -57,18 +72,21 @@ class VisualizationLogic extends BaseLogic | ||
| 57 | * @time :2023/11/15 10:12 | 72 | * @time :2023/11/15 10:12 |
| 58 | */ | 73 | */ |
| 59 | public function saveVisualization(){ | 74 | public function saveVisualization(){ |
| 60 | -// try { | ||
| 61 | - $type = $this->getType($this->param['source'],$this->param['source_id']); | 75 | + try { |
| 76 | + $sourceData = $this->getSource($this->param['type']); | ||
| 77 | + $source = $sourceData['source']; | ||
| 78 | + $source_id = $sourceData['source_id']; | ||
| 79 | + $type = $this->param['type']; | ||
| 62 | $typeArray = [1,3,5,7];//单页数据 | 80 | $typeArray = [1,3,5,7];//单页数据 |
| 63 | if(in_array($type,$typeArray)){ | 81 | if(in_array($type,$typeArray)){ |
| 64 | $bTemplateModel = new BTemplate(); | 82 | $bTemplateModel = new BTemplate(); |
| 65 | - $templateInfo = $bTemplateModel->read(['source'=>$this->param['source'],'template_id'=>0]); | 83 | + $templateInfo = $bTemplateModel->read(['source'=>$source,'template_id'=>0]); |
| 66 | if($templateInfo === false){ | 84 | if($templateInfo === false){ |
| 67 | $data = [ | 85 | $data = [ |
| 68 | 'html'=>$this->param['html'], | 86 | 'html'=>$this->param['html'], |
| 69 | 'project_id'=>$this->user['project_id'], | 87 | 'project_id'=>$this->user['project_id'], |
| 70 | - 'source'=>$this->param['source'], | ||
| 71 | - 'source_id'=>$this->param['source_id'], | 88 | + 'source'=>$source, |
| 89 | + 'source_id'=>$source_id, | ||
| 72 | ]; | 90 | ]; |
| 73 | $bTemplateModel->add($data); | 91 | $bTemplateModel->add($data); |
| 74 | }else{ | 92 | }else{ |
| @@ -88,9 +106,9 @@ class VisualizationLogic extends BaseLogic | @@ -88,9 +106,9 @@ class VisualizationLogic extends BaseLogic | ||
| 88 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); | 106 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); |
| 89 | } | 107 | } |
| 90 | } | 108 | } |
| 91 | -// }catch (\Exception $e){ | ||
| 92 | -// $this->fail('系统错误,请联系管理员'); | ||
| 93 | -// } | 109 | + }catch (\Exception $e){ |
| 110 | + $this->fail('系统错误,请联系管理员'); | ||
| 111 | + } | ||
| 94 | return $this->success(); | 112 | return $this->success(); |
| 95 | } | 113 | } |
| 96 | 114 |
-
请 注册 或 登录 后发表评论