作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -610,6 +610,9 @@ function getRouteMap($source,$source_id){ @@ -610,6 +610,9 @@ function getRouteMap($source,$source_id){
610 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); 610 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]);
611 if($info !== false){ 611 if($info !== false){
612 if(!empty($info['path'])){ 612 if(!empty($info['path'])){
  613 + if($info['path'] == 'blog'){
  614 + $info['path'] = $info['path'].'s';
  615 + }
613 $route = $info['path'].'/'.$info['route']; 616 $route = $info['path'].'/'.$info['route'];
614 }else{ 617 }else{
615 $route = $info['route']; 618 $route = $info['route'];
@@ -10,7 +10,11 @@ @@ -10,7 +10,11 @@
10 namespace App\Http\Logic\Bside\BTemplate; 10 namespace App\Http\Logic\Bside\BTemplate;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Blog\Blog;
  14 +use App\Models\News\News;
  15 +use App\Models\Product\Product;
13 use App\Models\Project\PageSetting; 16 use App\Models\Project\PageSetting;
  17 +use App\Models\RouteMap\RouteMap;
14 use App\Models\Service\Service as ServiceSettingModel; 18 use App\Models\Service\Service as ServiceSettingModel;
15 use App\Models\Template\BTemplate; 19 use App\Models\Template\BTemplate;
16 use App\Models\Template\BTemplateCommon; 20 use App\Models\Template\BTemplateCommon;
@@ -285,12 +289,14 @@ class VisualizationLogic extends BaseLogic @@ -285,12 +289,14 @@ class VisualizationLogic extends BaseLogic
285 'source'=>$this->param['source'], 289 'source'=>$this->param['source'],
286 'project_id'=>$this->user['project_id'], 290 'project_id'=>$this->user['project_id'],
287 'source_id'=>$this->param['source_id'], 291 'source_id'=>$this->param['source_id'],
  292 + 'template_id'=>0
288 ]); 293 ]);
289 if($templateInfo === false){ 294 if($templateInfo === false){
290 $this->param['project_id'] = $this->user['project_id']; 295 $this->param['project_id'] = $this->user['project_id'];
  296 + $this->param['template_id'] = 0;
291 $bTemplateModel->add($this->param); 297 $bTemplateModel->add($this->param);
292 }else{ 298 }else{
293 - $bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]); 299 + $bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]);
294 } 300 }
295 }else{ 301 }else{
296 $bTemplateModel = new BTemplate(); 302 $bTemplateModel = new BTemplate();
@@ -311,6 +317,7 @@ class VisualizationLogic extends BaseLogic @@ -311,6 +317,7 @@ class VisualizationLogic extends BaseLogic
311 $bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]); 317 $bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]);
312 } 318 }
313 $this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']); 319 $this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']);
  320 + $this->homeOrProduct($this->param['source'],$this->param['source_id']);
314 } 321 }
315 }catch (\Exception $e){ 322 }catch (\Exception $e){
316 $this->fail('系统错误,请联系管理员'); 323 $this->fail('系统错误,请联系管理员');
@@ -320,6 +327,45 @@ class VisualizationLogic extends BaseLogic @@ -320,6 +327,45 @@ class VisualizationLogic extends BaseLogic
320 } 327 }
321 328
322 /** 329 /**
  330 + * @remark :通知首页更新
  331 + * @name :IsHome
  332 + * @author :lyh
  333 + * @method :post
  334 + * @time :2023/7/31 16:05
  335 + */
  336 + public function homeOrProduct($source,$source_id = ''){
  337 + if($source == BTemplate::SOURCE_HOME){
  338 + $type = 'index';
  339 + $route = '';
  340 + //路由映射
  341 + RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
  342 + }else{
  343 + //其他界面通知更新
  344 + if($source == 2 && $source_id != 0){
  345 + $type = RouteMap::SOURCE_PRODUCT;
  346 + $productModel = new Product();
  347 + $productInfo = $productModel->read(['id'=>$source_id],['route']);
  348 + $route = $productInfo['route'];
  349 + }elseif($source == 3 && $source_id != 0){
  350 + $type = RouteMap::SOURCE_BLOG;
  351 + $blogModel = new Blog();
  352 + $blogInfo = $blogModel->read(['id'=>$source_id],['url']);
  353 + $route = $blogInfo['url'];
  354 + }elseif($source == 4 && $source_id != 0){
  355 + $type = RouteMap::SOURCE_NEWS;
  356 + $newsModel = new News();
  357 + $newsInfo = $newsModel->read(['id'=>$source_id],['url']);
  358 + $route = $newsInfo['url'];
  359 + }else{
  360 + $type = 0;
  361 + $route = 'all';
  362 + }
  363 + }
  364 + $this->addUpdateNotify($type,$route);
  365 + return $this->curlDelRoute($route);
  366 + }
  367 +
  368 + /**
323 * @remark :生成记录 369 * @remark :生成记录
324 * @name :setTemplateLog 370 * @name :setTemplateLog
325 * @author :lyh 371 * @author :lyh
@@ -132,7 +132,7 @@ class RouteMap extends Base @@ -132,7 +132,7 @@ class RouteMap extends Base
132 if($source == self::SOURCE_NEWS){ 132 if($source == self::SOURCE_NEWS){
133 $route_map->path = self::SOURCE_NEWS; 133 $route_map->path = self::SOURCE_NEWS;
134 }elseif ($source == self::SOURCE_BLOG){ 134 }elseif ($source == self::SOURCE_BLOG){
135 - $route_map->path = self::SOURCE_BLOG; 135 + $route_map->path = self::SOURCE_BLOG.'s';
136 } 136 }
137 $route_map->route = $route; 137 $route_map->route = $route;
138 $route_map->save(); 138 $route_map->save();