作者 lyh

gx

@@ -109,7 +109,7 @@ class CustomTemplateLogic extends BaseLogic @@ -109,7 +109,7 @@ class CustomTemplateLogic extends BaseLogic
109 //生成一条删除路由记录 109 //生成一条删除路由记录
110 $data = [ 110 $data = [
111 'source'=>RouteMap::SOURCE_PAGE, 111 'source'=>RouteMap::SOURCE_PAGE,
112 - 'route'=>$route, 112 + 'route'=>$info['url'],
113 ]; 113 ];
114 $this->setRouteDeleteSave($data); 114 $this->setRouteDeleteSave($data);
115 } 115 }
@@ -124,14 +124,37 @@ class CustomTemplateLogic extends BaseLogic @@ -124,14 +124,37 @@ class CustomTemplateLogic extends BaseLogic
124 * @time :2023/6/29 16:21 124 * @time :2023/6/29 16:21
125 */ 125 */
126 public function customTemplateDel(){ 126 public function customTemplateDel(){
127 - $rs = $this->model->edit(['deleted_status'=>1,'deleted_at'=>date('Y-m-d H:i:s')],['id'=>$this->param['id']]);  
128 - if($rs === false){  
129 - $this->fail('error'); 127 + try {
  128 + $this->delRoute($this->param['id']);
  129 + $this->model->del(['id'=>$this->param['id']]);
  130 + }catch (\Exception $e){
  131 + $this->fail('系统错误,请联系管理员');
130 } 132 }
131 return $this->success(); 133 return $this->success();
132 } 134 }
133 135
134 /** 136 /**
  137 + * @remark :删除路由
  138 + * @name :delRoute
  139 + * @author :lyh
  140 + * @method :post
  141 + * @time :2023/9/7 10:50
  142 + */
  143 + public function delRoute($id)
  144 + {
  145 + //删除路由映射
  146 + RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  147 + //生成一条删除路由记录
  148 + $info = $this->model->read(['id' => $id], ['id', 'url']);
  149 + $data = [
  150 + 'source' => RouteMap::SOURCE_NEWS,
  151 + 'route' => $info['url'],
  152 + ];
  153 + $this->setRouteDeleteSave($data);
  154 + return $this->success();
  155 + }
  156 +
  157 + /**
135 * @remark :获取body的详情 158 * @remark :获取body的详情
136 * @name :getBodyHeaderFooter 159 * @name :getBodyHeaderFooter
137 * @author :lyh 160 * @author :lyh