|
@@ -64,46 +64,8 @@ class Bootstrap extends Bootstrap_Abstract |
|
@@ -64,46 +64,8 @@ class Bootstrap extends Bootstrap_Abstract |
64
|
*/
|
64
|
*/
|
65
|
public function _initRoute(Dispatcher $dispatcher)
|
65
|
public function _initRoute(Dispatcher $dispatcher)
|
66
|
{
|
66
|
{
|
67
|
- $hostParts = explode('.', $dispatcher->getRequest()->getServer('HTTP_HOST', ''));
|
|
|
68
|
- $level = count($hostParts) - 1;
|
|
|
69
|
-
|
|
|
70
|
- /* 根据域名的级别,设置默认的模块、控制器、方法 */
|
|
|
71
|
- $module = 'Index';
|
|
|
72
|
- $controller = 'Index';
|
|
|
73
|
- $action = 'Index';
|
|
|
74
|
- // 三级域名
|
|
|
75
|
- if (3 === $level) {
|
|
|
76
|
- $subDomain = strval($hostParts[0]);
|
|
|
77
|
- switch (strtolower($subDomain)) {
|
|
|
78
|
- case 'm': // 老版(到频道选择)
|
|
|
79
|
- case 'buy': // 测试环境的域名, 以后可去掉
|
|
|
80
|
- break;
|
|
|
81
|
- case 'new': // 原新版(到男生首页)
|
|
|
82
|
- $controller = 'Boys';
|
|
|
83
|
- break;
|
|
|
84
|
- case 'search': // 搜索
|
|
|
85
|
- $controller = 'Search';
|
|
|
86
|
- $action = 'List';
|
|
|
87
|
- break;
|
|
|
88
|
- case 'guang': // 逛
|
|
|
89
|
- $module = 'Guang';
|
|
|
90
|
- break;
|
|
|
91
|
- case 'list': // 商品列表
|
|
|
92
|
- $module = 'Product';
|
|
|
93
|
- break;
|
|
|
94
|
- default: // 其它(识别为品牌)
|
|
|
95
|
- $module = 'Product';
|
|
|
96
|
- $action = 'Brand';
|
|
|
97
|
- $dispatcher->getRequest()->setParam('named', $subDomain);
|
|
|
98
|
- break;
|
|
|
99
|
- }
|
|
|
100
|
- }
|
|
|
101
|
- $dispatcher->getRequest()->module = $module;
|
|
|
102
|
- $dispatcher->getRequest()->controller = $controller;
|
|
|
103
|
- $dispatcher->getRequest()->action = $action;
|
|
|
104
|
-
|
|
|
105
|
/* 根据对应模块的配置,添加相应的路由规则 */
|
67
|
/* 根据对应模块的配置,添加相应的路由规则 */
|
106
|
- $iniFile = APPLICATION_PATH . '/configs/routes.' . strtolower($module) . '.ini';
|
68
|
+ $iniFile = APPLICATION_PATH . '/configs/routes.index.ini';
|
107
|
if (file_exists($iniFile)) {
|
69
|
if (file_exists($iniFile)) {
|
108
|
$config = new Config\Ini($iniFile);
|
70
|
$config = new Config\Ini($iniFile);
|
109
|
if (isset($config->routes)) {
|
71
|
if (isset($config->routes)) {
|