正在显示
4 个修改的文件
包含
28 行增加
和
9 行删除
| @@ -834,6 +834,16 @@ function ends_with($string, $suffix) | @@ -834,6 +834,16 @@ function ends_with($string, $suffix) | ||
| 834 | return substr($string, -strlen($suffix)) === $suffix; | 834 | return substr($string, -strlen($suffix)) === $suffix; |
| 835 | } | 835 | } |
| 836 | 836 | ||
| 837 | +function getCustomRouteMap($module_route,$route = '') | ||
| 838 | +{ | ||
| 839 | + if($module_route == $route){ | ||
| 840 | + $resultRoute = $route; | ||
| 841 | + }else{ | ||
| 842 | + $resultRoute = $module_route.'_catelog/'.$route; | ||
| 843 | + } | ||
| 844 | + return $resultRoute; | ||
| 845 | +} | ||
| 846 | + | ||
| 837 | /** | 847 | /** |
| 838 | * @remark :获取二级路由 | 848 | * @remark :获取二级路由 |
| 839 | * @name :getRouteMap | 849 | * @name :getRouteMap |
| @@ -841,11 +851,25 @@ function ends_with($string, $suffix) | @@ -841,11 +851,25 @@ function ends_with($string, $suffix) | ||
| 841 | * @method :post | 851 | * @method :post |
| 842 | * @time :2023/11/10 14:29 | 852 | * @time :2023/11/10 14:29 |
| 843 | */ | 853 | */ |
| 844 | -function getRouteMap($source,$source_id){ | 854 | +function getRouteMap($source,$source_id,$is_upgrade = 0){ |
| 845 | $route = ''; | 855 | $route = ''; |
| 846 | $routeMapModel = new RouteMap(); | 856 | $routeMapModel = new RouteMap(); |
| 847 | $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); | 857 | $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); |
| 848 | if($info !== false){ | 858 | if($info !== false){ |
| 859 | + if($is_upgrade == 1){ | ||
| 860 | + if($source == $routeMapModel::SOURCE_NEWS_CATE){ | ||
| 861 | + if($info['route'] != 'news'){ | ||
| 862 | + $route = $routeMapModel::PATH_NEWS_CATE.'/'.$info['route']; | ||
| 863 | + } | ||
| 864 | + }elseif ($source == $routeMapModel::SOURCE_BLOG_CATE){ | ||
| 865 | + if($info['route'] != 'blog'){ | ||
| 866 | + $route = $routeMapModel::PATH_BLOG_CATE.'/'.$info['route']; | ||
| 867 | + } | ||
| 868 | + }else{ | ||
| 869 | + $route = $info['route']; | ||
| 870 | + } | ||
| 871 | + return $route; | ||
| 872 | + } | ||
| 849 | if(!empty($info['path'])){ | 873 | if(!empty($info['path'])){ |
| 850 | if($info['path'] == 'blog'){ | 874 | if($info['path'] == 'blog'){ |
| 851 | $info['path'] = $info['path'].'s'; | 875 | $info['path'] = $info['path'].'s'; |
| @@ -29,7 +29,7 @@ class BlogCategoryController extends BaseController | @@ -29,7 +29,7 @@ class BlogCategoryController extends BaseController | ||
| 29 | $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST); | 29 | $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST); |
| 30 | foreach ($lists as $k => $v){ | 30 | foreach ($lists as $k => $v){ |
| 31 | $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); | 31 | $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); |
| 32 | - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']); | 32 | + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id'],$this->user['is_upgrade']); |
| 33 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']); | 33 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']); |
| 34 | $lists[$k] = $v; | 34 | $lists[$k] = $v; |
| 35 | } | 35 | } |
| @@ -42,12 +42,7 @@ class CustomModuleCategoryController extends BaseController | @@ -42,12 +42,7 @@ class CustomModuleCategoryController extends BaseController | ||
| 42 | $template_id = $this->getModuleTemplateId($this->param['module_id']); | 42 | $template_id = $this->getModuleTemplateId($this->param['module_id']); |
| 43 | foreach ($list as $k => $v){ | 43 | foreach ($list as $k => $v){ |
| 44 | $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM); | 44 | $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM); |
| 45 | - $v['url'] = $this->user['domain'].$v['route']; | ||
| 46 | - if($this->user['is_upgrade'] == 1){ | ||
| 47 | - if($v['route'] != $moduleInfo['route']){ | ||
| 48 | - $v['url'] = $this->user['domain'].$moduleInfo['route']."_catalog/".$v['route']; | ||
| 49 | - } | ||
| 50 | - } | 45 | + $v['url'] = $this->user['domain'].getCustomRouteMap($moduleInfo['route'],$v['route']); |
| 51 | $list[$k] = $v; | 46 | $list[$k] = $v; |
| 52 | } | 47 | } |
| 53 | } | 48 | } |
| @@ -29,7 +29,7 @@ class NewsCategoryController extends BaseController | @@ -29,7 +29,7 @@ class NewsCategoryController extends BaseController | ||
| 29 | $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST); | 29 | $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST); |
| 30 | foreach ($lists as $k => $v){ | 30 | foreach ($lists as $k => $v){ |
| 31 | $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); | 31 | $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); |
| 32 | - $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']); | 32 | + $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id'],$this->user['is_upgrade']); |
| 33 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']); | 33 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']); |
| 34 | $lists[$k] = $v; | 34 | $lists[$k] = $v; |
| 35 | } | 35 | } |
-
请 注册 或 登录 后发表评论