作者 lyh

gx

... ... @@ -814,13 +814,6 @@ class ProjectController extends BaseController
* @time :2023/11/17 15:23
*/
public function saveOtherProject(ProjectLogic $logic){
$this->request->validate([
'project_id'=>'required',
'other_project'=>'required|array'
],[
'project_id.required' => 'project_id不能为空',
'other_project.required' => '其他项目设置不能为空',
]);
$logic->saveOtherProject();
$this->response('success');
}
... ...
... ... @@ -696,19 +696,18 @@ class ProjectLogic extends BaseLogic
}
/**
* @remark :bao
* @remark :保存其他配置
* @name :saveOtherProject
* @author :lyh
* @method :post
* @time :2023/11/17 15:26
*/
public function saveOtherProject(){
$buildModel = new DeployBuild();
$rs = $buildModel->edit(['other_project'=>json_encode($this->param['other_project'])],['project_id'=>$this->param['project_id']]);
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success(['other_project'=>$this->param['other_project']]);
return $this->success($this->param);
}
}
... ...
... ... @@ -47,7 +47,7 @@ class CustomTemplateLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在');
}
if($info['is_visualization'] == 0){
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
$html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
$info['html'] = $this->getHeadFooter($html);
}
... ... @@ -92,15 +92,16 @@ class CustomTemplateLogic extends BaseLogic
*/
public function saveHtml(){
$html = $this->param['html'];
$this->saveCommonTemplate($html);
$this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
$info = $this->model->read(['id'=>$this->param['id']],['id','is_visualization','url']);
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){//非定制项目+可视化页面
$this->saveCommonTemplate($html);
$this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理');
}
//TODO::通知网站更新
$info = $this->model->read(['id'=>$this->param['id']],['id','url']);
$data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];
$this->updateNotify($data);
return $this->success();
... ...