正在显示
1 个修改的文件
包含
19 行增加
和
23 行删除
| @@ -63,24 +63,20 @@ class CustomTemplateLogic extends BaseLogic | @@ -63,24 +63,20 @@ class CustomTemplateLogic extends BaseLogic | ||
| 63 | * @time :2023/6/29 16:21 | 63 | * @time :2023/6/29 16:21 |
| 64 | */ | 64 | */ |
| 65 | public function customTemplateSave(){ | 65 | public function customTemplateSave(){ |
| 66 | - try { | ||
| 67 | - $this->param['url'] = str_replace_url($this->param['url']); | ||
| 68 | - if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 69 | - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']); | ||
| 70 | - $this->editCustomRoute($this->param['url']); | ||
| 71 | - $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 72 | - }else{ | ||
| 73 | - if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ | ||
| 74 | - $this->fail('404页面已存在'); | ||
| 75 | - } | ||
| 76 | - $this->param['project_id'] = $this->user['project_id']; | ||
| 77 | - $id = $this->model->addReturnId($this->param); | ||
| 78 | - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); | ||
| 79 | - $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); | ||
| 80 | - $this->model->edit(['url'=>$route],['id'=>$id]); | 66 | + $this->param['url'] = str_replace_url($this->param['url']); |
| 67 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 68 | + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']); | ||
| 69 | + $this->editCustomRoute($this->param['url']); | ||
| 70 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 71 | + }else{ | ||
| 72 | + if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ | ||
| 73 | + $this->fail('404页面已存在'); | ||
| 81 | } | 74 | } |
| 82 | - }catch (\Exception $e){ | ||
| 83 | - $this->fail('保存失败,请联系管理员'); | 75 | + $this->param['project_id'] = $this->user['project_id']; |
| 76 | + $id = $this->model->addReturnId($this->param); | ||
| 77 | + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); | ||
| 78 | + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); | ||
| 79 | + $this->model->edit(['url'=>$route],['id'=>$id]); | ||
| 84 | } | 80 | } |
| 85 | return $this->success(); | 81 | return $this->success(); |
| 86 | } | 82 | } |
| @@ -208,13 +204,13 @@ class CustomTemplateLogic extends BaseLogic | @@ -208,13 +204,13 @@ class CustomTemplateLogic extends BaseLogic | ||
| 208 | */ | 204 | */ |
| 209 | public function editCustomRoute($route){ | 205 | public function editCustomRoute($route){ |
| 210 | $info = $this->model->read(['id'=>$this->param['id']]); | 206 | $info = $this->model->read(['id'=>$this->param['id']]); |
| 211 | - if($info['url'] == $this->model::NOT_FOUND_PAGE_URL && $route['url'] != '404'){ | ||
| 212 | - $this->fail('404页面链接不可修改'); | ||
| 213 | - } | ||
| 214 | - if($info['url'] != $route){ | ||
| 215 | - $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); | ||
| 216 | - $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]); | 207 | + if($info['url'] == $this->model::NOT_FOUND_PAGE_URL){ |
| 208 | + if($route != '404'){ | ||
| 209 | + $this->fail('404页面链接不可修改'); | ||
| 210 | + } | ||
| 217 | } | 211 | } |
| 212 | + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); | ||
| 213 | + $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]); | ||
| 218 | return true; | 214 | return true; |
| 219 | } | 215 | } |
| 220 | 216 |
-
请 注册 或 登录 后发表评论