compact with the old station url access rule, and configure the sub domain eg gu…
…ang,list,search,brands...
Showing
34 changed files
with
1849 additions
and
106 deletions
@@ -89,6 +89,18 @@ class AbstractAction extends Controller_Abstract | @@ -89,6 +89,18 @@ class AbstractAction extends Controller_Abstract | ||
89 | } | 89 | } |
90 | 90 | ||
91 | /** | 91 | /** |
92 | + * 封装一下获取YAF内部的参数 | ||
93 | + * | ||
94 | + * @param String $key | ||
95 | + * @param mixed $default | ||
96 | + * @return mixed | ||
97 | + */ | ||
98 | + protected function param($key, $default = null) | ||
99 | + { | ||
100 | + return $this->_request->getParam($key, $default); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
92 | * 关闭模板自动渲染 | 104 | * 关闭模板自动渲染 |
93 | * | 105 | * |
94 | * @return void | 106 | * @return void |
@@ -30,5 +30,9 @@ class CacheConfig | @@ -30,5 +30,9 @@ class CacheConfig | ||
30 | const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_GIRLS = 'key_action_product_newsale_discount_girls'; // 女生折扣专区 | 30 | const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_GIRLS = 'key_action_product_newsale_discount_girls'; // 女生折扣专区 |
31 | const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_KIDS = 'key_action_product_newsale_discount_kids'; // 潮童折扣专区 | 31 | const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_KIDS = 'key_action_product_newsale_discount_kids'; // 潮童折扣专区 |
32 | const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_LIFESTYLE = 'key_action_product_newsale_discount_lifestyle'; // 创意生活折扣专区 | 32 | const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_LIFESTYLE = 'key_action_product_newsale_discount_lifestyle'; // 创意生活折扣专区 |
33 | + | ||
34 | + const KEY_ACTION_PRODUCT_INDEX = 'key_action_product_index'; // 品类商品列表 | ||
35 | + const KEY_ACTION_PRODUCT_BRAND = 'key_action_product_brand'; // 品类商品列表 | ||
36 | + const KEY_ACTION_PRODUCT_BRAND_DOMAINS = 'key_action_product_brand_DOMAINS'; // 所有品牌域名列表 | ||
33 | 37 | ||
34 | } | 38 | } |
@@ -60,7 +60,9 @@ class BrandData | @@ -60,7 +60,9 @@ class BrandData | ||
60 | // 构建必传参数 | 60 | // 构建必传参数 |
61 | $param = Yohobuy::param(); | 61 | $param = Yohobuy::param(); |
62 | $param['method'] = 'app.brand.brandlist'; | 62 | $param['method'] = 'app.brand.brandlist'; |
63 | - $param['yh_channel'] = $channel; | 63 | + if (is_numeric($channel)) { |
64 | + $param['yh_channel'] = $channel; | ||
65 | + } | ||
64 | $param['client_secret'] = Sign::getSign($param); | 66 | $param['client_secret'] = Sign::getSign($param); |
65 | 67 | ||
66 | return Yohobuy::get(Yohobuy::API_URL, $param); | 68 | return Yohobuy::get(Yohobuy::API_URL, $param); |
@@ -88,15 +90,18 @@ class BrandData | @@ -88,15 +90,18 @@ class BrandData | ||
88 | * @param integer $brandId 品牌ID | 90 | * @param integer $brandId 品牌ID |
89 | * @return array 品牌介绍信息 | 91 | * @return array 品牌介绍信息 |
90 | */ | 92 | */ |
91 | - public static function getBrandIntro($brandId) | 93 | + public static function getBrandIntro($brandId, $uid) |
92 | { | 94 | { |
93 | // 构建必传参数 | 95 | // 构建必传参数 |
94 | $param = Yohobuy::param(); | 96 | $param = Yohobuy::param(); |
95 | $param['brand_id'] = $brandId; | 97 | $param['brand_id'] = $brandId; |
98 | + $param['uid'] = $uid; | ||
96 | $param['method'] = 'app.brand.getBrandIntro'; | 99 | $param['method'] = 'app.brand.getBrandIntro'; |
97 | $param['client_secret'] = Sign::getSign($param); | 100 | $param['client_secret'] = Sign::getSign($param); |
101 | + | ||
102 | + $cache = empty($uid) ? 3600 : false; | ||
98 | 103 | ||
99 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 104 | + return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 有缓存1小时 |
100 | } | 105 | } |
101 | 106 | ||
102 | /** | 107 | /** |
@@ -105,16 +110,15 @@ class BrandData | @@ -105,16 +110,15 @@ class BrandData | ||
105 | * @param integer $uid 用户id | 110 | * @param integer $uid 用户id |
106 | * @return array banner数据 | 111 | * @return array banner数据 |
107 | */ | 112 | */ |
108 | - public static function getBrandBanner($brandId, $uid) | 113 | + public static function getBrandBanner($brandId) |
109 | { | 114 | { |
110 | // 构建必传参数 | 115 | // 构建必传参数 |
111 | $param = Yohobuy::param(); | 116 | $param = Yohobuy::param(); |
112 | $param['brand_id'] = $brandId; | 117 | $param['brand_id'] = $brandId; |
113 | - $param['uid'] = $uid; | ||
114 | $param['method'] = 'app.brand.banner'; | 118 | $param['method'] = 'app.brand.banner'; |
115 | $param['client_secret'] = Sign::getSign($param); | 119 | $param['client_secret'] = Sign::getSign($param); |
116 | 120 | ||
117 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 121 | + return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 有缓存1小时 |
118 | } | 122 | } |
119 | 123 | ||
120 | /** | 124 | /** |
@@ -161,5 +165,34 @@ class BrandData | @@ -161,5 +165,34 @@ class BrandData | ||
161 | 165 | ||
162 | return Yohobuy::get(Yohobuy::API_URL, $param); | 166 | return Yohobuy::get(Yohobuy::API_URL, $param); |
163 | } | 167 | } |
168 | + | ||
169 | + /** | ||
170 | + * 查询商品数据 | ||
171 | + * | ||
172 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
173 | + * @param integer $brand 品牌Id | ||
174 | + * @param integer $sort 品类查询sort参数 | ||
175 | + * @param integer $color 颜色Id | ||
176 | + * @param integer $size 尺码Id | ||
177 | + * @param string $price 价格 | ||
178 | + * @param string $p_d 折扣 | ||
179 | + * @param string $order 排序方式,默认s_t_desc | ||
180 | + * @param integer $limit 限制查询的数目,默认为60 | ||
181 | + * @param integer $page 查询第几页,默认为第1页 | ||
182 | + * @param integer $channel 表示频道号,1位男生,2为女生 | ||
183 | + * @return array 品类商品数据 | ||
184 | + */ | ||
185 | + public static function filterBrandData($condition, $order = 's_t_desc', $limit = 60, $page = 1) | ||
186 | + { | ||
187 | + $param = Yohobuy::param(); | ||
188 | + $param['method'] = 'app.search.brand'; | ||
189 | + $param['page'] = $page; | ||
190 | + $param['limit'] = $limit; | ||
191 | + $param['order'] = $order; | ||
192 | + $param += $condition; | ||
193 | + $param['client_secret'] = Sign::getSign($param); | ||
194 | + | ||
195 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
196 | + } | ||
164 | 197 | ||
165 | } | 198 | } |
1 | <?php | 1 | <?php |
2 | + | ||
2 | namespace LibModels\Wap\Category; | 3 | namespace LibModels\Wap\Category; |
3 | 4 | ||
4 | use Api\Yohobuy; | 5 | use Api\Yohobuy; |
@@ -15,62 +16,93 @@ use Api\Sign; | @@ -15,62 +16,93 @@ use Api\Sign; | ||
15 | */ | 16 | */ |
16 | class ClassData | 17 | class ClassData |
17 | { | 18 | { |
18 | - /** | ||
19 | - * 获取品类数据 | ||
20 | - * | ||
21 | - * @return array 品类数据 | ||
22 | - */ | 19 | + |
20 | + /** | ||
21 | + * 获取品类数据 | ||
22 | + * | ||
23 | + * @return array 品类数据 | ||
24 | + */ | ||
23 | public static function getClassesData() | 25 | public static function getClassesData() |
24 | { | 26 | { |
25 | - // 构建必传参数 | ||
26 | - $param = Yohobuy::param(); | 27 | + // 构建必传参数 |
28 | + $param = Yohobuy::param(); | ||
27 | 29 | ||
28 | - $param['method'] = 'app.sort.get'; | 30 | + $param['method'] = 'app.sort.get'; |
29 | $param['client_secret'] = Sign::getSign($param); | 31 | $param['client_secret'] = Sign::getSign($param); |
30 | - | 32 | + |
31 | return Yohobuy::get(Yohobuy::API_URL, $param); | 33 | return Yohobuy::get(Yohobuy::API_URL, $param); |
32 | } | 34 | } |
33 | 35 | ||
34 | - /** | ||
35 | - * 查询品类商品数据 | ||
36 | - * | ||
37 | - * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
38 | - * @param integer $brand 品牌Id | ||
39 | - * @param integer $sort 品类查询sort参数 | ||
40 | - * @param integer $color 颜色Id | ||
41 | - * @param integer $size 尺码Id | ||
42 | - * @param string $price 价格 | ||
43 | - * @param string $p_d 折扣 | ||
44 | - * @param string $order 排序方式,默认s_t_desc | ||
45 | - * @param integer $limit 限制查询的数目,默认为60 | ||
46 | - * @param integer $page 查询第几页,默认为第1页 | ||
47 | - * @param integer $channel 表示频道号,1位男生,2为女生 | ||
48 | - * @return array 品类商品数据 | ||
49 | - */ | ||
50 | - public static function selectClassDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1) | ||
51 | - { | ||
52 | - // 构建必传参数 | ||
53 | - $param = Yohobuy::param(); | 36 | + /** |
37 | + * 查询品类商品数据 | ||
38 | + * | ||
39 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
40 | + * @param integer $brand 品牌Id | ||
41 | + * @param integer $sort 品类查询sort参数 | ||
42 | + * @param integer $color 颜色Id | ||
43 | + * @param integer $size 尺码Id | ||
44 | + * @param string $price 价格 | ||
45 | + * @param string $p_d 折扣 | ||
46 | + * @param string $order 排序方式,默认s_t_desc | ||
47 | + * @param integer $limit 限制查询的数目,默认为60 | ||
48 | + * @param integer $page 查询第几页,默认为第1页 | ||
49 | + * @param integer $channel 表示频道号,1位男生,2为女生 | ||
50 | + * @return array 品类商品数据 | ||
51 | + */ | ||
52 | + public static function selectClassDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $order = 's_t_desc', $limit = 60, $page = 1) | ||
53 | + { | ||
54 | + // 构建必传参数 | ||
55 | + $param = Yohobuy::param(); | ||
54 | 56 | ||
55 | - $selectItems = array( | ||
56 | - 'gender' => $gender, | ||
57 | - 'brand' => $brand, | ||
58 | - 'sort' => $sort, | ||
59 | - 'color' => $color, | ||
60 | - 'size' => $size, | ||
61 | - 'price' => $price, | ||
62 | - 'p_d' => $p_d | ||
63 | - ); | ||
64 | - // 拉取筛选参数 | ||
65 | - $queriedParams = array_filter($selectItems, function($v) {return $v !== null;}); | 57 | + $selectItems = array( |
58 | + 'gender' => $gender, | ||
59 | + 'brand' => $brand, | ||
60 | + 'sort' => $sort, | ||
61 | + 'color' => $color, | ||
62 | + 'size' => $size, | ||
63 | + 'price' => $price, | ||
64 | + 'p_d' => $p_d | ||
65 | + ); | ||
66 | + // 拉取筛选参数 | ||
67 | + $queriedParams = array_filter($selectItems); | ||
66 | $param += $queriedParams; | 68 | $param += $queriedParams; |
67 | 69 | ||
68 | - $param['method'] = 'app.search.category'; | ||
69 | - $param['page'] = $page; | ||
70 | - $param['limit'] = $limit; | ||
71 | - $param['yh_channel'] = $channel; | ||
72 | - $param['client_secret'] = Sign::getSign($param); | ||
73 | - | ||
74 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
75 | - } | 70 | + $param['method'] = 'app.search.category'; |
71 | + $param['page'] = $page; | ||
72 | + $param['limit'] = $limit; | ||
73 | + $param['gender'] = $gender; | ||
74 | + $param['client_secret'] = Sign::getSign($param); | ||
75 | + | ||
76 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * 查询商品数据 | ||
81 | + * | ||
82 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
83 | + * @param integer $brand 品牌Id | ||
84 | + * @param integer $sort 品类查询sort参数 | ||
85 | + * @param integer $color 颜色Id | ||
86 | + * @param integer $size 尺码Id | ||
87 | + * @param string $price 价格 | ||
88 | + * @param string $p_d 折扣 | ||
89 | + * @param string $order 排序方式,默认s_t_desc | ||
90 | + * @param integer $limit 限制查询的数目,默认为60 | ||
91 | + * @param integer $page 查询第几页,默认为第1页 | ||
92 | + * @param integer $channel 表示频道号,1位男生,2为女生 | ||
93 | + * @return array 品类商品数据 | ||
94 | + */ | ||
95 | + public static function filterClassData($condition, $order = 's_t_desc', $limit = 60, $page = 1) | ||
96 | + { | ||
97 | + $param = Yohobuy::param(); | ||
98 | + $param['method'] = 'app.search.category'; | ||
99 | + $param['page'] = $page; | ||
100 | + $param['limit'] = $limit; | ||
101 | + $param['order'] = $order; | ||
102 | + $param += $condition; | ||
103 | + $param['client_secret'] = Sign::getSign($param); | ||
104 | + | ||
105 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
106 | + } | ||
107 | + | ||
76 | } | 108 | } |
@@ -9,6 +9,36 @@ class Helpers | @@ -9,6 +9,36 @@ class Helpers | ||
9 | { | 9 | { |
10 | 10 | ||
11 | /** | 11 | /** |
12 | + * 构建网站的URL | ||
13 | + * | ||
14 | + * 备注:所有的URL构建都尽量使用该方法,便于以后维护. | ||
15 | + * | ||
16 | + * @param string $uri 如 "/passport/reg/index" | ||
17 | + * @param array $param 参数项 array(key1 => value1, key2 => value2,) | ||
18 | + * @param string $module 模块名 如"index"表示默认, "guang"表示逛,"list"表示商品列表,"search"表示搜索 | ||
19 | + * @return string | ||
20 | + */ | ||
21 | + public static function url($uri, $param, $module = 'index') | ||
22 | + { | ||
23 | + $url = ''; | ||
24 | + | ||
25 | + switch ($module) { | ||
26 | + case 'guang': // 逛 | ||
27 | + $url = 'http://guang' . SUB_DOMAIN; | ||
28 | + break; | ||
29 | + case 'list': // 商品列表 | ||
30 | + $url = 'http://list' . SUB_DOMAIN; | ||
31 | + break; | ||
32 | + case 'search': // 搜索 | ||
33 | + $url = 'http://search' . SUB_DOMAIN; | ||
34 | + break; | ||
35 | + } | ||
36 | + $url .= $uri . '?' . http_build_query($param, null, '&'); | ||
37 | + | ||
38 | + return $url; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
12 | * 根据尺寸获得图片url | 42 | * 根据尺寸获得图片url |
13 | * @param string $url 路径 | 43 | * @param string $url 路径 |
14 | * @param integer $width 图片宽度 | 44 | * @param integer $width 图片宽度 |
@@ -29,13 +59,31 @@ class Helpers | @@ -29,13 +59,31 @@ class Helpers | ||
29 | */ | 59 | */ |
30 | public static function getFilterUrl($url) | 60 | public static function getFilterUrl($url) |
31 | { | 61 | { |
32 | - $filter = strstr($url, 'openby:yohobuy=', true); | 62 | + $filter = strtr(strstr($url, 'openby:yohobuy=', true), array('m.yohobuy.com' => SUB_DOMAIN)); |
33 | if ($filter) { | 63 | if ($filter) { |
34 | return rtrim(rtrim($filter, '?'), '&'); | 64 | return rtrim(rtrim($filter, '?'), '&'); |
35 | } else { | 65 | } else { |
36 | return $url; | 66 | return $url; |
37 | } | 67 | } |
38 | } | 68 | } |
69 | + | ||
70 | + /** | ||
71 | + * 根据用户访问的COOKIE判断出性别 | ||
72 | + * | ||
73 | + * @return string | ||
74 | + */ | ||
75 | + public static function getGenderByCookie() | ||
76 | + { | ||
77 | + $cookie = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; | ||
78 | + switch (strval($cookie)) { | ||
79 | + case 'boys': // 男 | ||
80 | + return '1,3'; | ||
81 | + case 'girls': // 女 | ||
82 | + return '2,3'; | ||
83 | + default: // 其它 | ||
84 | + return '1,2,3'; | ||
85 | + } | ||
86 | + } | ||
39 | 87 | ||
40 | /** | 88 | /** |
41 | * 格式化商品信息 | 89 | * 格式化商品信息 |
@@ -87,11 +135,11 @@ class Helpers | @@ -87,11 +135,11 @@ class Helpers | ||
87 | * | 135 | * |
88 | * @param array $articleData 需要格式化的资讯数据 | 136 | * @param array $articleData 需要格式化的资讯数据 |
89 | * @param bool $showTag 是否显示左上角标签 | 137 | * @param bool $showTag 是否显示左上角标签 |
90 | - * @param mixed $share 是否显示分享,在APP客户端里嵌入需要传url链接 | 138 | + * @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接 |
91 | * @param bool $showAuthor 控制是否显示作者信息 | 139 | * @param bool $showAuthor 控制是否显示作者信息 |
92 | * @return array | false | 140 | * @return array | false |
93 | */ | 141 | */ |
94 | - public static function formatArticle($articleData, $showTag = true, $share = false, $showAuthor = true) | 142 | + public static function formatArticle($articleData, $showTag = true, $isApp = false, $showAuthor = true) |
95 | { | 143 | { |
96 | // 资讯ID不存在,则不显示 | 144 | // 资讯ID不存在,则不显示 |
97 | if (!isset($articleData['id'])) { | 145 | if (!isset($articleData['id'])) { |
@@ -102,7 +150,7 @@ class Helpers | @@ -102,7 +150,7 @@ class Helpers | ||
102 | $result['id'] = $articleData['id']; | 150 | $result['id'] = $articleData['id']; |
103 | $result['showTags'] = $showTag; | 151 | $result['showTags'] = $showTag; |
104 | $result['img'] = self::getImageUrl($articleData['src'], 640, 640); | 152 | $result['img'] = self::getImageUrl($articleData['src'], 640, 640); |
105 | - $result['url'] = '/guang/detail/index?id=' . $articleData['id']; // @todo | 153 | + $result['url'] = $isApp && !empty($articleData['url']) ? $articleData['url'] : '/info/index?id=' . $articleData['id']; |
106 | $result['title'] = $articleData['title']; | 154 | $result['title'] = $articleData['title']; |
107 | $result['text'] = $articleData['intro']; | 155 | $result['text'] = $articleData['intro']; |
108 | $result['publishTime'] = $articleData['publish_time']; | 156 | $result['publishTime'] = $articleData['publish_time']; |
@@ -113,7 +161,7 @@ class Helpers | @@ -113,7 +161,7 @@ class Helpers | ||
113 | // 收藏 | 161 | // 收藏 |
114 | // $result['collect'] = array(); | 162 | // $result['collect'] = array(); |
115 | // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; | 163 | // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; |
116 | - $result['share'] = $share; | 164 | + $result['share'] = $isApp && isset($articleData['share']['url']) ? $articleData['share']['url'] : false; |
117 | 165 | ||
118 | // 判断是否显示作者信息 | 166 | // 判断是否显示作者信息 |
119 | if ($showAuthor) { | 167 | if ($showAuthor) { |
1 | server | 1 | server |
2 | { | 2 | { |
3 | listen 80; | 3 | listen 80; |
4 | - server_name m.dev.yohobuy.com; | 4 | + server_name m.dev.yohobuy.com *.dev.yohobuy.com; |
5 | 5 | ||
6 | #access_log /nginx/logs/access_test_yoho_cn.log combined; | 6 | #access_log /nginx/logs/access_test_yoho_cn.log combined; |
7 | error_log /nginx/logs/error_test_yoho_cn.log warn; | 7 | error_log /nginx/logs/error_test_yoho_cn.log warn; |
@@ -95,7 +95,7 @@ function loadMore($container, opt) { | @@ -95,7 +95,7 @@ function loadMore($container, opt) { | ||
95 | loading = true; | 95 | loading = true; |
96 | $.ajax({ | 96 | $.ajax({ |
97 | type: 'GET', | 97 | type: 'GET', |
98 | - url: ' /guang/list/page', | 98 | + url: ' /guang/index/page', |
99 | data: opt, | 99 | data: opt, |
100 | success: function(data) { | 100 | success: function(data) { |
101 | if (data === ' ') { | 101 | if (data === ' ') { |
1 | +{{> layout/header}} | ||
2 | +<div class="guang-list-page guang-page yoho-page"> | ||
3 | + {{# guang}} | ||
4 | + <div class="swiper-container"> | ||
5 | + <div class="swiper-wrapper"> | ||
6 | + {{# swiper}} | ||
7 | + <div class="swiper-slide"> | ||
8 | + <a href="{{url}}"> | ||
9 | + <img class="swiper-lazy" data-src="{{img}}"> | ||
10 | + </a> | ||
11 | + <div class="swiper-lazy-preloader"></div> | ||
12 | + </div> | ||
13 | + {{/ swiper}} | ||
14 | + </div> | ||
15 | + <div class="swiper-pagination"></div> | ||
16 | + </div> | ||
17 | + | ||
18 | + {{# author}} | ||
19 | + <div id="author-infos" class="editor-header clearfix" data-id={{id}}> | ||
20 | + <div class="avatar"> | ||
21 | + <img src="{{avatar}}"> | ||
22 | + </div> | ||
23 | + <div class="text"> | ||
24 | + <p class="name">{{name}}</p> | ||
25 | + <p class="info">{{info}}</p> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + {{/ author}} | ||
29 | + | ||
30 | + <ul id="guang-nav" class="guang-nav clearfix"> | ||
31 | + {{# navs}} | ||
32 | + <li class="guang-nav-item {{#focus}}focus{{/focus}}" data-type={{typeId}}> | ||
33 | + {{type}} | ||
34 | + </li> | ||
35 | + {{/ navs}} | ||
36 | + </ul> | ||
37 | + | ||
38 | + <div id="info-list" class="info-list-container"> | ||
39 | + {{# infos}} | ||
40 | + <div class="info-list {{^show}}hide{{/show}}"> | ||
41 | + {{# info}} | ||
42 | + {{> guang/info}} | ||
43 | + {{/ info}} | ||
44 | + </div> | ||
45 | + {{/ infos}} | ||
46 | + </div> | ||
47 | + | ||
48 | + <div id="load-more-info" class="load-more-info"> | ||
49 | + <div class="loading status"> | ||
50 | + 正在加载... | ||
51 | + </div> | ||
52 | + <span class="no-more status hide">没有更多啦</span> | ||
53 | + </div> | ||
54 | + <input id="gender" type="hidden" value={{gender}}> | ||
55 | + {{/ guang}} | ||
56 | +</div> | ||
57 | +{{> layout/footer}} |
1 | +{{> layout/header}} | ||
2 | +<div class="guang-list-page guang-page yoho-page"> | ||
3 | + {{# guang}} | ||
4 | + {{# author}} | ||
5 | + <div id="author-infos" class="editor-header clearfix" data-id={{id}}> | ||
6 | + <div class="avatar"> | ||
7 | + <img src="{{avatar}}"> | ||
8 | + </div> | ||
9 | + <div class="text"> | ||
10 | + <p class="name">{{name}}</p> | ||
11 | + <p class="info">{{info}}</p> | ||
12 | + </div> | ||
13 | + </div> | ||
14 | + {{/ author}} | ||
15 | + | ||
16 | + <div id="info-list" class="info-list"> | ||
17 | + {{# infos}} | ||
18 | + {{> guang/info}} | ||
19 | + {{/ infos}} | ||
20 | + </div> | ||
21 | + | ||
22 | + <div id="load-more-info" class="load-more-info"> | ||
23 | + <div class="loading status"> | ||
24 | + 正在加载... | ||
25 | + </div> | ||
26 | + <span class="no-more status hide">没有更多啦</span> | ||
27 | + </div> | ||
28 | + {{#if tag}} | ||
29 | + <input id="tag" type="hidden" value={{tag}}> | ||
30 | + {{/if}} | ||
31 | + {{/ guang}} | ||
32 | +</div> | ||
33 | +{{> layout/footer}} |
1 | +{{>layout/header}} | ||
2 | +<div class="guang-detail-page guang-page yoho-page"> | ||
3 | + {{# guang}} | ||
4 | + <div id="wrapper"> | ||
5 | + <div id="scroller"> | ||
6 | + {{# author}} | ||
7 | + <div class="author" data-id={{id}}> | ||
8 | + <a class="clearfix" href={{url}}> | ||
9 | + <img class="avatar" src={{avatar}}> | ||
10 | + <span class="name">{{name}}</span> | ||
11 | + <span class="intro">{{intro}}</span> | ||
12 | + </a> | ||
13 | + </div> | ||
14 | + {{/ author}} | ||
15 | + | ||
16 | + {{# detail}} | ||
17 | + <div class="detail"> | ||
18 | + <div class="post-title"> | ||
19 | + <p class="title">{{title}}</p> | ||
20 | + {{> guang/tvls}} | ||
21 | + </div> | ||
22 | + <div class="post-content"> | ||
23 | + {{# content}} | ||
24 | + {{#if text}} | ||
25 | + <div class="post-block text-block"> | ||
26 | + {{text}} | ||
27 | + </div> | ||
28 | + {{/if}} | ||
29 | + | ||
30 | + {{#if bigImage}} | ||
31 | + <div class="post-block big-img-block"> | ||
32 | + <img class="lazy" data-original={{bigImage}}> | ||
33 | + </div> | ||
34 | + {{/if}} | ||
35 | + | ||
36 | + {{#if smallImage}} | ||
37 | + <div class="post-block small-img-block clearfix"> | ||
38 | + {{# smallImage}} | ||
39 | + <img class="lazy" data-original={{src}}> | ||
40 | + {{/ smallImage}} | ||
41 | + </div> | ||
42 | + {{/if}} | ||
43 | + | ||
44 | + {{#if collocation}} | ||
45 | + <div class="post-block collocation-block"> | ||
46 | + <ul class="thumb-container"> | ||
47 | + {{#each collocation}} | ||
48 | + <li class="thumb {{#if @first}}focus{{/if}}"> | ||
49 | + <img class="thumb-img lazy" data-original={{thumb}}> | ||
50 | + <span class="clothe-type {{type}}"></span> | ||
51 | + </li> | ||
52 | + {{/each}} | ||
53 | + </ul> | ||
54 | + <div class="good-list clearfix"> | ||
55 | + {{#each collocation}} | ||
56 | + <div class="prod {{#unless @first}}hide{{/unless}}"> | ||
57 | + {{# goods}} | ||
58 | + {{> good}} | ||
59 | + {{/ goods}} | ||
60 | + </div> | ||
61 | + {{/each}} | ||
62 | + </div> | ||
63 | + </div> | ||
64 | + {{/if}} | ||
65 | + | ||
66 | + {{#if relatedReco}} | ||
67 | + <div class="post-block related-reco-block clearfix"> | ||
68 | + <h2>相关推荐</h2> | ||
69 | + {{#if relatedReco.id}} | ||
70 | + {{#with relatedReco}} | ||
71 | + <div class="one-good"> | ||
72 | + <img class="thumb lazy" data-original={{thumb}}> | ||
73 | + <div class="content-container"> | ||
74 | + <p> | ||
75 | + <span class="reco-name">{{name}}</span> | ||
76 | + </p> | ||
77 | + <p class="price"> | ||
78 | + <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span> | ||
79 | + {{#price}} | ||
80 | + <span class="market-price">¥{{.}}</span> | ||
81 | + {{/price}} | ||
82 | + <a class="check-detail" href={{url}}> | ||
83 | + 查看详情 | ||
84 | + </a> | ||
85 | + </p> | ||
86 | + </div> | ||
87 | + </div> | ||
88 | + {{/with}} | ||
89 | + {{^}} | ||
90 | + <div class="good-list clearfix"> | ||
91 | + {{# relatedReco}} | ||
92 | + {{> good}} | ||
93 | + {{/ relatedReco}} | ||
94 | + </div> | ||
95 | + {{/if}} | ||
96 | + </div> | ||
97 | + {{/if}} | ||
98 | + {{/ content}} | ||
99 | + </div> | ||
100 | + </div> | ||
101 | + {{/ detail}} | ||
102 | + | ||
103 | + {{#if relatedBrand}} | ||
104 | + <div class="related-brand"> | ||
105 | + <h2>相关品牌</h2> | ||
106 | + <ul class="brand-list clearfix"> | ||
107 | + {{# relatedBrand}} | ||
108 | + <li class="brand"> | ||
109 | + <a href={{url}}> | ||
110 | + <div class="brand-logo"> | ||
111 | + <img class="lazy" data-original={{thumb}}> | ||
112 | + </div> | ||
113 | + <p class="brand-name">{{name}}</p> | ||
114 | + </a> | ||
115 | + </li> | ||
116 | + {{/ relatedBrand}} | ||
117 | + </ul> | ||
118 | + </div> | ||
119 | + {{/if}} | ||
120 | + | ||
121 | + {{#if relatedTag}} | ||
122 | + <div class="related-tag"> | ||
123 | + <div class="tag-bg"></div> | ||
124 | + <ul class="tag-list clearfix"> | ||
125 | + {{# relatedTag}} | ||
126 | + <li> | ||
127 | + <a href={{url}}>{{name}}</a> | ||
128 | + </li> | ||
129 | + {{/ relatedTag}} | ||
130 | + </ul> | ||
131 | + </div> | ||
132 | + {{/if}} | ||
133 | + | ||
134 | + {{#if relatedInfo}} | ||
135 | + <div class="related-info"> | ||
136 | + <h2>相关文章</h2> | ||
137 | + <ul class="info-list"> | ||
138 | + {{# relatedInfo}} | ||
139 | + <li> | ||
140 | + <a class="clearfix" href={{url}}> | ||
141 | + <img class="lazy {{#if squareThumb}}square{{/if}}" data-original={{thumb}}> | ||
142 | + <span class="title">{{title}}</span> | ||
143 | + <span class="publish-time"> | ||
144 | + <i class="iconfont"></i> | ||
145 | + {{publishTime}} | ||
146 | + </span> | ||
147 | + </a> | ||
148 | + </li> | ||
149 | + {{/ relatedInfo}} | ||
150 | + </ul> | ||
151 | + </div> | ||
152 | + {{/if}} | ||
153 | + </div> | ||
154 | + </div> | ||
155 | + {{/ guang}} | ||
156 | +</div> | ||
157 | +{{> layout/footer}} |
1 | +{{> layout/header}} | ||
2 | +<div class="good-list-page yoho-page"> | ||
3 | + {{# goodList}} | ||
4 | + {{# search}} | ||
5 | + <div id="search-input" class="search-input"> | ||
6 | + <form action="/product/list/index" method="get"> | ||
7 | + <i class="search-icon iconfont"></i> | ||
8 | + <input type="text" value={{default}} name="query"> | ||
9 | + <i class="clear-input iconfont hide"></i> | ||
10 | + <button id="search" class="search" type="submit">搜索</button> | ||
11 | + </form> | ||
12 | + </div> | ||
13 | + {{/ search}} | ||
14 | + | ||
15 | + {{# brandWay}} | ||
16 | + <div class="brand-way"> | ||
17 | + <a href={{url}}> | ||
18 | + <img class="brand-thumb" src={{thumb}}> | ||
19 | + <span>{{name}}</span> | ||
20 | + <span class="entry"> | ||
21 | + 进入品牌 | ||
22 | + <i class="iconfont"></i> | ||
23 | + </span> | ||
24 | + </a> | ||
25 | + </div> | ||
26 | + {{/ brandWay}} | ||
27 | + | ||
28 | + {{# brandHome}} | ||
29 | + <div id="brand-header" class="brand-header" data-id={{id}}> | ||
30 | + <img class="lazy" data-original={{banner}}> | ||
31 | + <a class="btn-intro" href="javascript:void(0);"> | ||
32 | + 品牌介绍 | ||
33 | + </a> | ||
34 | + <a class="btn-col" href="javascript:void(0);"> | ||
35 | + <span class="iconfont"></span> | ||
36 | + 收藏 | ||
37 | + </a> | ||
38 | + </div> | ||
39 | + <div id="intro-box" class="brand-intro-box hide"> | ||
40 | + <div id="brand-intro" class="brand-intro"> | ||
41 | + <h2>品牌介绍</h2> | ||
42 | + <div class="con"> | ||
43 | + {{{intro}}} | ||
44 | + </div> | ||
45 | + <p class="fo"> | ||
46 | + <span></span> | ||
47 | + 100%品牌授权正品 | ||
48 | + </p> | ||
49 | + <span class="iconfont close-intro"></span> | ||
50 | + </div> | ||
51 | + </div> | ||
52 | + {{/ brandHome}} | ||
53 | + | ||
54 | + <ul id="list-nav" class="list-nav clearfix"> | ||
55 | + <li class="new active"> | ||
56 | + <a href="javascript:void(0);"> | ||
57 | + 最新 | ||
58 | + <span class="iconfont cur"></span> | ||
59 | + </a> | ||
60 | + </li> | ||
61 | + <li class="price"> | ||
62 | + <a href="javascript:void(0);"> | ||
63 | + 价格 | ||
64 | + <span class="icon"> | ||
65 | + <i class="iconfont up"></i> | ||
66 | + <i class="iconfont down cur"></i> | ||
67 | + </span> | ||
68 | + </a> | ||
69 | + </li> | ||
70 | + <li class="discount"> | ||
71 | + <a href="javascript:void(0);"> | ||
72 | + 折扣 | ||
73 | + <span class="icon"> | ||
74 | + <i class="iconfont up"></i> | ||
75 | + <i class="iconfont down cur"></i> | ||
76 | + </span> | ||
77 | + </a> | ||
78 | + </li> | ||
79 | + <li class="filter"> | ||
80 | + <a href="javascript:void(0);"> | ||
81 | + 筛选 | ||
82 | + <span class="iconfont"></span> | ||
83 | + </a> | ||
84 | + </li> | ||
85 | + </ul> | ||
86 | + <div id="goods-container" class="goods-container"> | ||
87 | + <div class="new-goods container"> | ||
88 | + {{# new}} | ||
89 | + {{> good}} | ||
90 | + {{/ new}} | ||
91 | + </div> | ||
92 | + <div class="price-goods container hide"></div> | ||
93 | + <div class="discount-goods container hide"></div> | ||
94 | + | ||
95 | + {{> filter}} | ||
96 | + </div> | ||
97 | + | ||
98 | + {{#if brand}} | ||
99 | + <input id="brand" type="hidden" value={{brand}}> | ||
100 | + {{/if}} | ||
101 | + | ||
102 | + {{#if gender}} | ||
103 | + <input id="gender" type="hidden" value={{gender}}> | ||
104 | + {{/if}} | ||
105 | + | ||
106 | + {{#if msort}} | ||
107 | + <input id="msort" type="hidden" value={{msort}}> | ||
108 | + {{/if}} | ||
109 | + | ||
110 | + {{#if color}} | ||
111 | + <input id="color" type="hidden" value={{color}}> | ||
112 | + {{/if}} | ||
113 | + | ||
114 | + {{#if size}} | ||
115 | + <input id="size" type="hidden" value={{size}}> | ||
116 | + {{/if}} | ||
117 | + | ||
118 | + {{#if price}} | ||
119 | + <input id="price" type="hidden" value={{price}}> | ||
120 | + {{/if}} | ||
121 | + | ||
122 | + {{#if discount}} | ||
123 | + <input id="discount" type="hidden" value={{discount}}> | ||
124 | + {{/if}} | ||
125 | + {{/ goodList}} | ||
126 | +</div> | ||
127 | +{{> layout/footer}} |
1 | +{{> layout/header}} | ||
2 | +<div class="good-list-page yoho-page"> | ||
3 | + {{# goodList}} | ||
4 | + {{# search}} | ||
5 | + <div id="search-input" class="search-input"> | ||
6 | + <form action="/product/list/index" method="get"> | ||
7 | + <i class="search-icon iconfont"></i> | ||
8 | + <input type="text" value={{default}} name="query"> | ||
9 | + <i class="clear-input iconfont hide"></i> | ||
10 | + <button id="search" class="search" type="submit">搜索</button> | ||
11 | + </form> | ||
12 | + </div> | ||
13 | + {{/ search}} | ||
14 | + | ||
15 | + {{# brandWay}} | ||
16 | + <div class="brand-way"> | ||
17 | + <a href={{url}}> | ||
18 | + <img class="brand-thumb" src={{thumb}}> | ||
19 | + <span>{{name}}</span> | ||
20 | + <span class="entry"> | ||
21 | + 进入品牌 | ||
22 | + <i class="iconfont"></i> | ||
23 | + </span> | ||
24 | + </a> | ||
25 | + </div> | ||
26 | + {{/ brandWay}} | ||
27 | + | ||
28 | + {{# brandHome}} | ||
29 | + <div id="brand-header" class="brand-header" data-id={{id}}> | ||
30 | + <img class="lazy" data-original={{banner}}> | ||
31 | + <a class="btn-intro" href="javascript:void(0);"> | ||
32 | + 品牌介绍 | ||
33 | + </a> | ||
34 | + <a class="btn-col" href="javascript:void(0);"> | ||
35 | + <span class="iconfont"></span> | ||
36 | + 收藏 | ||
37 | + </a> | ||
38 | + </div> | ||
39 | + <div id="intro-box" class="brand-intro-box hide"> | ||
40 | + <div id="brand-intro" class="brand-intro"> | ||
41 | + <h2>品牌介绍</h2> | ||
42 | + <div class="con"> | ||
43 | + {{{intro}}} | ||
44 | + </div> | ||
45 | + <p class="fo"> | ||
46 | + <span></span> | ||
47 | + 100%品牌授权正品 | ||
48 | + </p> | ||
49 | + <span class="iconfont close-intro"></span> | ||
50 | + </div> | ||
51 | + </div> | ||
52 | + {{/ brandHome}} | ||
53 | + | ||
54 | + <ul id="list-nav" class="list-nav clearfix"> | ||
55 | + <li class="new active"> | ||
56 | + <a href="javascript:void(0);"> | ||
57 | + 最新 | ||
58 | + <span class="iconfont cur"></span> | ||
59 | + </a> | ||
60 | + </li> | ||
61 | + <li class="price"> | ||
62 | + <a href="javascript:void(0);"> | ||
63 | + 价格 | ||
64 | + <span class="icon"> | ||
65 | + <i class="iconfont up"></i> | ||
66 | + <i class="iconfont down cur"></i> | ||
67 | + </span> | ||
68 | + </a> | ||
69 | + </li> | ||
70 | + <li class="discount"> | ||
71 | + <a href="javascript:void(0);"> | ||
72 | + 折扣 | ||
73 | + <span class="icon"> | ||
74 | + <i class="iconfont up"></i> | ||
75 | + <i class="iconfont down cur"></i> | ||
76 | + </span> | ||
77 | + </a> | ||
78 | + </li> | ||
79 | + <li class="filter"> | ||
80 | + <a href="javascript:void(0);"> | ||
81 | + 筛选 | ||
82 | + <span class="iconfont"></span> | ||
83 | + </a> | ||
84 | + </li> | ||
85 | + </ul> | ||
86 | + <div id="goods-container" class="goods-container"> | ||
87 | + <div class="new-goods container"> | ||
88 | + {{# new}} | ||
89 | + {{> good}} | ||
90 | + {{/ new}} | ||
91 | + </div> | ||
92 | + <div class="price-goods container hide"></div> | ||
93 | + <div class="discount-goods container hide"></div> | ||
94 | + | ||
95 | + {{> filter}} | ||
96 | + </div> | ||
97 | + | ||
98 | + {{#if brand}} | ||
99 | + <input id="brand" type="hidden" value={{brand}}> | ||
100 | + {{/if}} | ||
101 | + | ||
102 | + {{#if gender}} | ||
103 | + <input id="gender" type="hidden" value={{gender}}> | ||
104 | + {{/if}} | ||
105 | + | ||
106 | + {{#if msort}} | ||
107 | + <input id="msort" type="hidden" value={{msort}}> | ||
108 | + {{/if}} | ||
109 | + | ||
110 | + {{#if color}} | ||
111 | + <input id="color" type="hidden" value={{color}}> | ||
112 | + {{/if}} | ||
113 | + | ||
114 | + {{#if size}} | ||
115 | + <input id="size" type="hidden" value={{size}}> | ||
116 | + {{/if}} | ||
117 | + | ||
118 | + {{#if price}} | ||
119 | + <input id="price" type="hidden" value={{price}}> | ||
120 | + {{/if}} | ||
121 | + | ||
122 | + {{#if discount}} | ||
123 | + <input id="discount" type="hidden" value={{discount}}> | ||
124 | + {{/if}} | ||
125 | + {{/ goodList}} | ||
126 | +</div> | ||
127 | +{{> layout/footer}} |
1 | +{{> layout/header}} | ||
2 | +<div class="good-list-page yoho-page"> | ||
3 | + {{# goodList}} | ||
4 | + {{# search}} | ||
5 | + <div id="search-input" class="search-input"> | ||
6 | + <form action="/product/list/index" method="get"> | ||
7 | + <i class="search-icon iconfont"></i> | ||
8 | + <input type="text" value={{default}} name="query"> | ||
9 | + <i class="clear-input iconfont hide"></i> | ||
10 | + <button id="search" class="search" type="submit">搜索</button> | ||
11 | + </form> | ||
12 | + </div> | ||
13 | + {{/ search}} | ||
14 | + | ||
15 | + {{# brandWay}} | ||
16 | + <div class="brand-way"> | ||
17 | + <a href={{url}}> | ||
18 | + <img class="brand-thumb" src={{thumb}}> | ||
19 | + <span>{{name}}</span> | ||
20 | + <span class="entry"> | ||
21 | + 进入品牌 | ||
22 | + <i class="iconfont"></i> | ||
23 | + </span> | ||
24 | + </a> | ||
25 | + </div> | ||
26 | + {{/ brandWay}} | ||
27 | + | ||
28 | + {{# brandHome}} | ||
29 | + <div id="brand-header" class="brand-header" data-id={{id}}> | ||
30 | + <img class="lazy" data-original={{banner}}> | ||
31 | + <a class="btn-intro" href="javascript:void(0);"> | ||
32 | + 品牌介绍 | ||
33 | + </a> | ||
34 | + <a class="btn-col" href="javascript:void(0);"> | ||
35 | + <span class="iconfont"></span> | ||
36 | + 收藏 | ||
37 | + </a> | ||
38 | + </div> | ||
39 | + <div id="intro-box" class="brand-intro-box hide"> | ||
40 | + <div id="brand-intro" class="brand-intro"> | ||
41 | + <h2>品牌介绍</h2> | ||
42 | + <div class="con"> | ||
43 | + {{{intro}}} | ||
44 | + </div> | ||
45 | + <p class="fo"> | ||
46 | + <span></span> | ||
47 | + 100%品牌授权正品 | ||
48 | + </p> | ||
49 | + <span class="iconfont close-intro"></span> | ||
50 | + </div> | ||
51 | + </div> | ||
52 | + {{/ brandHome}} | ||
53 | + | ||
54 | + <ul id="list-nav" class="list-nav clearfix"> | ||
55 | + <li class="new active"> | ||
56 | + <a href="javascript:void(0);"> | ||
57 | + 最新 | ||
58 | + <span class="iconfont cur"></span> | ||
59 | + </a> | ||
60 | + </li> | ||
61 | + <li class="price"> | ||
62 | + <a href="javascript:void(0);"> | ||
63 | + 价格 | ||
64 | + <span class="icon"> | ||
65 | + <i class="iconfont up"></i> | ||
66 | + <i class="iconfont down cur"></i> | ||
67 | + </span> | ||
68 | + </a> | ||
69 | + </li> | ||
70 | + <li class="discount"> | ||
71 | + <a href="javascript:void(0);"> | ||
72 | + 折扣 | ||
73 | + <span class="icon"> | ||
74 | + <i class="iconfont up"></i> | ||
75 | + <i class="iconfont down cur"></i> | ||
76 | + </span> | ||
77 | + </a> | ||
78 | + </li> | ||
79 | + <li class="filter"> | ||
80 | + <a href="javascript:void(0);"> | ||
81 | + 筛选 | ||
82 | + <span class="iconfont"></span> | ||
83 | + </a> | ||
84 | + </li> | ||
85 | + </ul> | ||
86 | + <div id="goods-container" class="goods-container"> | ||
87 | + <div class="new-goods container"> | ||
88 | + {{# new}} | ||
89 | + {{> good}} | ||
90 | + {{/ new}} | ||
91 | + </div> | ||
92 | + <div class="price-goods container hide"></div> | ||
93 | + <div class="discount-goods container hide"></div> | ||
94 | + | ||
95 | + {{> filter}} | ||
96 | + </div> | ||
97 | + | ||
98 | + {{#if brand}} | ||
99 | + <input id="brand" type="hidden" value={{brand}}> | ||
100 | + {{/if}} | ||
101 | + | ||
102 | + {{#if gender}} | ||
103 | + <input id="gender" type="hidden" value={{gender}}> | ||
104 | + {{/if}} | ||
105 | + | ||
106 | + {{#if msort}} | ||
107 | + <input id="msort" type="hidden" value={{msort}}> | ||
108 | + {{/if}} | ||
109 | + | ||
110 | + {{#if color}} | ||
111 | + <input id="color" type="hidden" value={{color}}> | ||
112 | + {{/if}} | ||
113 | + | ||
114 | + {{#if size}} | ||
115 | + <input id="size" type="hidden" value={{size}}> | ||
116 | + {{/if}} | ||
117 | + | ||
118 | + {{#if price}} | ||
119 | + <input id="price" type="hidden" value={{price}}> | ||
120 | + {{/if}} | ||
121 | + | ||
122 | + {{#if discount}} | ||
123 | + <input id="discount" type="hidden" value={{discount}}> | ||
124 | + {{/if}} | ||
125 | + {{/ goodList}} | ||
126 | +</div> | ||
127 | +{{> layout/footer}} |
@@ -16,11 +16,11 @@ use Yaf\Application; | @@ -16,11 +16,11 @@ use Yaf\Application; | ||
16 | use Yaf\Registry; | 16 | use Yaf\Registry; |
17 | use Yaf\Loader; | 17 | use Yaf\Loader; |
18 | use Yaf\Config; | 18 | use Yaf\Config; |
19 | - | ||
20 | use Plugin\TemplateLayout; | 19 | use Plugin\TemplateLayout; |
21 | 20 | ||
22 | class Bootstrap extends Bootstrap_Abstract | 21 | class Bootstrap extends Bootstrap_Abstract |
23 | { | 22 | { |
23 | + | ||
24 | private $_config; | 24 | private $_config; |
25 | 25 | ||
26 | /** | 26 | /** |
@@ -64,16 +64,25 @@ class Bootstrap extends Bootstrap_Abstract | @@ -64,16 +64,25 @@ class Bootstrap extends Bootstrap_Abstract | ||
64 | */ | 64 | */ |
65 | public function _initRoute(Dispatcher $dispatcher) | 65 | public function _initRoute(Dispatcher $dispatcher) |
66 | { | 66 | { |
67 | - /* 根据域名的级别,选择对应的模块 */ | ||
68 | $hostParts = explode('.', $dispatcher->getRequest()->getServer('HTTP_HOST', '')); | 67 | $hostParts = explode('.', $dispatcher->getRequest()->getServer('HTTP_HOST', '')); |
69 | $level = count($hostParts) - 1; | 68 | $level = count($hostParts) - 1; |
69 | + | ||
70 | + /* 根据域名的级别,设置默认的模块、控制器、方法 */ | ||
70 | $module = 'Index'; | 71 | $module = 'Index'; |
72 | + $controller = 'Index'; | ||
73 | + $action = 'Index'; | ||
71 | // 三级域名 | 74 | // 三级域名 |
72 | - if ($level === 3) { | ||
73 | - switch (strtolower(strval($hostParts[0]))) { | ||
74 | - case 'm': | ||
75 | - case 'new': // 默认 | ||
76 | - $module = 'Index'; | 75 | + if (3 === $level) { |
76 | + $subDomain = strval($hostParts[0]); | ||
77 | + switch (strtolower($subDomain)) { | ||
78 | + case 'm': // 老版(到频道选择) | ||
79 | + break; | ||
80 | + case 'new': // 原新版(到男生首页) | ||
81 | + $controller = 'Boys'; | ||
82 | + break; | ||
83 | + case 'search': // 搜索 | ||
84 | + $controller = 'Search'; | ||
85 | + $action = 'List'; | ||
77 | break; | 86 | break; |
78 | case 'guang': // 逛 | 87 | case 'guang': // 逛 |
79 | $module = 'Guang'; | 88 | $module = 'Guang'; |
@@ -82,21 +91,24 @@ class Bootstrap extends Bootstrap_Abstract | @@ -82,21 +91,24 @@ class Bootstrap extends Bootstrap_Abstract | ||
82 | $module = 'Product'; | 91 | $module = 'Product'; |
83 | break; | 92 | break; |
84 | default: // 其它(识别为品牌) | 93 | default: // 其它(识别为品牌) |
85 | - $module = 'Brand'; | 94 | + $module = 'Product'; |
95 | + $action = 'Brand'; | ||
96 | + $dispatcher->getRequest()->setParam('named', $subDomain); | ||
86 | break; | 97 | break; |
87 | } | 98 | } |
88 | } | 99 | } |
89 | $dispatcher->getRequest()->module = $module; | 100 | $dispatcher->getRequest()->module = $module; |
90 | - | 101 | + $dispatcher->getRequest()->controller = $controller; |
102 | + $dispatcher->getRequest()->action = $action; | ||
103 | + | ||
91 | /* 根据对应模块的配置,添加相应的路由规则 */ | 104 | /* 根据对应模块的配置,添加相应的路由规则 */ |
92 | - $iniFile = APPLICATION_PATH . '/configs/routes.' . strtolower($module) . 'ini'; | 105 | + $iniFile = APPLICATION_PATH . '/configs/routes.' . strtolower($module) . '.ini'; |
93 | if (file_exists($iniFile)) { | 106 | if (file_exists($iniFile)) { |
94 | $config = new Config\Ini($iniFile); | 107 | $config = new Config\Ini($iniFile); |
95 | if (isset($config->routes)) { | 108 | if (isset($config->routes)) { |
96 | $dispatcher->getRouter()->addConfig($config->routes); | 109 | $dispatcher->getRouter()->addConfig($config->routes); |
97 | } | 110 | } |
98 | } | 111 | } |
99 | - | ||
100 | } | 112 | } |
101 | 113 | ||
102 | /** | 114 | /** |
@@ -107,15 +119,15 @@ class Bootstrap extends Bootstrap_Abstract | @@ -107,15 +119,15 @@ class Bootstrap extends Bootstrap_Abstract | ||
107 | { | 119 | { |
108 | // 关闭自动渲染模板 | 120 | // 关闭自动渲染模板 |
109 | $dispatcher->autoRender(false); | 121 | $dispatcher->autoRender(false); |
110 | - | 122 | + |
111 | // 判断到不是AJAX请求时, 使用自定义的模板渲染 (Mustache or Handlebars) | 123 | // 判断到不是AJAX请求时, 使用自定义的模板渲染 (Mustache or Handlebars) |
112 | //if (!$dispatcher->getRequest()->isXmlHttpRequest()) { | 124 | //if (!$dispatcher->getRequest()->isXmlHttpRequest()) { |
113 | - $layout = new TemplateLayout(); | ||
114 | - $layout->setScriptPath($this->_config->application->template->path); | ||
115 | - $dispatcher->setView($layout); | 125 | + $layout = new TemplateLayout(); |
126 | + $layout->setScriptPath($this->_config->application->template->path); | ||
127 | + $dispatcher->setView($layout); | ||
116 | //} | 128 | //} |
117 | } | 129 | } |
118 | - | 130 | + |
119 | // /** | 131 | // /** |
120 | // * 初始化第三方包 | 132 | // * 初始化第三方包 |
121 | // * @param Dispatcher $dispatcher | 133 | // * @param Dispatcher $dispatcher |
@@ -126,5 +138,4 @@ class Bootstrap extends Bootstrap_Abstract | @@ -126,5 +138,4 @@ class Bootstrap extends Bootstrap_Abstract | ||
126 | // require $this->_config->composer->path . '/vendor/autoload.php'; | 138 | // require $this->_config->composer->path . '/vendor/autoload.php'; |
127 | // } | 139 | // } |
128 | // } | 140 | // } |
129 | - | ||
130 | } | 141 | } |
@@ -7,6 +7,9 @@ use LibModels\Wap\Product\SearchData; | @@ -7,6 +7,9 @@ use LibModels\Wap\Product\SearchData; | ||
7 | */ | 7 | */ |
8 | class SearchController extends AbstractAction | 8 | class SearchController extends AbstractAction |
9 | { | 9 | { |
10 | + /** | ||
11 | + * 搜索首页 | ||
12 | + */ | ||
10 | public function indexAction() | 13 | public function indexAction() |
11 | { | 14 | { |
12 | $data = array( | 15 | $data = array( |
@@ -41,7 +44,142 @@ class SearchController extends AbstractAction | @@ -41,7 +44,142 @@ class SearchController extends AbstractAction | ||
41 | ) | 44 | ) |
42 | ) | 45 | ) |
43 | ); | 46 | ); |
44 | - $this->_view->display('index', array('search' => $data, 'searchPage' => true, 'pageFooter' => true)); | 47 | + $this->_view->display('index', array( |
48 | + 'search' => $data, | ||
49 | + 'searchPage' => true, | ||
50 | + 'pageFooter' => true | ||
51 | + )); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * 搜索列表页 | ||
56 | + */ | ||
57 | + public function listAction() | ||
58 | + { | ||
59 | + $query = $this->get('query', null); | ||
60 | + $brand = $this->get('brand', null); | ||
61 | + $gender = $this->getCookie('_Channel', 'boys'); | ||
62 | + $p_d = $this->get('p_d', null); | ||
63 | + $misort = $this->get('misort', null); | ||
64 | + $msort = $this->get('msort', null); | ||
65 | + | ||
66 | + $data = array( | ||
67 | + 'pageHeader' => array( | ||
68 | + 'navBack' => true, | ||
69 | + 'navTitle' => '搜索', | ||
70 | + 'navHome' => '/' | ||
71 | + ), | ||
72 | + 'goodListPage' => true, | ||
73 | + 'goodList' => array( | ||
74 | + 'brand' => 0, | ||
75 | + 'msort' => 0, | ||
76 | + 'gender' => $gender, | ||
77 | + 'price' => 0, | ||
78 | + 'size' => 0, | ||
79 | + 'discount' => '' | ||
80 | + ) | ||
81 | + ); | ||
82 | + | ||
83 | + // 首先查询是否属于内置品类 | ||
84 | + $classes = ClassModel::getClassesArr(); | ||
85 | + $classFlag = array_search($query, $classes); | ||
86 | + if($classFlag !== false)// 属于内部品类 | ||
87 | + { | ||
88 | + $data['pageHeader']['navTitle'] = '所有'.$query; | ||
89 | + } | ||
90 | + | ||
91 | + // 如果存在搜索字符串就显示搜索栏 | ||
92 | + if(!is_null($query) && $classFlag === false) | ||
93 | + { | ||
94 | + $data['search'] = array( | ||
95 | + 'default' => $query | ||
96 | + ); | ||
97 | + } | ||
98 | + | ||
99 | + // 转换性别 | ||
100 | + $this->genderTrans($gender); | ||
101 | + | ||
102 | + // 查询数据 | ||
103 | + $listData = SearchData::searchLiDatas($query, $brand, $gender, $p_d, $misort, $msort); | ||
104 | + // 处理返回的数据 | ||
105 | + if (isset($listData['code']) && $listData['code'] === 200) { | ||
106 | + $tmpData = $listData['data']; | ||
107 | + | ||
108 | + // 如果存在品牌信息就显示品牌字段 | ||
109 | + if(isset($tmpData['brand']) && !empty($tmpData['brand'])) | ||
110 | + { | ||
111 | + $brandData = $tmpData['brand']; | ||
112 | + $data['brandWay'] = array( | ||
113 | + 'url' => '/product/list/brand?brand='.$brandData['id'], | ||
114 | + 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40), | ||
115 | + 'name' => $brandData['brand_name'] | ||
116 | + ); | ||
117 | + | ||
118 | + // 设置品牌默认值 | ||
119 | + $data['goodList']['brand'] = $brandData['id']; | ||
120 | + } | ||
121 | + | ||
122 | + $data['goodList'] += ListProcess::getListData($tmpData); | ||
123 | + } | ||
124 | + | ||
125 | + $this->_view->display('list', $data); | ||
126 | + } | ||
127 | + | ||
128 | + /** | ||
129 | + * Ajax异步筛选请求 | ||
130 | + */ | ||
131 | + public function searchAction() | ||
132 | + { | ||
133 | + if($this->isAjax()) | ||
134 | + { | ||
135 | + $query = $this->get('query', null); | ||
136 | + $brand = $this->get('brand', null); | ||
137 | + $gender = $this->get('gender', null); | ||
138 | + $color = $this->get('color', null); | ||
139 | + $size = $this->get('size', null); | ||
140 | + $price = $this->get('price', null); | ||
141 | + $p_d = $this->get('discount', null); | ||
142 | + $sort = $this->get('msort', null); | ||
143 | + | ||
144 | + // 转换性别 | ||
145 | + $this->genderTrans($gender); | ||
146 | + | ||
147 | + // 转换排序方式 | ||
148 | + $order = $this->get('order', null); | ||
149 | + $type = $this->get('type', ''); | ||
150 | + switch ($type) { | ||
151 | + case 'price': | ||
152 | + $order = ($order == 0) ? 's_p_desc' : 's_p_asc'; | ||
153 | + break; | ||
154 | + case 'discount': | ||
155 | + $order = ($order == 0) ? 'p_d_desc' : 'p_d_asc'; | ||
156 | + break; | ||
157 | + case 'newest': | ||
158 | + default: | ||
159 | + $order = ($order == 0) ? 's_t_desc' : 's_t_asc'; | ||
160 | + break; | ||
161 | + } | ||
162 | + | ||
163 | + $data = array(); | ||
164 | + // 查询数据 | ||
165 | + $listData = SearchData::searchLiDatas($query, $brand, $gender, $color, $size, $price, $p_d, $sort, $order); | ||
166 | + // 处理返回的数据 | ||
167 | + if (isset($listData['code']) && $listData['code'] === 200) { | ||
168 | + $tmpData = $listData['data']; | ||
169 | + | ||
170 | + unset($tmpData['filter']);// 不要筛选条件的数据 | ||
171 | + $data = ListProcess::getListData($tmpData); | ||
172 | + } | ||
173 | + | ||
174 | + if(empty($data)) | ||
175 | + { | ||
176 | + echo ' '; | ||
177 | + } | ||
178 | + else | ||
179 | + { | ||
180 | + $this->_view->display('page', $data); | ||
181 | + } | ||
182 | + } | ||
45 | } | 183 | } |
46 | 184 | ||
47 | /** | 185 | /** |
@@ -86,7 +86,7 @@ class BrandModel | @@ -86,7 +86,7 @@ class BrandModel | ||
86 | $list['name'] = $row['brand_name']; | 86 | $list['name'] = $row['brand_name']; |
87 | $list['isHot'] = ($row['is_hot'] === 'Y') ? true : false; | 87 | $list['isHot'] = ($row['is_hot'] === 'Y') ? true : false; |
88 | $list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false; | 88 | $list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false; |
89 | - $list['url'] = 'http://' . $row['brand_domain'] . '.' . OLD_DOMAIN; | 89 | + $list['url'] = 'http://' . $row['brand_domain'] . SUB_DOMAIN; |
90 | $build['list'][] = $list; | 90 | $build['list'][] = $list; |
91 | } | 91 | } |
92 | $result['brandList'][] = $build; | 92 | $result['brandList'][] = $build; |
@@ -18,7 +18,7 @@ use Plugin\Cache; | @@ -18,7 +18,7 @@ use Plugin\Cache; | ||
18 | */ | 18 | */ |
19 | class ClassModel | 19 | class ClassModel |
20 | { | 20 | { |
21 | - | 21 | + |
22 | /** | 22 | /** |
23 | * 根据频道获取品牌一览数据 | 23 | * 根据频道获取品牌一览数据 |
24 | * | 24 | * |
@@ -41,20 +41,17 @@ class ClassModel | @@ -41,20 +41,17 @@ class ClassModel | ||
41 | $num = 1; | 41 | $num = 1; |
42 | $data = ClassData::getClassesData(); | 42 | $data = ClassData::getClassesData(); |
43 | 43 | ||
44 | - if(!isset($data['code']) || $data['code'] !== 200) | ||
45 | - { | 44 | + if (!isset($data['code']) || $data['code'] !== 200) { |
46 | break; | 45 | break; |
47 | } | 46 | } |
48 | 47 | ||
49 | - if(!isset($data['data'])) | ||
50 | - { | 48 | + if (!isset($data['data'])) { |
51 | break; | 49 | break; |
52 | } | 50 | } |
53 | 51 | ||
54 | - foreach ($data['data'] as $k => $v){ | ||
55 | - $oneClass = array('name'=>$k, 'ca'=>array()); | ||
56 | - if($num === 1) | ||
57 | - { | 52 | + foreach ($data['data'] as $k => $v) { |
53 | + $oneClass = array('name' => $k, 'ca' => array()); | ||
54 | + if ($num === 1) { | ||
58 | $oneClass['focus'] = true; | 55 | $oneClass['focus'] = true; |
59 | } | 56 | } |
60 | 57 | ||
@@ -66,8 +63,8 @@ class ClassModel | @@ -66,8 +63,8 @@ class ClassModel | ||
66 | $subitem = array(); | 63 | $subitem = array(); |
67 | $subitem['name'] = $value['category_name']; | 64 | $subitem['name'] = $value['category_name']; |
68 | $subitem['id'] = $value['relation_parameter']['sort']; | 65 | $subitem['id'] = $value['relation_parameter']['sort']; |
69 | - $subitem['url'] = '/product/list/class?sort='.$value['relation_parameter']['sort']; | ||
70 | - | 66 | + $subitem['url'] = '/product/list/class?sort=' . $value['relation_parameter']['sort']; |
67 | + | ||
71 | $item['sub'][] = $subitem; | 68 | $item['sub'][] = $subitem; |
72 | } | 69 | } |
73 | 70 | ||
@@ -88,13 +85,11 @@ class ClassModel | @@ -88,13 +85,11 @@ class ClassModel | ||
88 | Cache::set(CacheConfig::KEY_CATEGORY_CLASSES_DATA, $classes); | 85 | Cache::set(CacheConfig::KEY_CATEGORY_CLASSES_DATA, $classes); |
89 | } | 86 | } |
90 | } | 87 | } |
91 | - | ||
92 | - }while(false); | 88 | + } while (false); |
93 | 89 | ||
94 | return $classes; | 90 | return $classes; |
95 | } | 91 | } |
96 | 92 | ||
97 | - | ||
98 | /** | 93 | /** |
99 | * 返回品类构成的数组 | 94 | * 返回品类构成的数组 |
100 | * | 95 | * |
@@ -115,12 +110,12 @@ class ClassModel | @@ -115,12 +110,12 @@ class ClassModel | ||
115 | return $classes; | 110 | return $classes; |
116 | } | 111 | } |
117 | 112 | ||
118 | - | ||
119 | /** | 113 | /** |
120 | * 自定义array_column函数 | 114 | * 自定义array_column函数 |
121 | * | 115 | * |
122 | * @return array 返回数组中指定的一列组成的数组 | 116 | * @return array 返回数组中指定的一列组成的数组 |
123 | */ | 117 | */ |
118 | + | ||
124 | /** | 119 | /** |
125 | * 自定义array_column函数 | 120 | * 自定义array_column函数 |
126 | * @param array $input 需要取出数组咧的多维数组 | 121 | * @param array $input 需要取出数组咧的多维数组 |
@@ -132,19 +127,18 @@ class ClassModel | @@ -132,19 +127,18 @@ class ClassModel | ||
132 | { | 127 | { |
133 | $array = array(); | 128 | $array = array(); |
134 | foreach ($input as $value) { | 129 | foreach ($input as $value) { |
135 | - if ( ! isset($value[$columnKey])) { | 130 | + if (!isset($value[$columnKey])) { |
136 | trigger_error("Key \"$columnKey\" does not exist in array"); | 131 | trigger_error("Key \"$columnKey\" does not exist in array"); |
137 | return false; | 132 | return false; |
138 | } | 133 | } |
139 | if (is_null($indexKey)) { | 134 | if (is_null($indexKey)) { |
140 | $array[] = $value[$columnKey]; | 135 | $array[] = $value[$columnKey]; |
141 | - } | ||
142 | - else { | ||
143 | - if ( ! isset($value[$indexKey])) { | 136 | + } else { |
137 | + if (!isset($value[$indexKey])) { | ||
144 | trigger_error("Key \"$indexKey\" does not exist in array"); | 138 | trigger_error("Key \"$indexKey\" does not exist in array"); |
145 | return false; | 139 | return false; |
146 | } | 140 | } |
147 | - if ( ! is_scalar($value[$indexKey])) { | 141 | + if (!is_scalar($value[$indexKey])) { |
148 | trigger_error("Key \"$indexKey\" does not contain scalar value"); | 142 | trigger_error("Key \"$indexKey\" does not contain scalar value"); |
149 | return false; | 143 | return false; |
150 | } | 144 | } |
@@ -152,7 +146,6 @@ class ClassModel | @@ -152,7 +146,6 @@ class ClassModel | ||
152 | } | 146 | } |
153 | } | 147 | } |
154 | return $array; | 148 | return $array; |
155 | - | ||
156 | } | 149 | } |
157 | - | 150 | + |
158 | } | 151 | } |
1 | +<?php | ||
2 | + | ||
3 | +namespace Guang; | ||
4 | + | ||
5 | +use LibModels\Wap\Guang\ListData; | ||
6 | +use Plugin\Helpers; | ||
7 | + | ||
8 | +/** | ||
9 | + * | ||
10 | + * @name IndexModel | ||
11 | + * @package models/Guang | ||
12 | + * @copyright yoho.inc | ||
13 | + * @version 1.0 (2015-10-27 11:31:49) | ||
14 | + * @author fei.hong <fei.hong@yoho.cn> | ||
15 | + */ | ||
16 | +class IndexModel | ||
17 | +{ | ||
18 | + | ||
19 | + /** | ||
20 | + * 获取逛首页分类内容列表 | ||
21 | + * | ||
22 | + * @param string $gender "1,3"表示男, "2,3"表示女 | ||
23 | + * @param int channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活 | ||
24 | + * @param int type 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士 | ||
25 | + * @param int $uid 用户ID | ||
26 | + * @param string $udid 客户端唯一标识 | ||
27 | + * @param int $page 分页第几页, 默认第1页 | ||
28 | + * @return array | ||
29 | + */ | ||
30 | + public static function getArticleGroup($gender, $type, $uid, $udid, $page = 1) | ||
31 | + { | ||
32 | + // 逛首页的分类名称列表 | ||
33 | + $category = ListData::category(); | ||
34 | + $articleGroup = array(); | ||
35 | + | ||
36 | + switch ($gender) { | ||
37 | + case '1,3': // 男 | ||
38 | + $articleGroup = ListData::articleGroup($category['data'], '1,3', $uid, $udid, $page); | ||
39 | + break; | ||
40 | + case '2,3': // 女 | ||
41 | + $articleGroup = ListData::articleGroup($category['data'], '2,3', $uid, $udid, $page); | ||
42 | + break; | ||
43 | + default: // 其它所有 | ||
44 | + $articleGroup = ListData::articleGroup($category['data'], '1,2,3', $uid, $udid, $page); | ||
45 | + break; | ||
46 | + } | ||
47 | + | ||
48 | + $data = array(); | ||
49 | + $build = array(); | ||
50 | + | ||
51 | + // 模板中使用JS的标识 | ||
52 | + $data['guangHome'] = true; | ||
53 | + | ||
54 | + // 顶部的分类列表 | ||
55 | + foreach ($category['data'] as $value) { | ||
56 | + $build = array(); | ||
57 | + $build['typeId'] = $value['id']; | ||
58 | + $build['type'] = $value['name']; | ||
59 | + $build['focus'] = ($value['id'] == $type); | ||
60 | + $data['navs'][] = $build; | ||
61 | + } | ||
62 | + | ||
63 | + $data['guang']['swiper'] = array(); | ||
64 | + $data['guang']['infos'] = array(); | ||
65 | + foreach ($articleGroup as $id => $value) { | ||
66 | + // 判断是否有内容 | ||
67 | + if (empty($value['list'])) { | ||
68 | + continue; | ||
69 | + } | ||
70 | + | ||
71 | + // 轮番广告 | ||
72 | + if ($id == 0) { | ||
73 | + $build = array(); | ||
74 | + foreach ($value['list']['adlist'] as $banner) { | ||
75 | + $build['url'] = Helpers::getFilterUrl($banner['url']); | ||
76 | + $build['img'] = Helpers::getImageUrl($banner['src'], 830, 327); | ||
77 | + $data['guang']['swiper'][] = $build; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + // 内容列表 | ||
82 | + $build = array(); | ||
83 | + $build['show'] = ($id == $type); | ||
84 | + foreach ($value['list']['artList'] as $article) { | ||
85 | + $build['info'][] = Helpers::formatArticle($article, true, false); | ||
86 | + } | ||
87 | + $data['guang']['infos'][] = $build; | ||
88 | + } | ||
89 | + | ||
90 | + // 分页需要参数 | ||
91 | + $data['guang']['gender'] = $gender; | ||
92 | + | ||
93 | + $category = array(); | ||
94 | + | ||
95 | + return $data; | ||
96 | + } | ||
97 | + | ||
98 | +} |
@@ -47,7 +47,7 @@ class SideModel | @@ -47,7 +47,7 @@ class SideModel | ||
47 | $result[$key]['textCn'] = $value['sort_name']; | 47 | $result[$key]['textCn'] = $value['sort_name']; |
48 | $result[$key]['textEn'] = $value['sort_name_en']; | 48 | $result[$key]['textEn'] = $value['sort_name_en']; |
49 | $result[$key]['styleClass'] = strtolower($value['sort_name_en']); | 49 | $result[$key]['styleClass'] = strtolower($value['sort_name_en']); |
50 | - $result[$key]['url'] = $value['sort_url']; | 50 | + $result[$key]['url'] = Helpers::getFilterUrl($value['sort_url']); |
51 | $result[$key]['img'] = Helpers::getImageUrl($value['sort_ico'], 60, 60); | 51 | $result[$key]['img'] = Helpers::getImageUrl($value['sort_ico'], 60, 60); |
52 | } | 52 | } |
53 | } | 53 | } |
1 | +<?php | ||
2 | + | ||
3 | +namespace Product; | ||
4 | + | ||
5 | +use Configs\CacheConfig; | ||
6 | +use LibModels\Wap\Category\ClassData; | ||
7 | +use LibModels\Wap\Category\BrandData; | ||
8 | +use Plugin\DataProcess\ListProcess; | ||
9 | +use Plugin\Helpers; | ||
10 | +use Plugin\Cache; | ||
11 | + | ||
12 | +/** | ||
13 | + * 商品列表相关的模板数据模型 | ||
14 | + * | ||
15 | + * @name ListModel | ||
16 | + * @package models/Product | ||
17 | + * @copyright yoho.inc | ||
18 | + * @version 1.0 (2015-10-27 16:27:54) | ||
19 | + * @author fei.hong <fei.hong@yoho.cn> | ||
20 | + */ | ||
21 | +class ListModel | ||
22 | +{ | ||
23 | + | ||
24 | + /** | ||
25 | + * 获取品类商品列表数据 | ||
26 | + * | ||
27 | + * @param array $condition 条件 | ||
28 | + * @return array | false | ||
29 | + */ | ||
30 | + public static function getClassData($condition) | ||
31 | + { | ||
32 | + $result = array(); | ||
33 | + | ||
34 | + if (USE_CACHE) { | ||
35 | + $key = CacheConfig::KEY_ACTION_PRODUCT_INDEX; | ||
36 | + if (!empty($condition)) { | ||
37 | + $key .= http_build_query($condition, null, '&'); | ||
38 | + } | ||
39 | + // 先尝试获取一级缓存(master), 有数据则直接返回. | ||
40 | + $result = Cache::get($key, 'master'); | ||
41 | + if (!empty($result)) { | ||
42 | + return $result; | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | + // 调用接口查询数据 | ||
47 | + $listData = ClassData::filterClassData($condition); | ||
48 | + // 处理返回的数据 | ||
49 | + if (isset($listData['code']) && $listData['code'] === 200) { | ||
50 | + $result = ListProcess::getListData($listData['data']); | ||
51 | + } | ||
52 | + | ||
53 | + if (USE_CACHE) { | ||
54 | + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | ||
55 | + if (empty($result)) { | ||
56 | + $result = Cache::get($key, 'slave'); | ||
57 | + } | ||
58 | + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | ||
59 | + else { | ||
60 | + Cache::set($key, $result, 600); // 缓存10分钟 | ||
61 | + } | ||
62 | + } | ||
63 | + | ||
64 | + return $result; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * 获取品牌商品列表数据 | ||
69 | + * | ||
70 | + * @return array | ||
71 | + */ | ||
72 | + public static function getBrandData($condition, $id, $uid, &$title) | ||
73 | + { | ||
74 | + $result = array(); | ||
75 | + | ||
76 | + // 获取品牌介绍信息, 有缓存1小时 | ||
77 | + $introData = BrandData::getBrandIntro($id, $uid); | ||
78 | + if (isset($introData['data']['brand_intro'])) { | ||
79 | + $result['brandHome']['id'] = $id; | ||
80 | + $result['brandHome']['intro'] = $introData['data']['brand_intro']; | ||
81 | + // 顶部导航的标题 | ||
82 | + $title = isset($introData['data']['brand_name']) ? $introData['data']['brand_name'] : ''; | ||
83 | + } | ||
84 | + | ||
85 | + // 获取品牌banner的数据, 有缓存1小时 | ||
86 | + $bannerData = BrandData::getBrandBanner($id); | ||
87 | + if (isset($bannerData['data']['banner'])) { | ||
88 | + $result['brandHome']['banner'] = Helpers::getImageUrl($bannerData['data']['banner'], 640, 75); | ||
89 | + } | ||
90 | + | ||
91 | + if (USE_CACHE) { | ||
92 | + $key = CacheConfig::KEY_ACTION_PRODUCT_BRAND; | ||
93 | + if (!empty($condition)) { | ||
94 | + $key .= http_build_query($condition, null, '&'); | ||
95 | + } | ||
96 | + // 先尝试获取一级缓存(master), 有数据则直接返回. | ||
97 | + $result['goodList'] = Cache::get($key, 'master'); | ||
98 | + if (!empty($result['goodList'])) { | ||
99 | + return $result; | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | + // 调用接口查询数据 | ||
104 | + $listData = BrandData::filterBrandData($condition); | ||
105 | + // 处理返回的数据 | ||
106 | + if (isset($listData['code']) && $listData['code'] === 200) { | ||
107 | + $result['goodList'] = ListProcess::getListData($listData['data']); | ||
108 | + } | ||
109 | + | ||
110 | + if (USE_CACHE) { | ||
111 | + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | ||
112 | + if (empty($result['goodList'])) { | ||
113 | + $result['goodList'] = Cache::get($key, 'slave'); | ||
114 | + } | ||
115 | + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | ||
116 | + else { | ||
117 | + Cache::set($key, $result['goodList'], 600); // 缓存10分钟 | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | + return $result; | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * 获取所有的品牌名称列表 | ||
126 | + * | ||
127 | + * @return array( | ||
128 | + * 品牌ID => 品牌命名(domain) | ||
129 | + * ) | ||
130 | + */ | ||
131 | + public static function getAllBrandDomains() | ||
132 | + { | ||
133 | + $result = array(); | ||
134 | + | ||
135 | + if (USE_CACHE) { | ||
136 | + $key = CacheConfig::KEY_ACTION_PRODUCT_BRAND_ALLNAMES; | ||
137 | + // 先尝试获取一级缓存(master), 有数据则直接返回. | ||
138 | + $result = Cache::get($key, 'master'); | ||
139 | + if (!empty($result)) { | ||
140 | + return $result; | ||
141 | + } | ||
142 | + } | ||
143 | + | ||
144 | + $brand = BrandData::getBrandsData(null); | ||
145 | + /* 按字母'A-Z'分组的品牌列表 */ | ||
146 | + if (!empty($brand['data']['brands'])) { | ||
147 | + foreach ($brand['data']['brands'] as $value) { | ||
148 | + foreach ($value as $row) { | ||
149 | + $result[ $row['id'] ] = $row['brand_domain'] ; | ||
150 | + } | ||
151 | + } | ||
152 | + } | ||
153 | + // 更多关联的品牌 | ||
154 | + if (!empty($brand['data']['morebrands'])) { | ||
155 | + foreach ($brand['data']['morebrands'] as $row) { | ||
156 | + $result[ $row['id'] ] = $row['brand_domain']; | ||
157 | + } | ||
158 | + } | ||
159 | + $brand = array(); | ||
160 | + | ||
161 | + if (USE_CACHE) { | ||
162 | + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | ||
163 | + if (empty($result)) { | ||
164 | + $result = Cache::get($key, 'slave'); | ||
165 | + } | ||
166 | + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | ||
167 | + else { | ||
168 | + Cache::set($key, $result, 600); // 缓存10分钟 | ||
169 | + } | ||
170 | + } | ||
171 | + | ||
172 | + return $result; | ||
173 | + } | ||
174 | + | ||
175 | +} |
@@ -19,11 +19,12 @@ class ClassController extends AbstractAction | @@ -19,11 +19,12 @@ class ClassController extends AbstractAction | ||
19 | 'navTitle' => '商品分类' | 19 | 'navTitle' => '商品分类' |
20 | ), | 20 | ), |
21 | 'category' => array( | 21 | 'category' => array( |
22 | - "class" => $classes | 22 | + 'class' => $classes |
23 | ) | 23 | ) |
24 | ); | 24 | ); |
25 | 25 | ||
26 | - $this->_view->assign('title', 'YOHO!有货'); | 26 | + $this->setTitle('商品分类'); |
27 | + | ||
27 | $this->_view->display('index', $data); | 28 | $this->_view->display('index', $data); |
28 | } | 29 | } |
29 | } | 30 | } |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | +use LibModels\Wap\Guang\ListData; | ||
5 | +use Plugin\Helpers; | ||
6 | + | ||
7 | +/** | ||
8 | + * 逛首页、列表页、编辑页 | ||
9 | + */ | ||
10 | +class IndexController extends AbstractAction | ||
11 | +{ | ||
12 | + | ||
13 | + /** | ||
14 | + * 首页 | ||
15 | + * | ||
16 | + * @param int id 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士 | ||
17 | + * @param string gender '1,3'表示男,'2,3'表示女, 默认为所有 | ||
18 | + */ | ||
19 | + public function indexAction() | ||
20 | + { | ||
21 | + $this->setTitle('逛'); | ||
22 | + $this->setNavHeader('逛', true, SITE_MAIN); | ||
23 | + | ||
24 | + $uid = $this->getUid(); | ||
25 | + $udid = $this->getUdid(); | ||
26 | + $type = $this->get('id', 0); | ||
27 | + $gender = $this->get('gender'); | ||
28 | + | ||
29 | + $this->_view->display('index', Guang\IndexModel::getArticleGroup($gender, $type, $uid, $udid)); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * 列表页 | ||
34 | + * | ||
35 | + * @param string tag 标签名称 | ||
36 | + * @param int yh_channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活 | ||
37 | + */ | ||
38 | + public function tagAction() | ||
39 | + { | ||
40 | + $uid = $this->getUid(); | ||
41 | + $udid = $this->getUdid(); | ||
42 | + $tag = $this->get('query'); | ||
43 | + $channel = $this->get('yh_channel'); | ||
44 | + | ||
45 | + // 标签聚合内容列表 | ||
46 | + $article = ListData::article('', 0, $uid, $udid, 1, $tag); | ||
47 | + // 标签聚合内容不存在, 跳到错误页面 | ||
48 | + if (empty($article['data']['list']['artList'])) { | ||
49 | + $this->error(); | ||
50 | + } | ||
51 | + // 标识是不是APP客户端 | ||
52 | + $isApp = isset($channel); | ||
53 | + | ||
54 | + $this->setTitle($tag); | ||
55 | + if (!$isApp) { | ||
56 | + $this->setNavHeader($tag, true, SITE_MAIN); | ||
57 | + } | ||
58 | + | ||
59 | + $data = array(); | ||
60 | + // 模板中使用JS的标识 | ||
61 | + $data['guangList'] = true; | ||
62 | + | ||
63 | + // 构建资讯文章内容 | ||
64 | + $build = array(); | ||
65 | + foreach ($article['data']['list']['artList'] as $article) { | ||
66 | + $build[] = Helpers::formatArticle($article, true, $isApp); | ||
67 | + } | ||
68 | + $data['guang']['infos'] = $build; | ||
69 | + | ||
70 | + // 分页需要的参数 | ||
71 | + $data['guang']['tag'] = $tag; | ||
72 | + | ||
73 | + $this->_view->display('list', $data); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 编辑页 | ||
78 | + * | ||
79 | + * @param int id 作者ID | ||
80 | + * @param int yh_channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活 | ||
81 | + */ | ||
82 | + public function editorAction() | ||
83 | + { | ||
84 | + $id = $this->get('id'); | ||
85 | + $channel = $this->get('yh_channel'); | ||
86 | + | ||
87 | + // 获取作者信息 | ||
88 | + $author = ListData::author($id); | ||
89 | + // 作者信息不存在,则跳到错误页面 | ||
90 | + if (!isset($author['name'])) { | ||
91 | + $this->error(); | ||
92 | + } | ||
93 | + // 标识是不是APP客户端 | ||
94 | + $isApp = isset($channel); | ||
95 | + | ||
96 | + $this->setTitle('编辑简介'); | ||
97 | + if (!$isApp) { | ||
98 | + $this->setNavHeader('编辑简介', true, SITE_MAIN); | ||
99 | + } | ||
100 | + | ||
101 | + $uid = $this->getUid(); | ||
102 | + $udid = $this->getUdid(); | ||
103 | + | ||
104 | + $data = array(); | ||
105 | + // 模板中使用JS的标识 | ||
106 | + $data['guangList'] = true; | ||
107 | + | ||
108 | + // 作者信息 | ||
109 | + $data['author'] = array(); | ||
110 | + $data['author']['avatar'] = Helpers::getImageUrl($author['avatar'], 100, 100); | ||
111 | + $data['author']['name'] = $author['name']; | ||
112 | + $data['author']['info'] = $author['author_desc']; | ||
113 | + $data['author']['id'] = $id; | ||
114 | + | ||
115 | + // 标签聚合内容列表 | ||
116 | + $article = ListData::article('', 0, $uid, $udid, 1, null, $id); | ||
117 | + // 构建资讯文章内容 | ||
118 | + if (!empty($article['data']['list']['artList'])) { | ||
119 | + $build = array(); | ||
120 | + foreach ($article['data']['list']['artList'] as $article) { | ||
121 | + $build[] = Helpers::formatArticle($article, true, false, false); | ||
122 | + } | ||
123 | + $data['guang']['infos'] = $build; | ||
124 | + } | ||
125 | + | ||
126 | + $this->_view->display('list', $data); | ||
127 | + } | ||
128 | + | ||
129 | + /** | ||
130 | + * 逛列表页面的资讯分页 | ||
131 | + * | ||
132 | + * 逛首页、标签页、编辑页资讯列表 | ||
133 | + * | ||
134 | + * @param string tag 标签名称, 没有传空或不传 | ||
135 | + * @param int type 逛首页的分类ID | ||
136 | + * @param int page 分页的页码 | ||
137 | + * @param string gender "1,2,3"表示所有, "1,3"表示男, "2,3"表示女 | ||
138 | + * @param int authorId 作者ID | ||
139 | + * @return html | ||
140 | + */ | ||
141 | + public function pageAction() | ||
142 | + { | ||
143 | + do { | ||
144 | + /* 判断是不是AJAX请求 */ | ||
145 | + if (!$this->isAjax()) { | ||
146 | + break; | ||
147 | + } | ||
148 | + | ||
149 | + /* 判断参数是否有效 */ | ||
150 | + $tag = $this->get('tag'); | ||
151 | + $sortId = $this->get('type', 0); | ||
152 | + $page = $this->get('page'); | ||
153 | + $gender = $this->get('gender'); | ||
154 | + $authorId = $this->get('authorId'); | ||
155 | + $showAuthor = true; | ||
156 | + if (!empty($sortId) && !is_numeric($sortId)) { | ||
157 | + break; | ||
158 | + } | ||
159 | + if (!empty($page) && !is_numeric($page)) { | ||
160 | + break; | ||
161 | + } | ||
162 | + if (!empty($authorId) && is_numeric($authorId)) { | ||
163 | + $showAuthor = false; | ||
164 | + } | ||
165 | + | ||
166 | + /* 获取资讯文章列表 */ | ||
167 | + $uid = $this->getUid(); | ||
168 | + $udid = $this->getUdid(); | ||
169 | + $page = intval($page) + 1; | ||
170 | + $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId); | ||
171 | + if (empty($article['data']['list']['artList'])) { | ||
172 | + break; | ||
173 | + } | ||
174 | + | ||
175 | + /* 构建资讯文章内容 */ | ||
176 | + $data = array(); | ||
177 | + $build = array(); | ||
178 | + foreach ($article['data']['list']['artList'] as $article) { | ||
179 | + $build[] = Helpers::formatArticle($article, true, false, $showAuthor); | ||
180 | + } | ||
181 | + $data['infos'] = $build; | ||
182 | + | ||
183 | + $this->_view->display('page', $data); | ||
184 | + | ||
185 | + exit(); | ||
186 | + | ||
187 | + } while (false); | ||
188 | + | ||
189 | + echo ' '; | ||
190 | + } | ||
191 | + | ||
192 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | +use LibModels\Wap\Guang\DetailData; | ||
5 | +use LibModels\Wap\Product\ListData; | ||
6 | +use Plugin\Helpers; | ||
7 | + | ||
8 | +/** | ||
9 | + * 逛详情页 | ||
10 | + */ | ||
11 | +class InfoController extends AbstractAction | ||
12 | +{ | ||
13 | + | ||
14 | + /** | ||
15 | + * 详情页 | ||
16 | + * | ||
17 | + * @param int id 内容ID | ||
18 | + */ | ||
19 | + public function indexAction() | ||
20 | + { | ||
21 | + $id = $this->get('id'); | ||
22 | + | ||
23 | + // 判断参数是否有效, 无效会跳转到错误页面 | ||
24 | + if (!is_numeric($id)) { | ||
25 | + $this->error(); | ||
26 | + } | ||
27 | + | ||
28 | + // 获取详情内容信息, 异常则跳到错误页面 | ||
29 | + $detail = DetailData::package($id); | ||
30 | + if (empty($detail['getArticle'])) { | ||
31 | + $this->error(); | ||
32 | + } | ||
33 | + | ||
34 | + $data = array(); | ||
35 | + $data['guangDetail'] = true; // 模板中使用JS的标识 | ||
36 | + $data['guang']['id'] = $id; | ||
37 | + | ||
38 | + // 作者信息数据 | ||
39 | + if (isset($detail['getAuthor']['name'])) { | ||
40 | + $data['guang']['author'] = array(); | ||
41 | + $data['guang']['author']['avatar'] = $detail['getAuthor']['avatar']; | ||
42 | + $data['guang']['author']['name'] = $detail['getAuthor']['name']; | ||
43 | + $data['guang']['author']['intro'] = $detail['getAuthor']['author_desc']; | ||
44 | + $data['guang']['author']['url'] = '/author/index?id=' . $detail['getArticle']['author_id']; | ||
45 | + } | ||
46 | + | ||
47 | + $data['detail'] = array(); | ||
48 | + $data['detail']['title'] = $detail['getArticle']['article_title']; | ||
49 | + $data['detail']['publishTime'] = $detail['getArticle']['publishTime']; | ||
50 | + $data['detail']['pageView'] = $detail['getArticle']['pageViews']; | ||
51 | + $data['detail']['content'] = array(); | ||
52 | + | ||
53 | + if (!empty($detail['getArticleContent'])) { | ||
54 | + $build = array(); | ||
55 | + $good = array(); | ||
56 | + $skns = array(); | ||
57 | + $product = array(); | ||
58 | + foreach ($detail['getArticleContent'] as $value) { | ||
59 | + $build = array(); | ||
60 | + // 文字 | ||
61 | + if (isset($value['text'])) { | ||
62 | + $build['text'] = $value['text']['data']['text']; | ||
63 | + $data['detail']['content'][] = $build; | ||
64 | + } | ||
65 | + // 单张图 | ||
66 | + elseif (isset($value['singleImage'])) { | ||
67 | + $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640); | ||
68 | + $data['detail']['content'][] = $build; | ||
69 | + } | ||
70 | + // 相关推荐 | ||
71 | + elseif (isset($value['goods']['data'])) { | ||
72 | + $good = array(); | ||
73 | + // 遍历取得SKN | ||
74 | + $skns = array(); | ||
75 | + foreach ($value['goods']['data'] as $goods) { | ||
76 | + $skns[] = $goods['id']; | ||
77 | + } | ||
78 | + // 通过SKN获取商品信息 | ||
79 | + $product = ListData::productInfoBySkns($skns); | ||
80 | + if (!empty($product['data']['product_list'])) { | ||
81 | + foreach ($product['data']['product_list'] as $i => $goods) { | ||
82 | + // 最多显示4个 | ||
83 | + if ($i > 3) { | ||
84 | + break; | ||
85 | + } | ||
86 | + $good[] = Helpers::formatProduct($goods, false); | ||
87 | + } | ||
88 | + } | ||
89 | + // 没有商品 | ||
90 | + if (!isset($i)) { | ||
91 | + continue; | ||
92 | + } | ||
93 | + // 单个商品 | ||
94 | + elseif ($i === 0) { | ||
95 | + $build['relatedReco'] = $good[0]; | ||
96 | + } | ||
97 | + // 多个商品 | ||
98 | + else { | ||
99 | + $build['relatedReco'] = $good; | ||
100 | + } | ||
101 | + } | ||
102 | + // 悬停浮动商品 | ||
103 | + elseif (isset($value['goodsGroup']['data'])) { | ||
104 | + foreach ($value['goodsGroup']['data'] as $goods) { | ||
105 | + $good = array(); | ||
106 | + $good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314); | ||
107 | + $good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']); | ||
108 | + $good['goods'] = array(); | ||
109 | + $skns = array(); | ||
110 | + foreach ($goods['list'] as $mini) { | ||
111 | + $skns[] = $mini['id']; | ||
112 | + } | ||
113 | + // 通过SKN获取商品信息 | ||
114 | + $product = ListData::productInfoBySkns($skns); | ||
115 | + if (!empty($product['data']['product_list'])) { | ||
116 | + foreach ($product['data']['product_list'] as $i => $goods) { | ||
117 | + $good['goods'][] = Helpers::formatProduct($goods, false); | ||
118 | + } | ||
119 | + $build['collocation'][] = $good; | ||
120 | + } | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + $data['detail']['content'][] = $build; | ||
125 | + } | ||
126 | + } | ||
127 | + | ||
128 | + // 相关品牌 | ||
129 | + if (!empty($detail['getBrand'])) { | ||
130 | + $data['relatedBrand'] = $detail['getBrand']; | ||
131 | + } | ||
132 | + | ||
133 | + // 相关标签 | ||
134 | + if (!empty($detail['getArticle']['tags'])) { | ||
135 | + foreach ($detail['getArticle']['tags'] as $value) { | ||
136 | + $value['url'] = '/tags/index?query=' . $value['name']; | ||
137 | + $data['relatedTag'][] = $value; | ||
138 | + } | ||
139 | + } | ||
140 | + | ||
141 | + // 相关文章 | ||
142 | + if (!empty($detail['getOtherArticle'])) { | ||
143 | + foreach ($detail['getOtherArticle'] as $value) { | ||
144 | + $value['url'] = '/info/index?id=' . $value['id']; | ||
145 | + $data['relatedInfo'][] = $value; | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + $this->_view->display('index', $data); | ||
150 | + | ||
151 | + $detail = array(); | ||
152 | + $data = array(); | ||
153 | + } | ||
154 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | +use LibModels\Wap\Category\BrandData; | ||
5 | +use LibModels\Wap\Category\ClassData; | ||
6 | +use Plugin\DataProcess\ListProcess; | ||
7 | +use Plugin\Helpers; | ||
8 | + | ||
9 | +/** | ||
10 | + * 商品列表相关的控制器 | ||
11 | + * | ||
12 | + */ | ||
13 | +class IndexController extends AbstractAction | ||
14 | +{ | ||
15 | + | ||
16 | + /** | ||
17 | + * 品类商品列表页 | ||
18 | + * | ||
19 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
20 | + * @param integer $brand 品牌Id | ||
21 | + * @param integer $sort 品类查询sort参数 | ||
22 | + * @param integer $color 颜色Id | ||
23 | + * @param integer $size 尺码Id | ||
24 | + * @param string $price 价格 | ||
25 | + * @param string $p_d 折扣 | ||
26 | + */ | ||
27 | + public function indexAction() | ||
28 | + { | ||
29 | + // 过滤请求参数 | ||
30 | + $condition = filter_input_array(INPUT_GET, array( | ||
31 | + 'brand' => FILTER_VALIDATE_INT, | ||
32 | + 'sort' => FILTER_VALIDATE_INT, | ||
33 | + 'msort' => FILTER_VALIDATE_INT, | ||
34 | + 'misort' => FILTER_VALIDATE_INT, | ||
35 | + 'color' => FILTER_VALIDATE_INT, | ||
36 | + 'size' => FILTER_VALIDATE_INT, | ||
37 | + 'price' => FILTER_VALIDATE_INT, | ||
38 | + 'discount' => FILTER_VALIDATE_INT, | ||
39 | + 'gender' => FILTER_DEFAULT, | ||
40 | + 'p_d' => FILTER_DEFAULT,), false); | ||
41 | + | ||
42 | + // 性别参数,不传则从COOKIE获取 | ||
43 | + if (!isset($condition['gender'])) { | ||
44 | + $condition['gender'] = Helpers::getGenderByCookie(); | ||
45 | + } | ||
46 | + | ||
47 | + // 品类名称参数, 不传则默认为全部 | ||
48 | + $name = $this->get('sort_name'); | ||
49 | + if (empty($name)) { | ||
50 | + $name = $this->get('title', '全部'); | ||
51 | + } | ||
52 | + $this->setTitle($name); | ||
53 | + $this->setNavHeader($name, true, SITE_MAIN); | ||
54 | + | ||
55 | + $goodList = Product\ListModel::getClassData($condition); | ||
56 | + if (!empty($condition)) { | ||
57 | + $goodList = array_merge($goodList, $condition); | ||
58 | + } | ||
59 | + $this->_view->display('index', array( | ||
60 | + 'goodListPage' => true, | ||
61 | + 'goodList' => $goodList, | ||
62 | + )); | ||
63 | + } | ||
64 | + | ||
65 | + /** | ||
66 | + * 品牌商品列表页 | ||
67 | + * | ||
68 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
69 | + * @param integer $sort 品类查询sort参数 | ||
70 | + * @param integer $color 颜色Id | ||
71 | + * @param integer $size 尺码Id | ||
72 | + * @param string $price 价格 | ||
73 | + * @param string $p_d 折扣 | ||
74 | + */ | ||
75 | + public function brandAction() | ||
76 | + { | ||
77 | + /* 品牌域名参数 @see Bootstrap.php */ | ||
78 | + $domain = $this->param('named'); | ||
79 | + if (empty($domain)) { | ||
80 | + $this->error(); | ||
81 | + } | ||
82 | + | ||
83 | + /* 通过品牌域名找到对应的品牌ID */ | ||
84 | + $domainList = Product\ListModel::getAllBrandDomains(); | ||
85 | + $brandIds = array_keys($domainList, $domain); | ||
86 | + if (!isset($brandIds[0])) { | ||
87 | + $this->error(); | ||
88 | + } | ||
89 | + // 当前的登录用户UID | ||
90 | + $uid = $this->getUid(); | ||
91 | + | ||
92 | + /* 过滤请求参数 */ | ||
93 | + $condition = filter_input_array(INPUT_GET, array( | ||
94 | + 'sort' => FILTER_VALIDATE_INT, | ||
95 | + 'msort' => FILTER_VALIDATE_INT, | ||
96 | + 'misort' => FILTER_VALIDATE_INT, | ||
97 | + 'color' => FILTER_VALIDATE_INT, | ||
98 | + 'size' => FILTER_VALIDATE_INT, | ||
99 | + 'price' => FILTER_VALIDATE_INT, | ||
100 | + 'discount' => FILTER_VALIDATE_INT, | ||
101 | + 'gender' => FILTER_DEFAULT, | ||
102 | + 'p_d' => FILTER_DEFAULT,), false); | ||
103 | + $condition['brand'] = $brandIds[0]; | ||
104 | + | ||
105 | + // 存标题信息 | ||
106 | + $title = ''; | ||
107 | + | ||
108 | + $data = Product\ListModel::getBrandData($condition, $brandIds[0], $uid, $title); | ||
109 | + if (!empty($condition)) { | ||
110 | + $data = array_merge($data, $condition); | ||
111 | + } | ||
112 | + $data['goodListPage'] = true; | ||
113 | + | ||
114 | + $this->setTitle($title); | ||
115 | + $this->setNavHeader($title, true, SITE_MAIN); | ||
116 | + | ||
117 | + $this->_view->display('index', $data); | ||
118 | + } | ||
119 | + | ||
120 | +} |
1 | +; 标签聚合列表 | ||
2 | +routes.tag.type = "rewrite" | ||
3 | +routes.tag.match = "/tags/index" | ||
4 | +routes.tag.route.module = Guang | ||
5 | +routes.tag.route.controller = Index | ||
6 | +routes.tag.route.action = Tag | ||
7 | + | ||
8 | +; 作者聚合列表 | ||
9 | +routes.author.type = "rewrite" | ||
10 | +routes.author.match = "/author/index" | ||
11 | +routes.author.route.module = Guang | ||
12 | +routes.author.route.controller = Index | ||
13 | +routes.author.route.action = Editor | ||
14 | + |
1 | +; 默认页 | ||
2 | +routes.index.type = "rewrite" | ||
3 | +routes.index.match = "/index.html" | ||
4 | +routes.index.route.module = Index | ||
5 | +routes.index.route.controller = Index | ||
6 | +routes.index.route.action = Index | ||
7 | + | ||
8 | +; 错误页 | ||
9 | +routes.error.type = "rewrite" | ||
10 | +routes.error.match = "/error.html" | ||
11 | +routes.error.route.module = Index | ||
12 | +routes.error.route.controller = Error | ||
13 | +routes.error.route.action = Index | ||
14 | + | ||
15 | +; 搜索页 | ||
16 | +routes.reg.type = "rewrite" | ||
17 | +routes.reg.match = "/search.html" | ||
18 | +routes.reg.route.module = Index | ||
19 | +routes.reg.route.controller = Search | ||
20 | +routes.reg.route.action = Index | ||
21 | + | ||
22 | +; 注册页 | ||
23 | +routes.reg.type = "rewrite" | ||
24 | +routes.reg.match = "/reg.html" | ||
25 | +routes.reg.route.module = Passport | ||
26 | +routes.reg.route.controller = Reg | ||
27 | +routes.reg.route.action = Index | ||
28 | + | ||
29 | +; 登录页 | ||
30 | +routes.login.type = "rewrite" | ||
31 | +routes.login.match = "/signin.html" | ||
32 | +routes.login.route.module = Passport | ||
33 | +routes.login.route.controller = Login | ||
34 | +routes.login.route.action = Index | ||
35 | + | ||
36 | +; 登录页(国际账号) | ||
37 | +routes.interational.type = "rewrite" | ||
38 | +routes.interational.match = "/login.html" | ||
39 | +routes.interational.route.module = Passport | ||
40 | +routes.interational.route.controller = Login | ||
41 | +routes.interational.route.action = International | ||
42 | + | ||
43 | +; 找回密码(手机号) | ||
44 | +routes.phoneback.type = "rewrite" | ||
45 | +routes.phoneback.match = "/phoneback.html" | ||
46 | +routes.phoneback.route.module = Passport | ||
47 | +routes.phoneback.route.controller = Back | ||
48 | +routes.phoneback.route.action = Mobile | ||
49 | + | ||
50 | +; 找回密码(邮箱) | ||
51 | +routes.emailback.type = "rewrite" | ||
52 | +routes.emailback.match = "/emailback.html" | ||
53 | +routes.emailback.route.module = Passport | ||
54 | +routes.emailback.route.controller = Back | ||
55 | +routes.emailback.route.action = Email | ||
56 | + | ||
57 | +; 所有品类 | ||
58 | +routes.reg.type = "rewrite" | ||
59 | +routes.reg.match = "/cate" | ||
60 | +routes.reg.route.module = Category | ||
61 | +routes.reg.route.controller = Class | ||
62 | +routes.reg.route.action = Index | ||
63 | + | ||
64 | + |
@@ -4,6 +4,7 @@ use Yaf\Application; | @@ -4,6 +4,7 @@ use Yaf\Application; | ||
4 | define('SITE_MAIN', 'http://m.dev.yohobuy.com'); // 网站主域名 | 4 | define('SITE_MAIN', 'http://m.dev.yohobuy.com'); // 网站主域名 |
5 | define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 | 5 | define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 |
6 | define('COOKIE_DOMAIN', '.m.dev.yohobuy.com'); // COOKIE作用域 | 6 | define('COOKIE_DOMAIN', '.m.dev.yohobuy.com'); // COOKIE作用域 |
7 | +define('SUB_DOMAIN', '.dev.yohobuy.com'); // 子域名后缀 | ||
7 | define('USE_CACHE', false); // 缓存的开关 | 8 | define('USE_CACHE', false); // 缓存的开关 |
8 | define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 | 9 | define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 |
9 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 | 10 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 |
@@ -4,6 +4,7 @@ use Yaf\Application; | @@ -4,6 +4,7 @@ use Yaf\Application; | ||
4 | define('SITE_MAIN', 'http://buy.test.yoho.cn'); // 网站主域名 | 4 | define('SITE_MAIN', 'http://buy.test.yoho.cn'); // 网站主域名 |
5 | define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 | 5 | define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 |
6 | define('COOKIE_DOMAIN', '.test.yoho.cn'); // COOKIE作用域 | 6 | define('COOKIE_DOMAIN', '.test.yoho.cn'); // COOKIE作用域 |
7 | +define('SUB_DOMAIN', '.test.yoho.cn'); // 子域名后缀 | ||
7 | define('USE_CACHE', false); // 缓存的开关 | 8 | define('USE_CACHE', false); // 缓存的开关 |
8 | define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 | 9 | define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 |
9 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 | 10 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 |
@@ -4,6 +4,7 @@ use Yaf\Application; | @@ -4,6 +4,7 @@ use Yaf\Application; | ||
4 | define('SITE_MAIN', 'http://mtesth5.yohobuy.com'); // 网站主域名 | 4 | define('SITE_MAIN', 'http://mtesth5.yohobuy.com'); // 网站主域名 |
5 | define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 | 5 | define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 |
6 | define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域 | 6 | define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域 |
7 | +define('SUB_DOMAIN', '.m.yohobuy.com'); // 子域名后缀 | ||
7 | define('USE_CACHE', true); // 缓存的开关 | 8 | define('USE_CACHE', true); // 缓存的开关 |
8 | define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 | 9 | define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 |
9 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 | 10 | define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 |
-
Please register or login to post a comment