|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :VisualizationLogic.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/11/15 10:09
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Logic\Bside\BTemplate;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Blog\Blog;
|
|
|
|
use App\Models\News\News;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\Project\PageSetting;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Service\Service as ServiceSettingModel;
|
|
|
|
use App\Models\Template\BTemplate;
|
|
|
|
use App\Models\Template\BTemplateCommon;
|
|
|
|
use App\Models\Template\BTemplateLog;
|
|
|
|
use App\Models\Template\BTemplateMain;
|
|
|
|
use App\Models\Template\Setting;
|
|
|
|
use App\Models\Template\Template;
|
|
|
|
use App\Models\Template\TemplateTypeMain;
|
|
|
|
use App\Models\Visualization\Visualization;
|
|
|
|
|
|
|
|
class VisualizationLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->model = new BTemplateMain();
|
|
|
|
$this->param = $this->requestAll;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取代码块
|
|
|
|
* @name :getVisualizationInfo
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/11/17 14:44
|
|
|
|
*/
|
|
|
|
public function getVisualizationInfo(){
|
|
|
|
$is_list = $this->param['is_list'] ?? 0;
|
|
|
|
$bTemplateMainModel = new BTemplateMain();
|
|
|
|
$info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]);
|
|
|
|
if($info === false){
|
|
|
|
$html = '';
|
|
|
|
}else{
|
|
|
|
$html = $info['main_html'];
|
|
|
|
}
|
|
|
|
return $this->success(['html'=>$html]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存定制html
|
|
|
|
* @name :saveHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/11/15 10:12
|
|
|
|
*/
|
|
|
|
public function saveVisualization(){
|
|
|
|
try {
|
|
|
|
$is_list = $this->param['is_list'] ?? 0;
|
|
|
|
$bTemplateMainModel = new BTemplateMain();
|
|
|
|
$mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]);
|
|
|
|
if($mainInfo === false){
|
|
|
|
$mainData = [
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'type'=>$this->param['type'],
|
|
|
|
'is_list'=>$is_list,
|
|
|
|
'main_html'=>$this->param['html']
|
|
|
|
];
|
|
|
|
$bTemplateMainModel->add($mainData);
|
|
|
|
}else{
|
|
|
|
$bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]);
|
|
|
|
}
|
|
|
|
}catch (\Exception $exception){
|
|
|
|
$this->fail('保存失败,请联系开发人员');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |