|
...
|
...
|
@@ -58,25 +58,16 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function customTemplateSave(){
|
|
|
|
try {
|
|
|
|
$this->param['url'] = str_replace_url($this->param['url']);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
if(isset($this->param['html']) && !empty($this->param['html'])){
|
|
|
|
$html = $this->param['html'];
|
|
|
|
$this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');
|
|
|
|
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
}
|
|
|
|
//查看路由是否更新
|
|
|
|
if(isset($this->param['url']) && !empty($this->param['url'])){
|
|
|
|
$this->param['url'] = str_replace_url($this->param['url']);
|
|
|
|
$id = $this->editCustomRoute($this->param['id'],$this->param['url']);
|
|
|
|
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
|
|
|
|
}
|
|
|
|
$id = $this->editCustomRoute($this->param['id'],$this->param['url']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['url'=>$route],['id'=>$route]);
|
|
|
|
}
|
|
|
|
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['url'=>$route],['id'=>$route]);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
...
|
...
|
@@ -87,6 +78,20 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :可视化保存html
|
|
|
|
* @name :saveHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/16 17:13
|
|
|
|
*/
|
|
|
|
public function saveHtml(){
|
|
|
|
$html = $this->param['html'];
|
|
|
|
$this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');
|
|
|
|
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看路由是否更新
|
|
|
|
* @name :editProduct
|
|
|
|
* @author :lyh
|
...
|
...
|
|