Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Conflicts: library/LibModels/Wap/Product/SearchData.php library/Plugin/Helpers.php
Showing
17 changed files
with
235 additions
and
97 deletions
framework @ 75bbc3b0
@@ -17,16 +17,16 @@ use Plugin\Cache; | @@ -17,16 +17,16 @@ use Plugin\Cache; | ||
17 | class Yohobuy | 17 | class Yohobuy |
18 | { | 18 | { |
19 | 19 | ||
20 | -// /* 正式环境 */ | ||
21 | -// const API_URL = 'http://api2.open.yohobuy.com/'; | ||
22 | -// const SERVICE_URL = 'http://service.api.yohobuy.com/'; | ||
23 | -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
24 | - | ||
25 | - /* 测试环境 */ | ||
26 | - const API_URL = 'http://test2.open.yohobuy.com/'; | ||
27 | - const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; | 20 | + /* 正式环境 */ |
21 | + const API_URL = 'http://api2.open.yohobuy.com/'; | ||
22 | + const SERVICE_URL = 'http://service.api.yohobuy.com/'; | ||
28 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 23 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
29 | 24 | ||
25 | +// /* 测试环境 */ | ||
26 | +// const API_URL = 'http://test2.open.yohobuy.com/'; | ||
27 | +// const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; | ||
28 | +// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
29 | + | ||
30 | /** | 30 | /** |
31 | * 私钥列表 | 31 | * 私钥列表 |
32 | * | 32 | * |
@@ -16,7 +16,8 @@ use Api\Sign; | @@ -16,7 +16,8 @@ use Api\Sign; | ||
16 | */ | 16 | */ |
17 | class SearchData | 17 | class SearchData |
18 | { | 18 | { |
19 | - protected static $_searchurl = 'http://101.200.31.165/yohosearch/search.json'; | 19 | + |
20 | + protected static $_searchurl = 'http://101.200.31.165/yohosearch/search.json'; | ||
20 | 21 | ||
21 | /** | 22 | /** |
22 | * 模糊搜索提供的关键词 | 23 | * 模糊搜索提供的关键词 |
@@ -60,8 +61,25 @@ class SearchData | @@ -60,8 +61,25 @@ class SearchData | ||
60 | */ | 61 | */ |
61 | public static function searchLiDatas($query = null, $brand = null, $gender = null, $color = null, $size = null, $price = null, $p_d = null, $sort = null, $order = 's_t_desc', $page = 1, $limit = 60, $channel = null) | 62 | public static function searchLiDatas($query = null, $brand = null, $gender = null, $color = null, $size = null, $price = null, $p_d = null, $sort = null, $order = 's_t_desc', $page = 1, $limit = 60, $channel = null) |
62 | { | 63 | { |
63 | - // 构建必传参数 | ||
64 | - $param = Yohobuy::param(); | 64 | + // 排序数据映射表 |
65 | + $order_map = array( | ||
66 | + 's_t_desc' => 'shelve_time:desc', | ||
67 | + 's_t_asc' => 'shelve_time:asc', | ||
68 | + 's_p_asc' => 'sales_price:asc', | ||
69 | + 's_p_desc' => 'sales_price:desc', | ||
70 | + 's_d_desc' => 'discount:desc', | ||
71 | + 's_d_asc' => 'discount:asc', | ||
72 | + 'skn_desc' => 'product_skn:desc', | ||
73 | + 'skn_asc' => 'product_skn:asc', | ||
74 | + 'activities_desc' => 'activities.order_by:desc', | ||
75 | + 'activities_asc' => 'activities.order_by:asc', | ||
76 | + 's_n_asc' => 'sales_num:asc', | ||
77 | + 's_n_desc' => 'sales_num:desc', | ||
78 | + 'activities_id_desc' => 'activities.activity_id:desc', | ||
79 | + 'activities_id_asc' => 'activities.activity_id:asc', | ||
80 | + ); | ||
81 | + | ||
82 | + $param = array(); | ||
65 | 83 | ||
66 | is_null($query) || $param['query'] = $query; | 84 | is_null($query) || $param['query'] = $query; |
67 | is_null($brand) || $param['brand'] = $brand; | 85 | is_null($brand) || $param['brand'] = $brand; |
@@ -71,14 +89,13 @@ class SearchData | @@ -71,14 +89,13 @@ class SearchData | ||
71 | is_null($price) || $param['price'] = $price; | 89 | is_null($price) || $param['price'] = $price; |
72 | is_null($p_d) || $param['p_d'] = $p_d; | 90 | is_null($p_d) || $param['p_d'] = $p_d; |
73 | is_null($sort) || $param['sort'] = $sort; | 91 | is_null($sort) || $param['sort'] = $sort; |
74 | - is_null($channel) || $param['channel'] = $channel; | ||
75 | - $param['method'] = 'app.search.li'; | ||
76 | - $param['order'] = $order; | 92 | + // is_null($channel) || $param['channel'] = $channel; |
93 | + $param['order'] = $order_map[$order]; | ||
77 | $param['page'] = $page; | 94 | $param['page'] = $page; |
78 | - $param['limit'] = $limit; | ||
79 | - $param['client_secret'] = Sign::getSign($param); | 95 | + $param['viewNum'] = $limit; // 每页记录数 |
96 | + $param['status'] = 1; // 是否上架,1表示在架,2表示不在 | ||
80 | 97 | ||
81 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 98 | + return Yohobuy::get(self::$_searchurl, $param); |
82 | } | 99 | } |
83 | 100 | ||
84 | /** | 101 | /** |
@@ -150,6 +150,10 @@ class FloorProcess | @@ -150,6 +150,10 @@ class FloorProcess | ||
150 | $build['textCn'] = $one['title']; | 150 | $build['textCn'] = $one['title']; |
151 | $result['hotCategory']['list'][] = $build; | 151 | $result['hotCategory']['list'][] = $build; |
152 | } | 152 | } |
153 | + | ||
154 | + if (isset($data['title']['more_url'])) { | ||
155 | + $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); | ||
156 | + } | ||
153 | 157 | ||
154 | return $result; | 158 | return $result; |
155 | } | 159 | } |
@@ -176,6 +180,10 @@ class FloorProcess | @@ -176,6 +180,10 @@ class FloorProcess | ||
176 | $data['is_show_name'] = $data['title']['is_show']; | 180 | $data['is_show_name'] = $data['title']['is_show']; |
177 | $data['name'] = $data['title']['title']; | 181 | $data['name'] = $data['title']['title']; |
178 | unset($data['title']); | 182 | unset($data['title']); |
183 | + | ||
184 | + if (isset($data['title']['more_url'])) { | ||
185 | + $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); | ||
186 | + } | ||
179 | 187 | ||
180 | $result['hotCategory'] = $data; | 188 | $result['hotCategory'] = $data; |
181 | 189 | ||
@@ -202,7 +210,7 @@ class FloorProcess | @@ -202,7 +210,7 @@ class FloorProcess | ||
202 | $one['img'] = Helpers::getImageUrl($one['src'], 158, 174); | 210 | $one['img'] = Helpers::getImageUrl($one['src'], 158, 174); |
203 | unset($one['src']); | 211 | unset($one['src']); |
204 | } | 212 | } |
205 | - $data['more'] = '/category/brand/index?channel=' . $type; | 213 | + $data['more'] = '/brands?channel=' . $type; |
206 | $result['hotBrands'] = $data; | 214 | $result['hotBrands'] = $data; |
207 | 215 | ||
208 | return $result; | 216 | return $result; |
@@ -220,7 +228,7 @@ class FloorProcess | @@ -220,7 +228,7 @@ class FloorProcess | ||
220 | 228 | ||
221 | foreach($data as $key=>&$value){ | 229 | foreach($data as $key=>&$value){ |
222 | if($key == 'title'){ | 230 | if($key == 'title'){ |
223 | - $value['more_url'] = self::$guangUrl.'?id=2&gender='.self::$channel[$type]; | 231 | + $value['more_url'] = Helpers::url('', array('id' => 2, 'gender' => self::$channel[$type]), 'guang'); |
224 | } | 232 | } |
225 | if($key == 'article'){ | 233 | if($key == 'article'){ |
226 | foreach($value as &$one){ | 234 | foreach($value as &$one){ |
@@ -258,7 +266,7 @@ class FloorProcess | @@ -258,7 +266,7 @@ class FloorProcess | ||
258 | 266 | ||
259 | foreach($data as $key=>&$value){ | 267 | foreach($data as $key=>&$value){ |
260 | if($key == 'title'){ | 268 | if($key == 'title'){ |
261 | - $value['more_url'] = self::$guangUrl.'?id=1&gender='.self::$channel[$type]; | 269 | + $value['more_url'] = Helpers::url('', array('id' => 1, 'gender' => self::$channel[$type]), 'guang'); |
262 | } | 270 | } |
263 | if($key == 'list'){ | 271 | if($key == 'list'){ |
264 | foreach ($value as &$one) { | 272 | foreach ($value as &$one) { |
@@ -307,6 +315,10 @@ class FloorProcess | @@ -307,6 +315,10 @@ class FloorProcess | ||
307 | 315 | ||
308 | unset($one['src']); | 316 | unset($one['src']); |
309 | } | 317 | } |
318 | + | ||
319 | + if (isset($data['title']['more_url'])) { | ||
320 | + $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); | ||
321 | + } | ||
310 | 322 | ||
311 | unset($data['big_image']); | 323 | unset($data['big_image']); |
312 | 324 | ||
@@ -343,6 +355,10 @@ class FloorProcess | @@ -343,6 +355,10 @@ class FloorProcess | ||
343 | $one['img'] = Helpers::getImageUrl($one['src'], 191, 191); | 355 | $one['img'] = Helpers::getImageUrl($one['src'], 191, 191); |
344 | unset($one['src']); | 356 | unset($one['src']); |
345 | } | 357 | } |
358 | + | ||
359 | + if (isset($data['title']['more_url'])) { | ||
360 | + $data['title']['more_url'] = Helpers::getFilterUrl($data['title']['more_url']); | ||
361 | + } | ||
346 | $result['creativeLife'] = $data; | 362 | $result['creativeLife'] = $data; |
347 | 363 | ||
348 | return $result; | 364 | return $result; |
@@ -21,7 +21,7 @@ class Helpers | @@ -21,7 +21,7 @@ class Helpers | ||
21 | public static function url($uri, $param, $module = 'index') | 21 | public static function url($uri, $param, $module = 'index') |
22 | { | 22 | { |
23 | $url = ''; | 23 | $url = ''; |
24 | - | 24 | + |
25 | switch ($module) { | 25 | switch ($module) { |
26 | case 'guang': // 逛 | 26 | case 'guang': // 逛 |
27 | $url = 'http://guang' . SUB_DOMAIN; | 27 | $url = 'http://guang' . SUB_DOMAIN; |
@@ -38,13 +38,14 @@ class Helpers | @@ -38,13 +38,14 @@ class Helpers | ||
38 | default: | 38 | default: |
39 | $url = 'http://' . $module . SUB_DOMAIN; | 39 | $url = 'http://' . $module . SUB_DOMAIN; |
40 | } | 40 | } |
41 | + $url .= $uri; | ||
41 | if (!empty($param)) { | 42 | if (!empty($param)) { |
42 | - $url .= $uri . '?' . http_build_query($param, null, '&'); | 43 | + $url .= '?' . http_build_query($param, null, '&'); |
43 | } | 44 | } |
44 | - | 45 | + |
45 | return $url; | 46 | return $url; |
46 | } | 47 | } |
47 | - | 48 | + |
48 | /** | 49 | /** |
49 | * 根据尺寸获得图片url | 50 | * 根据尺寸获得图片url |
50 | * @param string $url 路径 | 51 | * @param string $url 路径 |
@@ -66,14 +67,15 @@ class Helpers | @@ -66,14 +67,15 @@ class Helpers | ||
66 | */ | 67 | */ |
67 | public static function getFilterUrl($url) | 68 | public static function getFilterUrl($url) |
68 | { | 69 | { |
69 | - $filter = strtr(strstr($url, 'openby:yohobuy=', true), array('.m.yohobuy.com' => SUB_DOMAIN, OLD_MAIN => SITE_MAIN)); | 70 | + $url = strtr($url, array('.m.yohobuy.com' => SUB_DOMAIN, OLD_MAIN => SITE_MAIN)); |
71 | + $filter = strstr($url, 'openby:yohobuy=', true); | ||
70 | if ($filter) { | 72 | if ($filter) { |
71 | return rtrim(rtrim($filter, '?'), '&'); | 73 | return rtrim(rtrim($filter, '?'), '&'); |
72 | } else { | 74 | } else { |
73 | return $url; | 75 | return $url; |
74 | } | 76 | } |
75 | } | 77 | } |
76 | - | 78 | + |
77 | /** | 79 | /** |
78 | * 根据用户访问的COOKIE判断出性别 | 80 | * 根据用户访问的COOKIE判断出性别 |
79 | * | 81 | * |
@@ -91,8 +93,8 @@ class Helpers | @@ -91,8 +93,8 @@ class Helpers | ||
91 | return '1,2,3'; | 93 | return '1,2,3'; |
92 | } | 94 | } |
93 | } | 95 | } |
94 | - | ||
95 | - /** | 96 | + |
97 | + /** | ||
96 | * 根据用户访问的COOKIE判断出频道 | 98 | * 根据用户访问的COOKIE判断出频道 |
97 | * | 99 | * |
98 | * @return int | 100 | * @return int |
@@ -125,8 +127,9 @@ class Helpers | @@ -125,8 +127,9 @@ class Helpers | ||
125 | */ | 127 | */ |
126 | public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true) | 128 | public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true) |
127 | { | 129 | { |
130 | + | ||
128 | // 商品信息有问题,则不显示 | 131 | // 商品信息有问题,则不显示 |
129 | - if (!isset($productData['product_skn'])) { | 132 | + if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) { |
130 | return false; | 133 | return false; |
131 | } | 134 | } |
132 | 135 | ||
@@ -135,24 +138,22 @@ class Helpers | @@ -135,24 +138,22 @@ class Helpers | ||
135 | $productData['market_price'] = false; | 138 | $productData['market_price'] = false; |
136 | } | 139 | } |
137 | 140 | ||
141 | + // 如果$productData['default_images']为空,就取$productData['goods_list']中第一个,为空就不处理 | ||
142 | + if (empty($productData['default_images'])) { | ||
143 | + $productData['default_images'] = $productData['goods_list'][0]; | ||
144 | + } | ||
145 | + | ||
138 | $result = array(); | 146 | $result = array(); |
139 | $result['id'] = $productData['product_skn']; | 147 | $result['id'] = $productData['product_skn']; |
140 | $result['product_id'] = $productData['product_id']; | 148 | $result['product_id'] = $productData['product_id']; |
141 | - | ||
142 | - // 如果$productData['default_images']为null,就取$productData['goods_list']中第一个,为空就不处理 | ||
143 | - if(is_null($productData['default_images']) && count($productData['goods_list'])) | ||
144 | - { | ||
145 | - $productData['default_images'] = $productData['default_images'][0]; | ||
146 | - } | ||
147 | 149 | ||
148 | - // 如果是来自搜索页搜索出来的图片要先处理一下 | ||
149 | $result['thumb'] = Images::getImageUrl($productData['default_images'], 235, 314); | 150 | $result['thumb'] = Images::getImageUrl($productData['default_images'], 235, 314); |
150 | - | ||
151 | $result['name'] = $productData['product_name']; | 151 | $result['name'] = $productData['product_name']; |
152 | $result['price'] = $productData['market_price']; | 152 | $result['price'] = $productData['market_price']; |
153 | $result['salePrice'] = $productData['sales_price']; | 153 | $result['salePrice'] = $productData['sales_price']; |
154 | $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); | 154 | $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); |
155 | - $result['url'] = ''; // @todo | 155 | + $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_' . $productData['goods_list'][0]['goods_id'] |
156 | + . '/'. $productData['cn_alphabet'] . '.html'; | ||
156 | 157 | ||
157 | if ($showTags) { | 158 | if ($showTags) { |
158 | $result['tags'] = array(); | 159 | $result['tags'] = array(); |
@@ -188,7 +189,7 @@ class Helpers | @@ -188,7 +189,7 @@ class Helpers | ||
188 | $result['id'] = $articleData['id']; | 189 | $result['id'] = $articleData['id']; |
189 | $result['showTags'] = $showTag; | 190 | $result['showTags'] = $showTag; |
190 | $result['img'] = self::getImageUrl($articleData['src'], 640, 640); | 191 | $result['img'] = self::getImageUrl($articleData['src'], 640, 640); |
191 | - $result['url'] = $isApp && !empty($articleData['url']) ? $articleData['url'] : '/info/index?id=' . $articleData['id']; | 192 | + $result['url'] = $isApp && !empty($articleData['url']) ? $articleData['url'] : '/info/index?id=' . $articleData['id']; |
192 | $result['title'] = $articleData['title']; | 193 | $result['title'] = $articleData['title']; |
193 | $result['text'] = $articleData['intro']; | 194 | $result['text'] = $articleData['intro']; |
194 | $result['publishTime'] = $articleData['publish_time']; | 195 | $result['publishTime'] = $articleData['publish_time']; |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | + | ||
5 | +/** | ||
6 | + * 下载相关的控制器 | ||
7 | + * | ||
8 | + * @name DownloadController | ||
9 | + * @package | ||
10 | + * @copyright yoho.inc | ||
11 | + * @version 1.0 (2015-10-28 16:30:44) | ||
12 | + * @author fei.hong <fei.hong@yoho.cn> | ||
13 | + */ | ||
14 | +class DownloadController extends AbstractAction | ||
15 | +{ | ||
16 | + | ||
17 | + /** | ||
18 | + * 下载APP | ||
19 | + */ | ||
20 | + public function mkappAction() | ||
21 | + { | ||
22 | + // 跳转到老站s | ||
23 | + $this->go(OLD_MAIN . '/download/mkapp'); | ||
24 | + } | ||
25 | + | ||
26 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | + | ||
5 | +/** | ||
6 | + * 个人中心相关的控制器 | ||
7 | + * | ||
8 | + * @name HomeController | ||
9 | + * @package | ||
10 | + * @copyright yoho.inc | ||
11 | + * @version 1.0 (2015-10-28 16:28:32) | ||
12 | + * @author fei.hong <fei.hong@yoho.cn> | ||
13 | + */ | ||
14 | +class HomeController extends AbstractAction | ||
15 | +{ | ||
16 | + /** | ||
17 | + * 个人中心入口 | ||
18 | + */ | ||
19 | + public function indexAction() | ||
20 | + { | ||
21 | + // 目前跳到老站 | ||
22 | + $this->go(OLD_MAIN . '/home'); | ||
23 | + } | ||
24 | + | ||
25 | +} |
@@ -73,35 +73,35 @@ class SearchController extends AbstractAction | @@ -73,35 +73,35 @@ class SearchController extends AbstractAction | ||
73 | 'discount' => FILTER_VALIDATE_INT, | 73 | 'discount' => FILTER_VALIDATE_INT, |
74 | 'gender' => FILTER_DEFAULT, | 74 | 'gender' => FILTER_DEFAULT, |
75 | 'p_d' => FILTER_DEFAULT,), false); | 75 | 'p_d' => FILTER_DEFAULT,), false); |
76 | - | 76 | + |
77 | $query = isset($condition['query']) ? strtolower(trim($condition['query'])) : null; | 77 | $query = isset($condition['query']) ? strtolower(trim($condition['query'])) : null; |
78 | - | 78 | + |
79 | // 标识用户是否有输入搜索内容 | 79 | // 标识用户是否有输入搜索内容 |
80 | $haveQuery = $query !== null; | 80 | $haveQuery = $query !== null; |
81 | // 标识用户搜的是不是一级品类 | 81 | // 标识用户搜的是不是一级品类 |
82 | $isQueryFirstClass = false; | 82 | $isQueryFirstClass = false; |
83 | // 标识用户搜的是不是二级品类 | 83 | // 标识用户搜的是不是二级品类 |
84 | $isQuerySecondClass = false; | 84 | $isQuerySecondClass = false; |
85 | - | 85 | + |
86 | /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框) */ | 86 | /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框) */ |
87 | if ($haveQuery) { | 87 | if ($haveQuery) { |
88 | $domain = null; | 88 | $domain = null; |
89 | $brandNames = Product\ListModel::getAllBrandNames(); | 89 | $brandNames = Product\ListModel::getAllBrandNames(); |
90 | - | 90 | + |
91 | do { | 91 | do { |
92 | /* 精确查品牌域名 */ | 92 | /* 精确查品牌域名 */ |
93 | if (isset($brandNames[$query])) { | 93 | if (isset($brandNames[$query])) { |
94 | $domain = $query; | 94 | $domain = $query; |
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | - | 97 | + |
98 | /* 精确查品牌名称 */ | 98 | /* 精确查品牌名称 */ |
99 | $domains = array_keys($brandNames, $query, true); | 99 | $domains = array_keys($brandNames, $query, true); |
100 | if (isset($domains[0])) { | 100 | if (isset($domains[0])) { |
101 | $domain = $domains[0]; | 101 | $domain = $domains[0]; |
102 | break; | 102 | break; |
103 | } | 103 | } |
104 | - | 104 | + |
105 | /* 模糊查品牌域名 */ | 105 | /* 模糊查品牌域名 */ |
106 | foreach ($brandNames as $key => $domains) { | 106 | foreach ($brandNames as $key => $domains) { |
107 | if (strpos($key, $query) !== false) { | 107 | if (strpos($key, $query) !== false) { |
@@ -110,22 +110,22 @@ class SearchController extends AbstractAction | @@ -110,22 +110,22 @@ class SearchController extends AbstractAction | ||
110 | } | 110 | } |
111 | } | 111 | } |
112 | } while (false); | 112 | } while (false); |
113 | - | 113 | + |
114 | // 清空变量做释放 | 114 | // 清空变量做释放 |
115 | $brandNames = array(); | 115 | $brandNames = array(); |
116 | - | 116 | + |
117 | // 跳转到品牌商品列表页 | 117 | // 跳转到品牌商品列表页 |
118 | if ($domain !== null) { | 118 | if ($domain !== null) { |
119 | $url = Helpers::url('', array( | 119 | $url = Helpers::url('', array( |
120 | - 'from' => 'search', | ||
121 | - 'query' => $query, | ||
122 | - 'gender' => $condition['gender'] | ||
123 | - ), $domain); | 120 | + 'from' => 'search', |
121 | + 'query' => $query, | ||
122 | + 'gender' => $condition['gender'] | ||
123 | + ), $domain); | ||
124 | $this->go($url); | 124 | $this->go($url); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | - | ||
128 | - | 127 | + |
128 | + | ||
129 | /* 判断是不是品类, 是品类加导航标题(不显示搜索框) */ | 129 | /* 判断是不是品类, 是品类加导航标题(不显示搜索框) */ |
130 | if ($haveQuery) { | 130 | if ($haveQuery) { |
131 | $classNames = Category\ClassModel::getClassNames(); | 131 | $classNames = Category\ClassModel::getClassNames(); |
@@ -137,30 +137,29 @@ class SearchController extends AbstractAction | @@ -137,30 +137,29 @@ class SearchController extends AbstractAction | ||
137 | $isQueryFirstClass = true; | 137 | $isQueryFirstClass = true; |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | - | 140 | + |
141 | /* 精确查二级品类 */ | 141 | /* 精确查二级品类 */ |
142 | $sorts = array_keys($classNames['second'], $query, true); | 142 | $sorts = array_keys($classNames['second'], $query, true); |
143 | if (isset($sorts[0])) { | 143 | if (isset($sorts[0])) { |
144 | $isQuerySecondClass = true; | 144 | $isQuerySecondClass = true; |
145 | break; | 145 | break; |
146 | } | 146 | } |
147 | - } | ||
148 | - while (false); | ||
149 | - | 147 | + } while (false); |
148 | + | ||
150 | $classNames = array(); | 149 | $classNames = array(); |
151 | } | 150 | } |
152 | - | 151 | + |
153 | $data = array(); | 152 | $data = array(); |
154 | // 搜索是一级品类 | 153 | // 搜索是一级品类 |
155 | if ($isQueryFirstClass) { | 154 | if ($isQueryFirstClass) { |
156 | $this->setTitle('全部' . $query); | 155 | $this->setTitle('全部' . $query); |
157 | $this->setNavHeader('全部' . $query, true, SITE_MAIN); | 156 | $this->setNavHeader('全部' . $query, true, SITE_MAIN); |
158 | - } | 157 | + } |
159 | // 搜索是二级品类 | 158 | // 搜索是二级品类 |
160 | elseif ($isQuerySecondClass) { | 159 | elseif ($isQuerySecondClass) { |
161 | $this->setTitle($query); | 160 | $this->setTitle($query); |
162 | $this->setNavHeader($query, true, SITE_MAIN); | 161 | $this->setNavHeader($query, true, SITE_MAIN); |
163 | - } | 162 | + } |
164 | // 搜索其它内容 | 163 | // 搜索其它内容 |
165 | else { | 164 | else { |
166 | if ($haveQuery) { | 165 | if ($haveQuery) { |
@@ -170,25 +169,29 @@ class SearchController extends AbstractAction | @@ -170,25 +169,29 @@ class SearchController extends AbstractAction | ||
170 | $this->setTitle('搜索'); | 169 | $this->setTitle('搜索'); |
171 | $this->setNavHeader('搜索', true, SITE_MAIN); | 170 | $this->setNavHeader('搜索', true, SITE_MAIN); |
172 | } | 171 | } |
173 | - | 172 | + |
174 | $data['goodListPage'] = true; | 173 | $data['goodListPage'] = true; |
175 | $data['goodList'] = $condition; | 174 | $data['goodList'] = $condition; |
176 | 175 | ||
177 | // 查询数据 | 176 | // 查询数据 |
178 | - $listData = SearchData::searchByCondition($condition); | ||
179 | - // 处理返回的数据 | ||
180 | - if (!empty($listData['data']['brand'])) { | ||
181 | - $brandData = $listData['data']['brand']; | ||
182 | - $data['brandWay'] = array( | ||
183 | - 'url' => 'http://'. $brandData['brand_domain'] . SUB_DOMAIN, | ||
184 | - 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40), | ||
185 | - 'name' => $brandData['brand_name'] | ||
186 | - ); | ||
187 | - // 设置品牌默认值 | ||
188 | - $data['goodList']['brand'] = $brandData['id']; | ||
189 | - $data['goodList'] += ListProcess::getListData($listData['data']); | 177 | + if (!isset($condition['query'])) { |
178 | + $data['goodList'] += Product\ListModel::getClassData($condition); | ||
179 | + } else { | ||
180 | + $listData = SearchData::searchByCondition($condition); | ||
181 | + // 处理返回的数据 | ||
182 | + if (!empty($listData['data']['brand'])) { | ||
183 | + $brandData = $listData['data']['brand']; | ||
184 | + $data['brandWay'] = array( | ||
185 | + 'url' => 'http://' . $brandData['brand_domain'] . SUB_DOMAIN, | ||
186 | + 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40), | ||
187 | + 'name' => $brandData['brand_name'] | ||
188 | + ); | ||
189 | + // 设置品牌默认值 | ||
190 | + $data['goodList']['brand'] = $brandData['id']; | ||
191 | + $data['goodList'] += ListProcess::getListData($listData['data']); | ||
192 | + } | ||
193 | + $listData = array(); | ||
190 | } | 194 | } |
191 | - $listData = array(); | ||
192 | 195 | ||
193 | $this->_view->display('list', $data); | 196 | $this->_view->display('list', $data); |
194 | } | 197 | } |
@@ -211,7 +214,7 @@ class SearchController extends AbstractAction | @@ -211,7 +214,7 @@ class SearchController extends AbstractAction | ||
211 | 'price' => FILTER_VALIDATE_INT, | 214 | 'price' => FILTER_VALIDATE_INT, |
212 | 'discount' => FILTER_DEFAULT, | 215 | 'discount' => FILTER_DEFAULT, |
213 | 'gender' => FILTER_DEFAULT, | 216 | 'gender' => FILTER_DEFAULT, |
214 | - 'p_d' => FILTER_DEFAULT, ), false); | 217 | + 'p_d' => FILTER_DEFAULT,), false); |
215 | 218 | ||
216 | // 转换排序方式 | 219 | // 转换排序方式 |
217 | $page = $this->get('page', 1); | 220 | $page = $this->get('page', 1); |
@@ -232,15 +235,23 @@ class SearchController extends AbstractAction | @@ -232,15 +235,23 @@ class SearchController extends AbstractAction | ||
232 | 235 | ||
233 | $data = array(); | 236 | $data = array(); |
234 | // 查询数据 | 237 | // 查询数据 |
235 | - $listData = SearchData::searchByCondition($condition, $order, $page); | ||
236 | - // 处理返回的数据 | ||
237 | - if (isset($listData['data'])) { | ||
238 | - if (isset($listData['data']['filter'])) { | ||
239 | - unset($listData['data']['filter']); | 238 | + if (!isset($condition['query'])) { |
239 | + $data += Product\ListModel::getClassData($condition); | ||
240 | + if (isset($data['filter'])) { | ||
241 | + unset($data['filter']); | ||
242 | + } | ||
243 | + } else { | ||
244 | + // 查询数据 | ||
245 | + $listData = SearchData::searchByCondition($condition, $order, $page); | ||
246 | + // 处理返回的数据 | ||
247 | + if (isset($listData['data'])) { | ||
248 | + if (isset($listData['data']['filter'])) { | ||
249 | + unset($listData['data']['filter']); | ||
250 | + } | ||
251 | + $data = ListProcess::getListData($listData['data']); | ||
240 | } | 252 | } |
241 | - $data = ListProcess::getListData($listData['data']); | 253 | + $listData = array(); |
242 | } | 254 | } |
243 | - $listData = array(); | ||
244 | 255 | ||
245 | if (empty($data)) { | 256 | if (empty($data)) { |
246 | echo ' '; | 257 | echo ' '; |
@@ -95,21 +95,21 @@ class SideModel | @@ -95,21 +95,21 @@ class SideModel | ||
95 | 'textEn' => '', | 95 | 'textEn' => '', |
96 | 'back' => false, | 96 | 'back' => false, |
97 | 'isSelect' => ($guangChoosed === 'all') ? true : false, | 97 | 'isSelect' => ($guangChoosed === 'all') ? true : false, |
98 | - 'url' => '/guang/list/index?gender=1,2,3' | 98 | + 'url' => Helpers::url('', array('gender' => '1,2,3'), 'guang') |
99 | ), | 99 | ), |
100 | 2 => array( | 100 | 2 => array( |
101 | 'textCn' => '只看男生', | 101 | 'textCn' => '只看男生', |
102 | 'textEn' => 'Boys', | 102 | 'textEn' => 'Boys', |
103 | 'back' => false, | 103 | 'back' => false, |
104 | 'isSelect' => ($guangChoosed === 'boys') ? true : false, | 104 | 'isSelect' => ($guangChoosed === 'boys') ? true : false, |
105 | - 'url' => '/guang/list/index?gender=1,3' | 105 | + 'url' => Helpers::url('', array('gender' => '1,3'), 'guang') |
106 | ), | 106 | ), |
107 | 3 => array( | 107 | 3 => array( |
108 | 'textCn' => '只看女生', | 108 | 'textCn' => '只看女生', |
109 | 'textEn' => 'Girls', | 109 | 'textEn' => 'Girls', |
110 | 'back' => false, | 110 | 'back' => false, |
111 | 'isSelect' => ($guangChoosed === 'girls') ? true : false, | 111 | 'isSelect' => ($guangChoosed === 'girls') ? true : false, |
112 | - 'url' => '/guang/list/index?gender=2,3', | 112 | + 'url' => Helpers::url('', array('gender' => '2,3'), 'guang') |
113 | ), | 113 | ), |
114 | ) | 114 | ) |
115 | ) | 115 | ) |
@@ -44,7 +44,7 @@ class ListModel | @@ -44,7 +44,7 @@ class ListModel | ||
44 | } | 44 | } |
45 | 45 | ||
46 | // 调用接口查询数据 | 46 | // 调用接口查询数据 |
47 | - $listData = ClassData::filterClassData($condition); | 47 | + $listData = ClassData::filterClassData($condition); |
48 | // 处理返回的数据 | 48 | // 处理返回的数据 |
49 | if (isset($listData['code']) && $listData['code'] === 200) { | 49 | if (isset($listData['code']) && $listData['code'] === 200) { |
50 | $result = ListProcess::getListData($listData['data']); | 50 | $result = ListProcess::getListData($listData['data']); |
@@ -86,7 +86,7 @@ class ListModel | @@ -86,7 +86,7 @@ class ListModel | ||
86 | } | 86 | } |
87 | 87 | ||
88 | // 获取品牌banner的数据, 有缓存1小时 | 88 | // 获取品牌banner的数据, 有缓存1小时 |
89 | - $bannerData = BrandData::getBrandBanner($id); | 89 | + $bannerData = BrandData::getBrandBanner($id); |
90 | if (isset($bannerData['data']['banner'])) { | 90 | if (isset($bannerData['data']['banner'])) { |
91 | $result['brandHome']['banner'] = Helpers::getImageUrl($bannerData['data']['banner'], 640, 75); | 91 | $result['brandHome']['banner'] = Helpers::getImageUrl($bannerData['data']['banner'], 640, 75); |
92 | } | 92 | } |
@@ -118,17 +118,17 @@ class ListModel | @@ -118,17 +118,17 @@ class ListModel | ||
118 | } | 118 | } |
119 | 119 | ||
120 | // 调用接口查询数据 | 120 | // 调用接口查询数据 |
121 | - $listData = BrandData::filterBrandData($condition); | 121 | + $listData = BrandData::filterBrandData($condition); |
122 | // 处理返回的数据 | 122 | // 处理返回的数据 |
123 | if (isset($listData['code']) && $listData['code'] === 200) { | 123 | if (isset($listData['code']) && $listData['code'] === 200) { |
124 | $result = ListProcess::getListData($listData['data']); | 124 | $result = ListProcess::getListData($listData['data']); |
125 | if (!empty($listData['data']['brand'])) { | 125 | if (!empty($listData['data']['brand'])) { |
126 | $result['brandWay'] = array( | 126 | $result['brandWay'] = array( |
127 | - 'url' => 'http://'. $listData['data']['brand_domain'] . SUB_DOMAIN, | ||
128 | - 'thumb' => Helpers::getImageUrl($listData['data']['brand_ico'], 75, 40), | ||
129 | - 'name' => $listData['data']['brand_name'] | 127 | + 'url' => 'http://'. $listData['data']['brand']['brand_domain'] . SUB_DOMAIN, |
128 | + 'thumb' => Helpers::getImageUrl($listData['data']['brand']['brand_ico'], 75, 40), | ||
129 | + 'name' => $listData['data']['brand']['brand_name'] | ||
130 | ); | 130 | ); |
131 | - $title = $listData['data']['brand_name']; | 131 | + $title = $listData['data']['brand']['brand_name']; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 |
1 | +<?php | ||
2 | + | ||
3 | +use Action\AbstractAction; | ||
4 | + | ||
5 | +/** | ||
6 | + * 购物车相关的控制器 | ||
7 | + * | ||
8 | + * @name IndexController | ||
9 | + * @package Cart | ||
10 | + * @copyright yoho.inc | ||
11 | + * @version 1.0 (2015-10-28 16:34:17) | ||
12 | + * @author fei.hong <fei.hong@yoho.cn> | ||
13 | + */ | ||
14 | +class IndexController extends AbstractAction | ||
15 | +{ | ||
16 | + public function indexAction() | ||
17 | + { | ||
18 | + // 跳转到老版 | ||
19 | + $this->go(OLD_MAIN . '/cart/index/index'); | ||
20 | + } | ||
21 | +} |
@@ -24,7 +24,16 @@ class IndexController extends AbstractAction | @@ -24,7 +24,16 @@ class IndexController extends AbstractAction | ||
24 | $uid = $this->getUid(); | 24 | $uid = $this->getUid(); |
25 | $udid = $this->getUdid(); | 25 | $udid = $this->getUdid(); |
26 | $type = $this->get('id', 0); | 26 | $type = $this->get('id', 0); |
27 | - $gender = $this->get('gender'); | 27 | + $gender = rawurldecode($this->get('gender', '1,2,3')); |
28 | + | ||
29 | +// // 设置侧边栏逛的默认选中状态 | ||
30 | +// if ($gender === '1,3') { | ||
31 | +// $this->setNavSide('boys'); | ||
32 | +// } elseif ($gender === '2,3') { | ||
33 | +// $this->setNavSide('girls'); | ||
34 | +// } else { | ||
35 | +// $this->setNavSide('all'); | ||
36 | +// } | ||
28 | 37 | ||
29 | $this->_view->display('index', Guang\IndexModel::getArticleGroup($gender, $type, $uid, $udid)); | 38 | $this->_view->display('index', Guang\IndexModel::getArticleGroup($gender, $type, $uid, $udid)); |
30 | } | 39 | } |
@@ -39,6 +39,8 @@ class IndexController extends AbstractAction | @@ -39,6 +39,8 @@ class IndexController extends AbstractAction | ||
39 | // 性别参数,不传则从COOKIE获取 | 39 | // 性别参数,不传则从COOKIE获取 |
40 | if (!isset($condition['gender'])) { | 40 | if (!isset($condition['gender'])) { |
41 | $condition['gender'] = Helpers::getGenderByCookie(); | 41 | $condition['gender'] = Helpers::getGenderByCookie(); |
42 | + } else { | ||
43 | + $condition['gender'] = rawurldecode($condition['gender']); | ||
42 | } | 44 | } |
43 | 45 | ||
44 | // 品类名称参数, 不传则默认为全部 | 46 | // 品类名称参数, 不传则默认为全部 |
@@ -105,6 +107,9 @@ class IndexController extends AbstractAction | @@ -105,6 +107,9 @@ class IndexController extends AbstractAction | ||
105 | 'gender' => FILTER_DEFAULT, | 107 | 'gender' => FILTER_DEFAULT, |
106 | 'p_d' => FILTER_DEFAULT,), false); | 108 | 'p_d' => FILTER_DEFAULT,), false); |
107 | $condition['brand'] = $brandIds[0]; | 109 | $condition['brand'] = $brandIds[0]; |
110 | + if (isset($condition['gender'])) { | ||
111 | + $condition['gender'] = rawurldecode($condition['gender']); | ||
112 | + } | ||
108 | 113 | ||
109 | $data['goodListPage'] = true; | 114 | $data['goodListPage'] = true; |
110 | // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 | 115 | // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 |
@@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" | @@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" | ||
4 | ;;website library | 4 | ;;website library |
5 | application.library = ROOT_PATH "/library" | 5 | application.library = ROOT_PATH "/library" |
6 | ;;模块配置 | 6 | ;;模块配置 |
7 | -application.modules = "Index,Category,Channel,Guang,Passport,Product" | 7 | +application.modules = "Index,Category,Channel,Guang,Passport,Product,Cart" |
8 | ;;加载 | 8 | ;;加载 |
9 | application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" | 9 | application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" |
10 | ;;view文件的扩展名 | 10 | ;;view文件的扩展名 |
@@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" | @@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" | ||
4 | ;;website library | 4 | ;;website library |
5 | application.library = ROOT_PATH "/library" | 5 | application.library = ROOT_PATH "/library" |
6 | ;;默认模块 | 6 | ;;默认模块 |
7 | -application.modules = "Index,Category,Channel,Guang,Passport,Product" | 7 | +application.modules = "Index,Category,Channel,Guang,Passport,Product,Cart" |
8 | ;;加载 | 8 | ;;加载 |
9 | application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" | 9 | application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" |
10 | ;;view文件的扩展名 | 10 | ;;view文件的扩展名 |
@@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" | @@ -4,7 +4,7 @@ application.directory = APPLICATION_PATH "/application" | ||
4 | ;;website library | 4 | ;;website library |
5 | application.library = ROOT_PATH "/library" | 5 | application.library = ROOT_PATH "/library" |
6 | ;;默认模块 | 6 | ;;默认模块 |
7 | -application.modules = "Index,Category,Channel,Guang,Passport,Product" | 7 | +application.modules = "Index,Category,Channel,Guang,Passport,Product,Cart" |
8 | ;;加载 | 8 | ;;加载 |
9 | application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" | 9 | application.bootstrap = APPLICATION_PATH "/application/Bootstrap.php" |
10 | ;;view文件的扩展名 | 10 | ;;view文件的扩展名 |
@@ -82,4 +82,11 @@ routes.productsale.route.module = Product | @@ -82,4 +82,11 @@ routes.productsale.route.module = Product | ||
82 | routes.productsale.route.controller = Newsale | 82 | routes.productsale.route.controller = Newsale |
83 | routes.productsale.route.action = Discount | 83 | routes.productsale.route.action = Discount |
84 | 84 | ||
85 | +; 女生首页 | ||
86 | +routes.girls.type = "rewrite" | ||
87 | +routes.girls.match = "/girl$" | ||
88 | +routes.girls.route.module = Index | ||
89 | +routes.girls.route.controller = Girls | ||
90 | +routes.girls.route.action = index | ||
91 | + | ||
85 | 92 |
-
Please register or login to post a comment