123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689 |
- <?php
- /**
- * 易优CMS
- * ============================================================================
- * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
- * 网站地址: http://www.eyoucms.com
- * ----------------------------------------------------------------------------
- * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
- * ============================================================================
- * Author: 小虎哥 <1105415366@qq.com>
- * Date: 2018-4-3
- */
-
- $home_rewrite = [];
- $route = [
- '__pattern__' => [
- 'tid' => '[\-\w]+',
- 'dirname' => '[\-\w]+',
- 'aid' => '(.*)',
- ],
- '__alias__' => [],
- '__domain__' => [],
- ];
- $__pattern__ = $route['__pattern__'];
-
- $globalTpCache = tpCache('global');
- config('tpcache', $globalTpCache);
-
- $goto = input('param.goto/s');
- $goto = trim($goto, '/');
- // 会员中心模板风格
- $web_users_tpl_theme = !empty($globalTpCache['web_users_tpl_theme']) ? $globalTpCache['web_users_tpl_theme'] : config('ey_config.web_users_tpl_theme');
-
- // 设置默认模板 users ZMH 2024-01-22
- if (empty($web_users_tpl_theme)) {
- $web_users_tpl_theme = "users";
- }
-
- config('ey_config.web_users_tpl_theme', $web_users_tpl_theme);
-
- // 前台模板风格
- $web_tpl_theme = !empty($globalTpCache['web_tpl_theme']) ? $globalTpCache['web_tpl_theme'] : config('ey_config.web_tpl_theme');
- if (empty($web_tpl_theme)) {
- if (file_exists(ROOT_PATH.'template/default')) {
- $web_tpl_theme = 'default';
- } else {
- $web_tpl_theme = '';
- }
- } else {
- if ('default' == $web_tpl_theme && !file_exists(ROOT_PATH.'template/default')) {
- $web_tpl_theme = '';
- }
- }
- config('ey_config.web_tpl_theme', $web_tpl_theme);
- !empty($web_tpl_theme) && $web_tpl_theme .= '/';
-
- /*辨识是否代码适配,还是PC与移动的分离模板*/
- $num = 0;
- $response_type = 0; // 默认是代码适配
- $tpldirList = ["template/{$web_tpl_theme}pc/index.htm","template/{$web_tpl_theme}mobile/index.htm"];
- foreach ($tpldirList as $key => $val) {
- if (file_exists($val)) {
- $num++;
- if ($num >= 2) {
- $response_type = 1; // PC与移动端分离
- }
- }
- }
- // 分离式模板的手机端以动态URL访问
- $separate_mobile = 0;
- if (1 == $response_type && empty($globalTpCache['web_mobile_domain']) && isMobile()) {
- $separate_mobile = 1;
- }
- config('ey_config.response_type', $response_type);
- config('ey_config.separate_mobile', $separate_mobile);
- /*end*/
-
- // mysql的sql-mode模式参数
- $system_sql_mode = !empty($globalTpCache['system_sql_mode']) ? $globalTpCache['system_sql_mode'] : config('ey_config.system_sql_mode');
- config('ey_config.system_sql_mode', $system_sql_mode);
- // 多语言数量
- $system_langnum = !empty($globalTpCache['system_langnum']) ? intval($globalTpCache['system_langnum']) : config('ey_config.system_langnum');
- config('ey_config.system_langnum', $system_langnum);
- // 前台默认语言
- $system_home_default_lang = !empty($globalTpCache['system_home_default_lang']) ? $globalTpCache['system_home_default_lang'] : config('ey_config.system_home_default_lang');
- config('ey_config.system_home_default_lang', $system_home_default_lang);
- // 是否https链接
- $is_https = !empty($globalTpCache['web_is_https']) ? true : config('is_https');
- config('is_https', $is_https);
- // 前台默认区域
- // $site_default_home = !empty($globalTpCache['site_default_home']) ? $globalTpCache['site_default_home'] : config('ey_config.site_default_home');
- // config('ey_config.site_default_home', $site_default_home);
-
- // 是否存在问答插件
- $is_ask_weapp = false;
- if (is_dir('./weapp/Ask/')) {
- $is_ask_weapp = true;
- }
- //是否存在tags插件
- $is_tags_weapp = false;
- if (is_dir('./weapp/Tags/')) {
- $weappList = \think\Db::name('weapp')->where([
- 'status' => 1,
- ])->cache(true, EYOUCMS_CACHE_TIME, 'weapp')
- ->getAllWithIndex('code');
- if (!empty($weappList['Tags'])) {
- $is_tags_weapp = true;
- }
- }
- $uiset = input('param.uiset/s', 'off');
- if ('on' == trim($uiset, '/')) { // 可视化页面必须是兼容模式的URL
- config('ey_config.seo_inlet', 0);
- config('ey_config.seo_pseudo', 1);
- config('ey_config.seo_dynamic_format', 1);
- } else {
- // URL模式
- $seo_pseudo = !empty($globalTpCache['seo_pseudo']) ? intval($globalTpCache['seo_pseudo']) : config('ey_config.seo_pseudo');
- $seo_dynamic_format = !empty($globalTpCache['seo_dynamic_format']) ? intval($globalTpCache['seo_dynamic_format']) : config('ey_config.seo_dynamic_format');
- // 分离式的手机端以动态URL模式访问
- if (1 == $separate_mobile) {
- // 当前配置是动态或者静态模式
- if (in_array($seo_pseudo, [1,2])) {
- $seo_pseudo = 1;
- $seo_dynamic_format = 1;
- }
- }
- // URL格式
- config('ey_config.seo_pseudo', $seo_pseudo);
- config('ey_config.seo_dynamic_format', $seo_dynamic_format);
-
- // 伪静态格式
- $seo_rewrite_format = !empty($globalTpCache['seo_rewrite_format']) ? intval($globalTpCache['seo_rewrite_format']) : config('ey_config.seo_rewrite_format');
- config('ey_config.seo_rewrite_format', $seo_rewrite_format);
- // 是否隐藏入口文件
- $seo_inlet = !empty($globalTpCache['seo_inlet']) ? $globalTpCache['seo_inlet'] : config('ey_config.seo_inlet');
- config('ey_config.seo_inlet', $seo_inlet);
-
- if (3 == $seo_pseudo) {
- $request = request();
- $lang_rewrite = $site_rewrite = [];
- $lang_rewrite_str = $site_rewrite_str = '';
- if (config('city_switch_on')) { // 多城市与多语言只能开启一个,多城市优先级高于多语言
- if (stristr($request->baseFile(), 'index.php')) {
- $site = input('param.site/s');
- if (!empty($site) && $request->subDomain() != $site) {
- $site_rewrite_str .= '<site>/';
- }
- }
-
- if (!empty($site_rewrite_str)) {
- $site_rewrite = [
- // 首页
- $site_rewrite_str.'$' => [
- 'home/Index/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- ];
- }
- $lang_rewrite_str = $site_rewrite_str;
- }
- else { // 多语言
- $lang = input('param.lang/s');
- if (is_language()) {
- if (!stristr($request->baseFile(), 'index.php')) {
- if (!empty($lang) && $lang != $system_home_default_lang) {
- $lang_rewrite_str = '<lang>/';
- }
- } else {
- if (get_current_lang() != get_default_lang()) {
- $lang_rewrite_str .= '<lang>/';
- }
- }
- }
-
- if (!empty($lang_rewrite_str)) {
- $lang_rewrite = [
- // 首页
- $lang_rewrite_str.'$' => [
- 'home/Index/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- ];
- }
- }
-
- if (in_array($seo_rewrite_format, [1,3,4])) { // 精简伪静态
- $home_rewrite = [
- // 会员中心
- $lang_rewrite_str.'user$' => [
- 'user/Users/login',
- ['ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'reg$' => [
- 'user/Users/reg',
- ['ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'centre$' => [
- 'user/Users/centre',
- ['ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'user/index$' => [
- 'user/Users/index',
- ['ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'cart$' => [
- 'user/Shop/shop_cart_list',
- ['ext' => ''],
- 'cache'=>1
- ],
-
- // 搜索伪静态
- $lang_rewrite_str.'sindex$' => [
- 'home/Search/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'search$' => [
- 'home/Search/lists',
- ['method' => 'get', 'ext' => 'html'],
- 'cache'=>1
- ],
- ];
- if (config('city_switch_on')) {
- $lang_rewrite_str_1 = str_replace('<site>/', '', $lang_rewrite_str);
- $home_rewrite += [
- // 多城市站点主页
- $lang_rewrite_str_1.'citysite$' => [
- 'home/Citysite/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- ];
- }
- if (false === $is_tags_weapp){
- $lang_rewrite_str_1 = str_replace('<site>/', '', $lang_rewrite_str);
- $home_rewrite += [
- // 标签伪静态
- $lang_rewrite_str_1.'tags$' => [
- 'home/Tags/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str_1.'tags/<tagid>_<page>$' => [
- 'home/Tags/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tagid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str_1.'tags/<tagid>$' => [
- 'home/Tags/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tagid' => '[\d]+'],
- 'cache'=>1
- ],
- ];
- }
- if (false === $is_ask_weapp) {
- // 问答模型
- $home_rewrite += [
- $lang_rewrite_str.'ask/list_<type_id>_p<p>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['type_id' => '[\d]+', 'p' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/list_<is_recom>_<type_id>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['is_recom' => '[\d]+', 'type_id' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/list_<type_id>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['type_id' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/view_<ask_id>$' => [
- 'home/Ask/details',
- ['method' => 'get', 'ext' => 'html'],
- ['ask_id' => '[\d]+'],
- 'cache'=>1
- ],
- ];
- }
- $home_rewrite += [
- // 列表页 - 分页
- $lang_rewrite_str.'<tid>/list_<typeid>_<page>$' => [
- 'home/Lists/index',
- ['method' => 'get', 'ext' => ''],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- // 列表页
- $lang_rewrite_str.'<tid>$' => [
- 'home/Lists/index',
- ['method' => 'get', 'ext' => ''],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- // 内容页
- $lang_rewrite_str.'<dirname>/<aid>$' => [
- 'home/View/index',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- ];
- if ($seo_rewrite_format == 4) { // 父目录/当前目录/
- $arctype_list = get_all_arctype();
- foreach ($arctype_list as $key=>$val){
- $parent_dir = ""; //$val['dirname']."/";
- if (!empty($val['parent_id'])) {
- $parent_dir = get_all_parent_dirpath($val['parent_id'],$arctype_list,$parent_dir);
- } else {
- $parent_dir = get_all_parent_dirpath($val['id'],$arctype_list,$parent_dir);
- }
- $dirname = trim(str_ireplace("/", "-", $parent_dir),"-");
- if(!empty($dirname)){
- $home_rewrite += [
- // 列表页 - 分页
- $lang_rewrite_str.$parent_dir.'<tid>/list_<typeid>_<page>$' => [
- 'home/Lists/index?'.$dirname,
- ['method' => 'get', 'ext' => ''],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- // 列表页
- $lang_rewrite_str.$parent_dir.'<tid>$' => [
- 'home/Lists/index?'.$dirname,
- ['method' => 'get', 'ext' => ''],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- // 内容页
- $lang_rewrite_str.$parent_dir.'<dirname>/<aid>$' => [
- 'home/View/index?'.$dirname,
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- ];
- }
- }
- }
- } else {
- $home_rewrite = [
- // 会员中心
- $lang_rewrite_str.'Users/login$' => [
- 'user/Users/login',
- ['ext' => 'html'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'Users/reg$' => [
- 'user/Users/reg',
- ['ext' => 'html'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'Users/centre$' => [
- 'user/Users/centre',
- ['ext' => 'html'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'Users/index$' => [
- 'user/Users/index',
- ['ext' => 'html'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'Users/cart$' => [
- 'user/Shop/shop_cart_list',
- ['ext' => 'html'],
- 'cache'=>1
- ],
- // 文章模型伪静态
- $lang_rewrite_str.'article/<tid>/list_<typeid>_<page>$' => [
- 'home/Article/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'article/<tid>$' => [
- 'home/Article/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.'article/<dirname>/<aid>$' => [
- 'home/Article/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- // 产品模型伪静态
- $lang_rewrite_str.'product/<tid>/list_<typeid>_<page>$' => [
- 'home/Product/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'product/<tid>$' => [
- 'home/Product/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.'product/<dirname>/<aid>$' => [
- 'home/Product/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- // 图集模型伪静态
- $lang_rewrite_str.'images/<tid>/list_<typeid>_<page>$' => [
- 'home/Images/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'images/<tid>$' => [
- 'home/Images/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.'images/<dirname>/<aid>$' => [
- 'home/Images/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- // 下载模型伪静态
- $lang_rewrite_str.'download/<tid>/list_<typeid>_<page>$' => [
- 'home/Download/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'download/<tid>$' => [
- 'home/Download/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.'download/<dirname>/<aid>$' => [
- 'home/Download/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- // 视频模型伪静态
- $lang_rewrite_str.'media/<tid>/list_<typeid>_<page>$' => [
- 'home/Media/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'media/<tid>$' => [
- 'home/Media/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.'media/<dirname>/<aid>$' => [
- 'home/Media/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- // 专题模型伪静态
- $lang_rewrite_str.'special/<tid>/list_<typeid>_<page>$' => [
- 'home/Special/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'special/<tid>$' => [
- 'home/Special/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.'special/<dirname>/<aid>$' => [
- 'home/Special/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- // 单页模型伪静态
- $lang_rewrite_str.'single/<tid>$' => [
- 'home/Single/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- // 搜索伪静态
- $lang_rewrite_str.'sindex$' => [
- 'home/Search/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'search$' => [
- 'home/Search/lists',
- ['method' => 'get', 'ext' => 'html'],
- 'cache'=>1
- ],
- // 留言模型
- $lang_rewrite_str.'guestbook/<tid>$' => [
- 'home/Guestbook/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- ];
- if (config('city_switch_on')) {
- $lang_rewrite_str_1 = str_replace('<site>/', '', $lang_rewrite_str);
- $home_rewrite += [
- // 多城市站点主页
- $lang_rewrite_str_1.'citysite$' => [
- 'home/Citysite/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- ];
- }
- if (false === $is_tags_weapp){
- $lang_rewrite_str_1 = str_replace('<site>/', '', $lang_rewrite_str);
- $home_rewrite += [
- // 标签伪静态
- $lang_rewrite_str_1.'tags$' => [
- 'home/Tags/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str_1.'tags/<tagid>_<page>$' => [
- 'home/Tags/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tagid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str_1.'tags/<tagid>$' => [
- 'home/Tags/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tagid' => '[\d]+'],
- 'cache'=>1
- ],
- ];
- }
- if (false === $is_ask_weapp) {
- // 问答模型
- $home_rewrite += [
- $lang_rewrite_str.'ask/list_<type_id>_p<p>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['type_id' => '[\d]+', 'p' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/list_<is_recom>_<type_id>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['is_recom' => '[\d]+', 'type_id' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/list_<type_id>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['type_id' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/view_<ask_id>$' => [
- 'home/Ask/details',
- ['method' => 'get', 'ext' => 'html'],
- ['ask_id' => '[\d]+'],
- 'cache'=>1
- ],
- ];
- }
-
- /*自定义模型*/
- $cacheKey = "application_route_channeltype";
- $channeltype_row = \think\Cache::get($cacheKey);
- if (empty($channeltype_row)) {
- $channeltype_row = \think\Db::name('channeltype')->field('nid,ctl_name')
- ->where([
- 'ifsystem' => 0,
- ])
- ->select();
- \think\Cache::set($cacheKey, $channeltype_row, EYOUCMS_CACHE_TIME, "channeltype");
- }
- foreach ($channeltype_row as $value) {
- $home_rewrite += [
- $lang_rewrite_str.$value['nid'].'/<tid>/list_<typeid>_<page>$' => [
- 'home/'.$value['ctl_name'].'/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid'], 'typeid' => '[\d]+', 'page' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.$value['nid'].'/<tid>$' => [
- 'home/'.$value['ctl_name'].'/lists',
- ['method' => 'get', 'ext' => 'html'],
- ['tid' => $__pattern__['tid']],
- 'cache'=>1
- ],
- $lang_rewrite_str.$value['nid'].'/<dirname>/<aid>$' => [
- 'home/'.$value['ctl_name'].'/view',
- ['method' => 'get', 'ext' => 'html'],
- ['dirname' => $__pattern__['dirname'], 'aid' => $__pattern__['aid']],
- 'cache'=>1
- ],
- ];
- }
- /*--end*/
- }
- $home_rewrite = array_merge($lang_rewrite, $site_rewrite, $home_rewrite);
- }
- else if (2 == $seo_pseudo) {
- $lang_rewrite_str = $site_rewrite_str = '';
- $home_rewrite = [];
- if (false === $is_ask_weapp) {
- // 问答模型
- $home_rewrite += [
- $lang_rewrite_str.'ask/list_<type_id>_p<p>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['type_id' => '[\d]+', 'p' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/list_<is_recom>_<type_id>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['is_recom' => '[\d]+', 'type_id' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/list_<type_id>$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- ['type_id' => '[\d]+'],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask$' => [
- 'home/Ask/index',
- ['method' => 'get', 'ext' => ''],
- 'cache'=>1
- ],
- $lang_rewrite_str.'ask/view_<ask_id>$' => [
- 'home/Ask/details',
- ['method' => 'get', 'ext' => 'html'],
- ['ask_id' => '[\d]+'],
- 'cache'=>1
- ],
- ];
- }
- }
- /*插件模块路由*/
- $weapp_route_file = 'plugins/route.php';
- if (file_exists(APP_PATH.$weapp_route_file)) {
- $weapp_route = include_once $weapp_route_file;
- $route = array_merge($weapp_route, $route);
- }
- /*--end*/
-
-
- /* 扩展路由 ZMH 2024-01-23 */
- $route_ext_file = "route_ext.php";
- if (file_exists(APP_PATH.$route_ext_file)) {
- $route_ext = include_once $route_ext_file;
- // $route = array_merge($route_ext, $route);
- set_route_ext();
- }
- }
-
- $route = array_merge($route, $home_rewrite);
- // var_dump($route);
- return $route;
|