作者 lyh

gx

@@ -45,11 +45,21 @@ class VisualizationLogic extends BaseLogic @@ -45,11 +45,21 @@ class VisualizationLogic extends BaseLogic
45 if(in_array($type,$typeArray)){ 45 if(in_array($type,$typeArray)){
46 $bTemplateModel = new BTemplate(); 46 $bTemplateModel = new BTemplate();
47 $info = $bTemplateModel->read(['source'=>$source,'source_id'=>$source_id,'template_id'=>0]); 47 $info = $bTemplateModel->read(['source'=>$source,'source_id'=>$source_id,'template_id'=>0]);
  48 + if($info === false){
  49 + $html = '';
  50 + }else{
  51 + $html = $info['html'];
  52 + }
48 }else{//模块数据 53 }else{//模块数据
49 $bTemplateMainModel = new BTemplateMain(); 54 $bTemplateMainModel = new BTemplateMain();
50 $info = $bTemplateMainModel->read(['type'=>$type]); 55 $info = $bTemplateMainModel->read(['type'=>$type]);
  56 + if($info === false){
  57 + $html = '';
  58 + }else{
  59 + $html = $info['main_html'];
  60 + }
51 } 61 }
52 - return $this->success($info); 62 + return $this->success(['html'=>$html]);
53 } 63 }
54 64
55 public function getSource($type){ 65 public function getSource($type){
@@ -72,7 +82,7 @@ class VisualizationLogic extends BaseLogic @@ -72,7 +82,7 @@ class VisualizationLogic extends BaseLogic
72 * @time :2023/11/15 10:12 82 * @time :2023/11/15 10:12
73 */ 83 */
74 public function saveVisualization(){ 84 public function saveVisualization(){
75 -// try { 85 + try {
76 $sourceData = $this->getSource($this->param['type']); 86 $sourceData = $this->getSource($this->param['type']);
77 $source = $sourceData['source']; 87 $source = $sourceData['source'];
78 $source_id = $sourceData['source_id']; 88 $source_id = $sourceData['source_id'];
@@ -106,9 +116,9 @@ class VisualizationLogic extends BaseLogic @@ -106,9 +116,9 @@ class VisualizationLogic extends BaseLogic
106 $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); 116 $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);
107 } 117 }
108 } 118 }
109 -// }catch (\Exception $e){  
110 -// $this->fail('系统错误,请联系管理员');  
111 -// } 119 + }catch (\Exception $e){
  120 + $this->fail('系统错误,请联系管理员');
  121 + }
112 return $this->success(); 122 return $this->success();
113 } 123 }
114 124