|
...
|
...
|
@@ -37,11 +37,14 @@ class VisualizationLogic extends BaseLogic |
|
|
|
* @time :2023/11/17 14:44
|
|
|
|
*/
|
|
|
|
public function getVisualizationInfo(){
|
|
|
|
$type = $this->getType($this->param['source'],$this->param['source_id']);
|
|
|
|
$data = $this->getSource($this->param['type']);
|
|
|
|
$source = $data['source'];
|
|
|
|
$source_id = $data['source_id'];
|
|
|
|
$type = $this->getType($source,$source_id);
|
|
|
|
$typeArray = [1,3,5,7];//单页数据
|
|
|
|
if(in_array($type,$typeArray)){
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$info = $bTemplateModel->read(['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]);
|
|
|
|
$info = $bTemplateModel->read(['source'=>$source,'source_id'=>$source_id,'template_id'=>0]);
|
|
|
|
}else{//模块数据
|
|
|
|
$bTemplateMainModel = new BTemplateMain();
|
|
|
|
$info = $bTemplateMainModel->read(['type'=>$type]);
|
|
...
|
...
|
@@ -49,6 +52,18 @@ class VisualizationLogic extends BaseLogic |
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSource($type){
|
|
|
|
$source_id = 0;
|
|
|
|
if ($type == 2){$source = 2;$source_id = 1;
|
|
|
|
}elseif ($type == 3){$source = 2;
|
|
|
|
}elseif ($type == 4){$source = 3;$source_id = 1;
|
|
|
|
}elseif ($type == 5){$source = 3;
|
|
|
|
}elseif ($type == 6){$source = 4;$source_id = 1;
|
|
|
|
}elseif ($type == 7){$source = 4;
|
|
|
|
}else{$source = 1;}
|
|
|
|
return ['source'=>$source,'source_id'=>$source_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存定制html
|
|
|
|
* @name :saveHtml
|
|
...
|
...
|
@@ -57,18 +72,21 @@ class VisualizationLogic extends BaseLogic |
|
|
|
* @time :2023/11/15 10:12
|
|
|
|
*/
|
|
|
|
public function saveVisualization(){
|
|
|
|
// try {
|
|
|
|
$type = $this->getType($this->param['source'],$this->param['source_id']);
|
|
|
|
try {
|
|
|
|
$sourceData = $this->getSource($this->param['type']);
|
|
|
|
$source = $sourceData['source'];
|
|
|
|
$source_id = $sourceData['source_id'];
|
|
|
|
$type = $this->param['type'];
|
|
|
|
$typeArray = [1,3,5,7];//单页数据
|
|
|
|
if(in_array($type,$typeArray)){
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$templateInfo = $bTemplateModel->read(['source'=>$this->param['source'],'template_id'=>0]);
|
|
|
|
$templateInfo = $bTemplateModel->read(['source'=>$source,'template_id'=>0]);
|
|
|
|
if($templateInfo === false){
|
|
|
|
$data = [
|
|
|
|
'html'=>$this->param['html'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source'=>$this->param['source'],
|
|
|
|
'source_id'=>$this->param['source_id'],
|
|
|
|
'source'=>$source,
|
|
|
|
'source_id'=>$source_id,
|
|
|
|
];
|
|
|
|
$bTemplateModel->add($data);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -88,9 +106,9 @@ class VisualizationLogic extends BaseLogic |
|
|
|
$bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// $this->fail('系统错误,请联系管理员');
|
|
|
|
// }
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|