作者 lyh

gx

@@ -207,26 +207,26 @@ class ATemplateLogic extends BaseLogic @@ -207,26 +207,26 @@ class ATemplateLogic extends BaseLogic
207 $info = $bTemplateModel->read(['source'=>1,'template_id'=>$template_id]); 207 $info = $bTemplateModel->read(['source'=>1,'template_id'=>$template_id]);
208 if($info === false){ 208 if($info === false){
209 $data = [ 209 $data = [
210 - 'source'=>1, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'], 210 + 'source'=>BTemplate::SOURCE_COM, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'],
211 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id, 211 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id,
212 ]; 212 ];
213 $bTemplateModel->add($data); 213 $bTemplateModel->add($data);
214 } 214 }
215 //保存一次公共头部+底部+other信息 215 //保存一次公共头部+底部+other信息
216 $bComTemplateModel = new BTemplateCom(); 216 $bComTemplateModel = new BTemplateCom();
217 - $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_HOME]; 217 + $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_COM];
218 $headInfo = $bComTemplateModel->read($condition); 218 $headInfo = $bComTemplateModel->read($condition);
219 if($headInfo === false){ 219 if($headInfo === false){
220 $headData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id]; 220 $headData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id];
221 $bComTemplateModel->add(array_merge($condition,$headData)); 221 $bComTemplateModel->add(array_merge($condition,$headData));
222 } 222 }
223 - $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_FOOTER,'source'=>BTemplate::SOURCE_HOME]; 223 + $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_FOOTER,'source'=>BTemplate::SOURCE_COM];
224 $footerInfo = $bComTemplateModel->read($condition); 224 $footerInfo = $bComTemplateModel->read($condition);
225 if($footerInfo === false){ 225 if($footerInfo === false){
226 $footerData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id]; 226 $footerData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id];
227 $bComTemplateModel->add(array_merge($condition,$footerData)); 227 $bComTemplateModel->add(array_merge($condition,$footerData));
228 } 228 }
229 - $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_OTHER,'source'=>BTemplate::SOURCE_HOME]; 229 + $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_OTHER,'source'=>BTemplate::SOURCE_COM];
230 $footerInfo = $bComTemplateModel->read($condition); 230 $footerInfo = $bComTemplateModel->read($condition);
231 if($footerInfo === false){ 231 if($footerInfo === false){
232 $other = str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")); 232 $other = str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"));
@@ -427,8 +427,8 @@ class BlogLogic extends BaseLogic @@ -427,8 +427,8 @@ class BlogLogic extends BaseLogic
427 'updated_at'=>date('Y-m-d H:i:s'), 427 'updated_at'=>date('Y-m-d H:i:s'),
428 ]; 428 ];
429 $save_id = $this->model->insertGetId($param); 429 $save_id = $this->model->insertGetId($param);
430 - $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_BLOG, $save_id, $this->user['project_id']);  
431 - $this->model->edit(['route'=>$route],['id'=>$save_id]); 430 + $route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_BLOG, $save_id, $this->user['project_id']);
  431 + $this->model->edit(['url'=>$route],['id'=>$save_id]);
432 //同步可视化装修数据 432 //同步可视化装修数据
433 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); 433 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
434 return $this->success(['id'=>$save_id]); 434 return $this->success(['id'=>$save_id]);
@@ -471,8 +471,8 @@ class NewsLogic extends BaseLogic @@ -471,8 +471,8 @@ class NewsLogic extends BaseLogic
471 'updated_at'=>date('Y-m-d H:i:s'), 471 'updated_at'=>date('Y-m-d H:i:s'),
472 ]; 472 ];
473 $save_id = $this->model->insertGetId($param); 473 $save_id = $this->model->insertGetId($param);
474 - $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_NEWS, $save_id, $this->user['project_id']);  
475 - $this->model->edit(['route'=>$route],['id'=>$save_id]); 474 + $route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_NEWS, $save_id, $this->user['project_id']);
  475 + $this->model->edit(['url'=>$route],['id'=>$save_id]);
476 //同步可视化装修数据 476 //同步可视化装修数据
477 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); 477 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
478 return $this->success(['id'=>$save_id]); 478 return $this->success(['id'=>$save_id]);
@@ -15,6 +15,7 @@ class BTemplate extends Base @@ -15,6 +15,7 @@ class BTemplate extends Base
15 /** 15 /**
16 * 模块类型 16 * 模块类型
17 */ 17 */
  18 + const SOURCE_COM = 99;//公共页面
18 const SOURCE_HOME = 1;//首页 19 const SOURCE_HOME = 1;//首页
19 const SOURCE_PRODUCT = 2;//产品 20 const SOURCE_PRODUCT = 2;//产品
20 21