Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -353,6 +353,8 @@ class AbstractAction extends Controller_Abstract @@ -353,6 +353,8 @@ class AbstractAction extends Controller_Abstract
353 */ 353 */
354 protected function setNavSide($guangChoosed = 'all') 354 protected function setNavSide($guangChoosed = 'all')
355 { 355 {
  356 + $this->_view->assign('sideNav', \Index\SideModel::getLeftNav($guangChoosed));
  357 + /*
356 $this->_view->assign('sideNav', array( 358 $this->_view->assign('sideNav', array(
357 0 => array( 359 0 => array(
358 'textCn' => '男生', 360 'textCn' => '男生',
@@ -415,6 +417,7 @@ class AbstractAction extends Controller_Abstract @@ -415,6 +417,7 @@ class AbstractAction extends Controller_Abstract
415 ) 417 )
416 ), 418 ),
417 )); 419 ));
  420 + */
418 } 421 }
419 422
420 /** 423 /**
@@ -14,5 +14,7 @@ class CacheConfig @@ -14,5 +14,7 @@ class CacheConfig
14 const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页 14 const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页
15 const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页 15 const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页
16 const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页 16 const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页
  17 +
  18 + const KEY_COMMON_SIDE_NAV = 'key_common_side_nav'; // 公共的侧边栏
17 19
18 } 20 }
@@ -102,13 +102,15 @@ class BrandData @@ -102,13 +102,15 @@ class BrandData
102 /** 102 /**
103 * 获取品牌banner数据 103 * 获取品牌banner数据
104 * @param integer $brandId 品牌ID 104 * @param integer $brandId 品牌ID
  105 + * @param integer $uid 用户id
105 * @return array banner数据 106 * @return array banner数据
106 */ 107 */
107 - public static function getBrandBanner($brandId) 108 + public static function getBrandBanner($brandId, $uid)
108 { 109 {
109 // 构建必传参数 110 // 构建必传参数
110 $param = Yohobuy::param(); 111 $param = Yohobuy::param();
111 $param['brand_id'] = $brandId; 112 $param['brand_id'] = $brandId;
  113 + $param['uid'] = $uid;
112 $param['method'] = 'app.brand.banner'; 114 $param['method'] = 'app.brand.banner';
113 $param['client_secret'] = Sign::getSign($param); 115 $param['client_secret'] = Sign::getSign($param);
114 116
@@ -133,6 +135,9 @@ class BrandData @@ -133,6 +135,9 @@ class BrandData
133 */ 135 */
134 public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1) 136 public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1)
135 { 137 {
  138 + // 构建必传参数
  139 + $param = Yohobuy::param();
  140 +
136 $selectItems = array( 141 $selectItems = array(
137 'gender' => $gender, 142 'gender' => $gender,
138 'brand' => $brand, 143 'brand' => $brand,
@@ -146,9 +151,7 @@ class BrandData @@ -146,9 +151,7 @@ class BrandData
146 $queriedParams = array_filter($selectItems, function($v) { 151 $queriedParams = array_filter($selectItems, function($v) {
147 return $v !== null; 152 return $v !== null;
148 }); 153 });
149 -  
150 - // 构建必传参数  
151 - $param = Yohobuy::param(); 154 + $param += $queriedParams;
152 155
153 $param['method'] = 'app.search.brand'; 156 $param['method'] = 'app.search.brand';
154 $param['page'] = $page; 157 $param['page'] = $page;
@@ -22,27 +22,26 @@ class SideData @@ -22,27 +22,26 @@ class SideData
22 /** 22 /**
23 * 左侧边栏的分类和图标数据 23 * 左侧边栏的分类和图标数据
24 * 24 *
25 - * 备注:暂不使用,因很少变,获取后还需要再封装  
26 - *  
27 * @return array 25 * @return array
28 */ 26 */
29 public static function leftNav() 27 public static function leftNav()
30 { 28 {
31 - $param = Yohobuy::param();  
32 - $param['client_type'] = 'iphone'; // 因安卓不返回icon的地址  
33 - $param['client_secret'] = Sign::getSign($param);  
34 - $query = Yohobuy::httpBuildQuery('', $param);  
35 -  
36 - $urlList = array();  
37 - $urlList['getEntrance'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_ENTRANCE . $query;  
38 - $urlList['getCategory'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY . $query;  
39 -  
40 - return Yohobuy::getMulti($urlList);  
41 -  
42 // $param = Yohobuy::param(); 29 // $param = Yohobuy::param();
  30 +// $param['client_type'] = 'h5'; // 因安卓不返回icon的地址
43 // $param['client_secret'] = Sign::getSign($param); 31 // $param['client_secret'] = Sign::getSign($param);
  32 +// $query = Yohobuy::httpBuildQuery('', $param);
44 // 33 //
45 -// return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param); 34 +// $urlList = array();
  35 +// $urlList['getEntrance'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_ENTRANCE . $query;
  36 +// $urlList['getCategory'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY . $query;
  37 +//
  38 +// return Yohobuy::getMulti($urlList);
  39 +
  40 + $param = Yohobuy::param();
  41 + $param['client_type'] = 'h5'; // 调用H5手机网站的
  42 + $param['client_secret'] = Sign::getSign($param);
  43 +
  44 + return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param);
46 } 45 }
47 46
48 } 47 }
@@ -5,19 +5,20 @@ use Api\Yohobuy; @@ -5,19 +5,20 @@ use Api\Yohobuy;
5 use Api\Sign; 5 use Api\Sign;
6 6
7 /** 7 /**
8 - * 新品到着,折扣专区接口操作类 8 + * 搜索有关数据操作类
9 * 9 *
10 - * @name NewsaleData 10 + * @name SearchData
11 * @package Library/LibModels/wap/Product 11 * @package Library/LibModels/wap/Product
12 * @copyright yoho.inc 12 * @copyright yoho.inc
13 * @version 1.0 (2015-10-8) 13 * @version 1.0 (2015-10-8)
14 * @author gtskk <rocky.zhang@yoho.cn> 14 * @author gtskk <rocky.zhang@yoho.cn>
15 */ 15 */
16 -class NewsaleData 16 +class SearchData
17 { 17 {
18 18
19 /** 19 /**
20 * 模糊搜索提供的关键词 20 * 模糊搜索提供的关键词
  21 + *
21 * @param string $keyword 关键词 22 * @param string $keyword 关键词
22 * @return array 根据跟定关键词搜索到的结果,包括数据数目count和提供的关键词keyword 23 * @return array 根据跟定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
23 */ 24 */
@@ -35,18 +36,34 @@ class NewsaleData @@ -35,18 +36,34 @@ class NewsaleData
35 36
36 /** 37 /**
37 * 根据跟定查询数据搜索数据列表 38 * 根据跟定查询数据搜索数据列表
38 - * @param string $query 查询条件  
39 - * @param string $order 排列顺序,默认为倒序  
40 - * @param integer $page 指定查询是多少页,默认为第一页  
41 - * @param integer $limit 指定查询多少个,默认是60哥  
42 - * @return array 搜索到的数据 39 + *
  40 + * @param string $query 查询条件, 默认为null
  41 + * @param string $brand 品牌,默认为null
  42 + * @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
  43 + * @param string $p_d 折扣,默认为null
  44 + * @param string $misort 商品分类,默认为null
  45 + * @param string $msort 商品分类,默认为null
  46 + * @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
  47 + * s_t_asc表示按时间正序排列,
  48 + * s_p_asc表示按价格正序排列,
  49 + * s_p_desc表示按价格倒序排列,
  50 + * p_d_asc表示按折扣正序排列,
  51 + * p_d_desc表示按折扣倒序排列
  52 + * @param integer $page 指定查询是多少页,默认为第一页
  53 + * @param integer $limit 指定查询多少个,默认是60哥
  54 + * @return array 搜索到的数据
43 */ 55 */
44 - public static function searchLiDatas($query, $order = 's_t_desc', $page = 1, $limit = 60) 56 + public static function searchLiDatas($query = null, $brand = null, $gender = null, $p_d = null, $misort = null, $msort = null, $order = 's_t_desc', $page = 1, $limit = 60)
45 { 57 {
46 // 构建必传参数 58 // 构建必传参数
47 $param = Yohobuy::param(); 59 $param = Yohobuy::param();
48 60
49 - $param['query'] = $query; 61 + is_null($query) || $param['query'] = $query;
  62 + is_null($brand) || $param['brand'] = $brand;
  63 + is_null($gender) || $param['gender'] = $gender;
  64 + is_null($p_d) || $param['p_d'] = $p_d;
  65 + is_null($misort) || $param['misort'] = $misort;
  66 + is_null($msort) || $param['msort'] = $msort;
50 $param['method'] = 'app.search.li'; 67 $param['method'] = 'app.search.li';
51 $param['order'] = $order; 68 $param['order'] = $order;
52 $param['page'] = $page; 69 $param['page'] = $page;
@@ -150,8 +150,6 @@ class FloorProcess @@ -150,8 +150,6 @@ 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 -  
155 153
156 return $result; 154 return $result;
157 } 155 }
  1 +<?php
  2 +
  3 +namespace Plugin\DataProcess;
  4 +use Plugin\Helpers;
  5 +
  6 +/**
  7 + * 列表数据处理类
  8 + */
  9 +class ListProcess
  10 +{
  11 +
  12 + /**
  13 + * 返回商品和过滤数据
  14 + *
  15 + * @param $data
  16 + * @return array 处理之后的商品数据
  17 + */
  18 + public static function getListData($data)
  19 + {
  20 + $result = array('new'=>array(), 'filter'=>array());
  21 +
  22 + if(isset($data['product_list']))
  23 + {
  24 + $result['new'] = self::getProductData($data['product_list']);
  25 + }
  26 + if(isset($data['filter']))
  27 + {
  28 + $result['filter'] = self::getFilterData($data['filter']);
  29 + }
  30 +
  31 + return $result;
  32 +
  33 + }
  34 +
  35 + /**
  36 + * 处理列表商品数据
  37 + *
  38 + * @param $data
  39 + * @return array 处理之后的商品数据
  40 + */
  41 + public static function getProductData($data)
  42 + {
  43 + // 处理商品
  44 + $products = array();
  45 +
  46 + foreach ($data as $value)
  47 + {
  48 + $products[] = Helpers::formatProduct($value);
  49 + }
  50 +
  51 + return $products;
  52 +
  53 + }
  54 +
  55 + /**
  56 + * 处理筛选数据
  57 + *
  58 + * @param $data
  59 + * @return array 处理之后的筛选数据
  60 + */
  61 + public static function getFilterData($data)
  62 + {
  63 + // 过滤条件数据
  64 + $filters = array('classify'=>array());
  65 +
  66 + foreach ($data as $key => $val) {
  67 + if(empty($val))
  68 + {
  69 + continue;
  70 + }
  71 + if (!is_callable("self::$key")) {
  72 + continue;
  73 + }
  74 + $build = self::$key($val);
  75 + $filters['classify'][] = $build;
  76 + }
  77 +
  78 + return $filters;
  79 +
  80 + }
  81 +
  82 + private static function brand($data)
  83 + {
  84 + $result = array(
  85 + 'title' => '品牌',
  86 + 'name' => '所有品牌',
  87 + 'subs' => array(
  88 + array(
  89 + 'chosed' => true,
  90 + 'dataId' => 0,
  91 + 'name' => '所有品牌'
  92 + )
  93 + )
  94 + );
  95 +
  96 + // 对品牌数据按照品牌字母进行排序
  97 + self::sortArrByField($data, 'brand_alif');
  98 +
  99 + foreach ($data as $one) {
  100 + $brand = array();
  101 + $brand['dataId'] = $one['id'];
  102 + $brand['name'] = $one['brand_name'];
  103 +
  104 + $result['subs'][] = $brand;
  105 + }
  106 +
  107 + return $result;
  108 + }
  109 +
  110 + private static function color($data)
  111 + {
  112 + $result = array(
  113 + 'title' => '颜色',
  114 + 'name' => '所有颜色',
  115 + 'subs' => array(
  116 + array(
  117 + 'chosed' => true,
  118 + 'dataId' => 0,
  119 + 'name' => '所有颜色'
  120 + )
  121 + )
  122 + );
  123 +
  124 + foreach ($data as $one) {
  125 + $color = array();
  126 + $color['dataId'] = $one['color_id'];
  127 + $color['name'] = $one['color_name'];
  128 +
  129 + $result['subs'][] = $color;
  130 + }
  131 +
  132 + return $result;
  133 + }
  134 +
  135 + private static function discount($data)
  136 + {
  137 + $result = array(
  138 + 'title' => '折扣',
  139 + 'name' => '所有商品',
  140 + 'subs' => array(
  141 + array(
  142 + 'chosed' => true,
  143 + 'dataId' => 0,
  144 + 'name' => '所有商品'
  145 + )
  146 + )
  147 + );
  148 +
  149 + foreach ($data as $one) {
  150 + $discount = array();
  151 + $discount['dataId'] = $one['count'];
  152 + $discount['name'] = $one['name'] .'折商品';
  153 +
  154 + $result['subs'][] = $discount;
  155 + }
  156 +
  157 + return $result;
  158 + }
  159 +
  160 + private static function gender($data)
  161 + {
  162 + $result = array(
  163 + 'title' => '性别',
  164 + 'name' => '所有性别',
  165 + 'subs' => array(
  166 + array(
  167 + 'chosed' => true,
  168 + 'dataId' => 0,
  169 + 'name' => '所有性别'
  170 + ),
  171 + array(
  172 + 'dataId' => 1,
  173 + 'name' => '男'
  174 + ),
  175 + array(
  176 + 'dataId' => 2,
  177 + 'name' => '女'
  178 + ),
  179 + )
  180 + );
  181 +
  182 + return $result;
  183 + }
  184 +
  185 + private static function group_sort($data)
  186 + {
  187 + $result = array(
  188 + 'title' => '品类',
  189 + 'name' => '所有品类',
  190 + 'subs' => array(
  191 + array(
  192 + 'chosed' => true,
  193 + 'dataId' => 0,
  194 + 'name' => '所有品类'
  195 + )
  196 + )
  197 + );
  198 +
  199 + foreach ($data as $one) {
  200 + $category = array();
  201 + $category['dataId'] = $one['category_id'];
  202 + $category['name'] = $one['category_name'];
  203 +
  204 + // 子品类
  205 + if(isset($one['sub']))
  206 + {
  207 + $category['subs'] = array();
  208 + foreach ($one['sub'] as $single) {
  209 + $subitem = array();
  210 + $subitem['dataId'] = $single['category_id'];
  211 + $subitem['name'] = $single['category_name'];
  212 +
  213 + $category['subs'][] = $subitem;
  214 + }
  215 + }
  216 +
  217 + $result['subs'][] = $category;
  218 + }
  219 +
  220 + return $result;
  221 + }
  222 +
  223 + private static function priceRange($data)
  224 + {
  225 + $result = array(
  226 + 'title' => '价格',
  227 + 'name' => '所有价格',
  228 + 'subs' => array(
  229 + array(
  230 + 'chosed' => true,
  231 + 'dataId' => 0,
  232 + 'name' => '所有价格'
  233 + )
  234 + )
  235 + );
  236 +
  237 + foreach ($data as $one) {
  238 + $price = array();
  239 + $price['name'] = $one;
  240 +
  241 + $result[] = $price;
  242 + }
  243 +
  244 + return $result;
  245 + }
  246 +
  247 + private static function size($data)
  248 + {
  249 + $result = array(
  250 + 'title' => '尺码',
  251 + 'name' => '所有尺码',
  252 + 'subs' => array(
  253 + array(
  254 + 'chosed' => true,
  255 + 'dataId' => 0,
  256 + 'name' => '所有尺码'
  257 + )
  258 + )
  259 + );
  260 +
  261 + foreach ($data as $one) {
  262 + $size = array();
  263 + $size['dataId'] = $one['size_id'];
  264 + $size['name'] = $one['size_name'];
  265 +
  266 + $result['subs'][] = $size;
  267 + }
  268 +
  269 + return $result;
  270 + }
  271 +
  272 + /**
  273 + * 按照数组中指定字段排序二维数组
  274 + *
  275 + * @param array &$array 需要排序的数组
  276 + * @param string $field 字段名称
  277 + * @param boolean $desc 时候降序排列,默认为false
  278 + */
  279 + private static function sortArrByField(&$array, $field, $desc = false){
  280 + $fieldArr = array();
  281 + foreach ($array as $k => $v) {
  282 + $fieldArr[$k] = $v[$field];
  283 + }
  284 + $sort = $desc == false ? SORT_ASC : SORT_DESC;
  285 + array_multisort($fieldArr, $sort, $array);
  286 + }
  287 +}
  1 +
  2 +<VirtualHost *:8080>
  3 + ServerAdmin root@localhost
  4 + CustomLog "/Data/logs/apache/access.buy.test.yoho.cn.log" combined
  5 + ErrorLog "/Data/logs/apache/error.buy.test.yoho.cn.log"
  6 + ServerName buy.test.yoho.cn
  7 + DocumentRoot "/Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public"
  8 + RewriteEngine on
  9 + RewriteCond %{REQUEST_FILENAME} !-f
  10 + RewriteCond %{REQUEST_FILENAME} !-d
  11 + RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$
  12 + RewriteRule ^/(.+)$ /index.php [L]
  13 + <Directory />
  14 + LimitRequestBody 10485760
  15 + Options FollowSymLinks
  16 + AllowOverride None
  17 + Order allow,deny
  18 + Allow from all
  19 + Require all granted
  20 + </Directory>
  21 +</VirtualHost>
  22 +
  23 +<VirtualHost *:8080>
  24 + ServerAdmin root@localhost
  25 + CustomLog "/Data/logs/apache/access.guang.test.yoho.cn.log" combined
  26 + ErrorLog "/Data/logs/apache/error.guang.test.yoho.cn.log"
  27 + ServerName guang.test.yoho.cn
  28 + DocumentRoot "/Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public"
  29 + RewriteEngine on
  30 + RewriteCond %{REQUEST_FILENAME} !-f
  31 + RewriteCond %{REQUEST_FILENAME} !-d
  32 + RewriteCond %{REQUEST_URI} !^.*(\.css|\.js|\.gif|\.png|\.jpg|\.jpeg|\.svg|\.woff|\.eot|\.ttf)$
  33 + RewriteCond %{QUERY_STRING} ^(.*)$
  34 + RewriteRule / /index.php?/guang/list/index&%1 [L]
  35 + RewriteRule ^/(.+)$ /index.php [L]
  36 + <Directory />
  37 + LimitRequestBody 10485760
  38 + Options FollowSymLinks
  39 + AllowOverride None
  40 + Order allow,deny
  41 + Allow from all
  42 + Require all granted
  43 + </Directory>
  44 +</VirtualHost>
1 server 1 server
2 { 2 {
3 listen 80; 3 listen 80;
4 - server_name wap.yohobuy.com; 4 + server_name buy.test.yoho.cn guang.test.yoho.cn;
5 5
6 - #access_log /Data/logs/access.wap.yohobuy.com.log combined;  
7 - error_log /Data/logs/error.wap.yohobuy.com.log warn; 6 + #access_log /Data/logs/access.buy.test.yoho.cn.log combined;
  7 + error_log /Data/logs/error.buy.test.yoho.cn.log warn;
8 8
9 root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public; 9 root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;
10 10
  11 + #match ip
  12 + deny 192.168.1.1;
  13 + allow 218.94.75.50;
  14 + allow 218.94.75.58;
  15 + allow 123.56.138.21;
  16 + deny all;
  17 +
11 location ~* \.html$ { 18 location ~* \.html$ {
12 - root /Data/PE/yohobuy/assets;  
13 - if (!-f $request_filename){  
14 - root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;  
15 - rewrite ^/(.+)$ /index.php?$1& last; 19 + root /Data/code/git/yohobuy/assets;
  20 + if (-f $request_filename){
  21 + expires 3m;
16 } 22 }
17 - expires 7d;  
18 - }  
19 -  
20 - location / {  
21 - index index.php;  
22 - if (!-f $request_filename){  
23 - rewrite ^/(.+)$ /index.php?$1& last;  
24 - }  
25 } 23 }
26 24
27 location ~* \.(ico|woff)$ { 25 location ~* \.(ico|woff)$ {
@@ -32,27 +30,26 @@ server @@ -32,27 +30,26 @@ server
32 expires 7d; 30 expires 7d;
33 } 31 }
34 32
35 - location ~ .*\.php?$ {  
36 - fastcgi_pass 127.0.0.1:9000;  
37 - fastcgi_index index.php;  
38 - #fastcgi_param PATH_INFO $fastcgi_script_name;  
39 - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
40 - include fastcgi_params; 33 + location / {
  34 + proxy_redirect off;
  35 + proxy_pass http://yohobuy;
  36 + proxy_set_header Host $host;
  37 + proxy_set_header X-Real-IP $remote_addr;
  38 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  39 + proxy_set_header Accept-Encoding "gzip";
41 } 40 }
42 -  
43 - error_page 403 = http://wap.yohobuy.com;  
44 - error_page 404 = http://wap.yohobuy.com/error.html; 41 +
45 } 42 }
46 43
47 server 44 server
48 { 45 {
49 listen 80; 46 listen 80;
50 - server_name static.wap.yohobuy.com; 47 + server_name static.buy.test.yoho.cn;
51 48
52 - #access_log /Data/logs/access.static.wap.yohobuy.com.log combined;  
53 - #error_log /Data/logs/error.static.wap.yohobuy.com.log warn; 49 + #access_log /Data/logs/access.static.buy.test.yoho.cn.log combined;
  50 + #error_log /Data/logs/error.static.buy.test.yoho.cn.log warn;
54 51
55 - root /Data/PE/yohobuy/static; 52 + root /Data/code/git/yohobuy/static;
56 53
57 location / { 54 location / {
58 log_not_found off; 55 log_not_found off;
1 -server  
2 -{  
3 - listen 80;  
4 - server_name wap.yohobuy.com;  
5 -  
6 - #access_log /Data/logs/access.wap.yohobuy.com.log combined;  
7 - error_log /Data/logs/error.wap.yohobuy.com.log warn;  
8 -  
9 - root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;  
10 -  
11 - location ~* \.html$ {  
12 - root /Data/PE/yohobuy/assets;  
13 - if (!-f $request_filename){  
14 - root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;  
15 - rewrite ^/(.+)$ /index.php?$1& last;  
16 - }  
17 - expires 7d;  
18 - }  
19 -  
20 - location / {  
21 - index index.php;  
22 - if (!-f $request_filename){  
23 - rewrite ^/(.+)$ /index.php?$1& last;  
24 - }  
25 - }  
26 -  
27 - location ~* \.(ico|woff)$ {  
28 - expires 7d;  
29 - }  
30 -  
31 - location = /crossdomain.xml {  
32 - expires 7d;  
33 - }  
34 -  
35 - location ~ .*\.php?$ {  
36 - fastcgi_pass 127.0.0.1:9000;  
37 - fastcgi_index index.php;  
38 - #fastcgi_param PATH_INFO $fastcgi_script_name;  
39 - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
40 - include fastcgi_params;  
41 - }  
42 -  
43 - error_page 403 = http://wap.yohobuy.com;  
44 - error_page 404 = http://wap.yohobuy.com/error.html;  
45 -}  
46 -  
47 -server  
48 -{  
49 - listen 80;  
50 - server_name static.wap.yohobuy.com;  
51 -  
52 - #access_log /Data/logs/access.static.wap.yohobuy.com.log combined;  
53 - #error_log /Data/logs/error.static.wap.yohobuy.com.log warn;  
54 -  
55 - root /Data/PE/yohobuy/static;  
56 -  
57 - location / {  
58 - log_not_found off;  
59 - access_log off;  
60 - expires 30d;  
61 - }  
62 -  
63 - location ~* \.(svg|eot|ttf|woff|otf)$ {  
64 - add_header Access-Control-Allow-Origin *;  
65 - expires 30d;  
66 - }  
67 -  
68 -}  
@@ -25,6 +25,7 @@ class BoysController extends AbstractAction @@ -25,6 +25,7 @@ class BoysController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
  28 + 'searchUrl' => '/search',
28 'boysHomePage' => true, 29 'boysHomePage' => true,
29 'maybeLike' => true, 30 'maybeLike' => true,
30 'content' => Index\HomeModel::getBoysFloor() 31 'content' => Index\HomeModel::getBoysFloor()
@@ -25,6 +25,7 @@ class GirlsController extends AbstractAction @@ -25,6 +25,7 @@ class GirlsController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
  28 + 'searchUrl' => '/search',
28 'grilsHomePage' => true, 29 'grilsHomePage' => true,
29 'maybeLike' => true, 30 'maybeLike' => true,
30 'content' => Index\HomeModel::getGirlsFloor() 31 'content' => Index\HomeModel::getGirlsFloor()
@@ -25,6 +25,7 @@ class KidsController extends AbstractAction @@ -25,6 +25,7 @@ class KidsController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
  28 + 'searchUrl' => '/search',
28 'kidsHomePage' => true, 29 'kidsHomePage' => true,
29 'maybeLike' => true, 30 'maybeLike' => true,
30 'content' => Index\HomeModel::getKidsFloor() 31 'content' => Index\HomeModel::getKidsFloor()
@@ -25,6 +25,7 @@ class LifestyleController extends AbstractAction @@ -25,6 +25,7 @@ class LifestyleController extends AbstractAction
25 25
26 // 渲染模板并输出 26 // 渲染模板并输出
27 $this->_view->display('index', array( 27 $this->_view->display('index', array(
  28 + 'searchUrl' => '/search',
28 'lifestyleHomePage' => true, 29 'lifestyleHomePage' => true,
29 'maybeLike' => true, 30 'maybeLike' => true,
30 'content' => Index\HomeModel::getLifestyleFloor() 31 'content' => Index\HomeModel::getLifestyleFloor()
1 <?php 1 <?php
  2 +
2 use Action\AbstractAction; 3 use Action\AbstractAction;
  4 +use LibModels\Wap\Product\SearchData;
3 /** 5 /**
4 * 搜索页 6 * 搜索页
5 */ 7 */
@@ -41,4 +43,52 @@ class SearchController extends AbstractAction @@ -41,4 +43,52 @@ class SearchController extends AbstractAction
41 ); 43 );
42 $this->_view->display('index', array('search' => $data, 'searchPage' => true, 'pageFooter' => true)); 44 $this->_view->display('index', array('search' => $data, 'searchPage' => true, 'pageFooter' => true));
43 } 45 }
  46 +
  47 + /**
  48 + * 模糊搜索指定字符
  49 + *
  50 + * @return array 模糊搜索的结果
  51 + */
  52 + public function fuzzysearch()
  53 + {
  54 + if($this->isAjax())
  55 + {
  56 + $keyword = $this->post('keyword', '');
  57 +
  58 + $result = SearchData::searchFuzzyDatas($keyword);
  59 +
  60 + $this->_view->display('list', array('searchPage' => true, 'pageFooter' => true));
  61 + }
  62 + }
  63 +
  64 + /**
  65 + * 根据指定字符串查询数据
  66 + *
  67 + * @return array 搜索的结果
  68 + */
  69 + public function listsearch()
  70 + {
  71 + $query = $this->get('query', '');
  72 +
  73 + $result = SearchData::searchLiDatas($query);
  74 +
  75 + $this->echoJson($result);
  76 + }
  77 +
  78 + /**
  79 + * 根据指定条件筛选查询到数据
  80 + *
  81 + * @return array 筛选之后的结果
  82 + */
  83 + public function sortsearch()
  84 + {
  85 + if($this->isAjax())
  86 + {
  87 + $query = $this->post('query', '');
  88 +
  89 + $result = SearchData::searchLiDatas($query);
  90 +
  91 + $this->echoJson($result);
  92 + }
  93 + }
44 } 94 }
  1 +<?php
  2 +
  3 +namespace Index;
  4 +
  5 +use LibModels\Wap\Home\SideData;
  6 +use Configs\CacheConfig;
  7 +use Plugin\Helpers;
  8 +use Plugin\Cache;
  9 +
  10 +/**
  11 + *
  12 + * @name SideModel
  13 + * @package models/Index
  14 + * @copyright yoho.inc
  15 + * @version 1.0 (2015-10-21 21:21:09)
  16 + * @author fei.hong <fei.hong@yoho.cn>
  17 + */
  18 +class SideModel
  19 +{
  20 +
  21 + /**
  22 + * 获取左侧边栏数据
  23 + *
  24 + * @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
  25 + */
  26 + public static function getLeftNav($guangChoosed = 'all')
  27 + {
  28 + $result = array();
  29 +
  30 + if (USE_CACHE) {
  31 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  32 + $result = Cache::get(CacheConfig::KEY_COMMON_SIDE_NAV, 'master');
  33 + if (!empty($result)) {
  34 + $result[] = self::genLeftNavGuang($guangChoosed);
  35 + return $result;
  36 + }
  37 + }
  38 +
  39 + // 调用接口获取后台配置的侧边栏数据
  40 + $side = SideData::leftNav();
  41 + if (!empty($side['data'])) {
  42 + foreach ($side['data'] as $key => $value) {
  43 + // 逛的按照原来的做法,使用配置
  44 + if ($value['sort_name_en'] === 'TRENDFINDER') {
  45 + continue;
  46 + }
  47 + $result[$key]['textCn'] = $value['sort_name'];
  48 + $result[$key]['textEn'] = $value['sort_name_en'];
  49 + $result[$key]['styleClass'] = strtolower($value['sort_name_en']);
  50 + $result[$key]['url'] = $value['sort_url'];
  51 + $result[$key]['img'] = Helpers::getImageUrl($value['sort_ico'], 60, 60);
  52 + }
  53 + }
  54 +
  55 + if (USE_CACHE) {
  56 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  57 + if (empty($result)) {
  58 + $result = Cache::get(CacheConfig::KEY_COMMON_SIDE_NAV, 'slave');
  59 + }
  60 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  61 + else {
  62 + Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result);
  63 + }
  64 + }
  65 +
  66 + // 追加逛的子分类数据
  67 + $result[] = self::genLeftNavGuang($guangChoosed);
  68 +
  69 + return $result;
  70 + }
  71 +
  72 + /**
  73 + * 获取并生成左侧边栏中逛的数据
  74 + *
  75 + * @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
  76 + * @return array
  77 + */
  78 + private static function genLeftNavGuang($guangChoosed = 'all')
  79 + {
  80 + return array(
  81 + 'textCn' => '逛',
  82 + 'textEn' => 'TRENDFINDER',
  83 + 'styleClass' => 'guang',
  84 + 'subNav' => array(
  85 + 'list' => array(
  86 + 0 => array(
  87 + 'textCn' => '逛',
  88 + 'textEn' => 'TrendFinder',
  89 + 'back' => true,
  90 + 'isSelect' => false,
  91 + 'bgColor' => ($guangChoosed === 'girls') ? '#FF88AE' : false,
  92 + ),
  93 + 1 => array(
  94 + 'textCn' => '查看全部',
  95 + 'textEn' => '',
  96 + 'back' => false,
  97 + 'isSelect' => ($guangChoosed === 'all') ? true : false,
  98 + 'url' => '/guang/list/index?gender=1,2,3'
  99 + ),
  100 + 2 => array(
  101 + 'textCn' => '只看男生',
  102 + 'textEn' => 'Boys',
  103 + 'back' => false,
  104 + 'isSelect' => ($guangChoosed === 'boys') ? true : false,
  105 + 'url' => '/guang/list/index?gender=1,3'
  106 + ),
  107 + 3 => array(
  108 + 'textCn' => '只看女生',
  109 + 'textEn' => 'Girls',
  110 + 'back' => false,
  111 + 'isSelect' => ($guangChoosed === 'girls') ? true : false,
  112 + 'url' => '/guang/list/index?gender=2,3',
  113 + ),
  114 + )
  115 + )
  116 + );
  117 + }
  118 +
  119 +}
@@ -40,7 +40,7 @@ class BrandController extends AbstractAction @@ -40,7 +40,7 @@ class BrandController extends AbstractAction
40 $brands = $brandsData['data']; 40 $brands = $brandsData['data'];
41 } 41 }
42 42
43 - echo '<pre>'; 43 + /*echo '<pre>';
44 var_dump($brandTop, $brands);exit;*/ 44 var_dump($brandTop, $brands);exit;*/
45 45
46 $data = array ( 46 $data = array (
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
  4 +use LibModels\Wap\Product\SearchData;
  5 +use LibModels\Wap\Category\BrandData;
  6 +use Plugin\DataProcess\ListProcess;
  7 +use Plugin\Helpers;
4 8
5 /** 9 /**
6 * 商品列表页 10 * 商品列表页
7 */ 11 */
8 -  
9 class ListController extends AbstractAction 12 class ListController extends AbstractAction
10 { 13 {
11 public function indexAction() 14 public function indexAction()
@@ -13,101 +16,77 @@ class ListController extends AbstractAction @@ -13,101 +16,77 @@ class ListController extends AbstractAction
13 $data = array( 16 $data = array(
14 'goodListPage' => true, 17 'goodListPage' => true,
15 'goodList' => array( 18 'goodList' => array(
16 - 'search' => 'Aape',  
17 - 'brandWay' => array(  
18 - 'url' => 'http://aape.m.yohobuy.com/',  
19 - 'name' => 'Aape',  
20 - 'thumb' => 'http://img13.static.yhbimg.com/brandLogo/2015/08/26/15/02261f64c198cb4b181c5ef9e61f38f4b9.jpg?imageMogr2/thumbnail/150x70/extent/150x70/background/d2hpdGU=/position/center/quality/90'  
21 - ), 19 + )
  20 + );
  21 +
  22 + $brand = $this->get('brand', null);
  23 + $gender = $this->get('gender', null);
  24 + $p_d = $this->get('p_d', null);
  25 + $misort = $this->get('misort', null);
  26 + $msort = $this->get('msort', null);
  27 +
  28 + // 查询数据
  29 + $listData = SearchData::searchLiDatas(null, $brand, $gender, $p_d, $misort, $msort);
  30 + // 处理返回的数据
  31 + if (isset($listData['code']) && $listData['code'] === 200) {
  32 + $tmpData = $listData['data'];
  33 +
  34 + $data['goodList'] = ListProcess::getListData($tmpData);
  35 + }
  36 +
  37 + $this->_view->display('index', $data);
  38 + }
  39 +
  40 +
  41 + public function brandAction()
  42 + {
  43 + $brand = $this->get('brand', null);
  44 + $gender = $this->get('gender', null);
  45 + $sort = $this->get('sort', null);
  46 + $color = $this->get('color', null);
  47 + $size = $this->get('size', null);
  48 + $price = $this->get('price', null);
  49 + $p_d = $this->get('p_d', null);
  50 +
  51 + $data = array(
  52 + 'pageHeader' => array(
  53 + 'navHome' => '/'
  54 + ),
  55 + 'goodListPage' => true,
  56 + 'goodList' => array(
22 'brand' => array( 57 'brand' => array(
23 - 'id' => 1,  
24 - 'banner' => 'http://img10.static.yhbimg.com/brandBanner/2015/08/26/07/015af5d6ee626cb132cd9c436e896fae26.jpg?imageMogr2/crop/640x'  
25 - ),  
26 - 'new' => array(  
27 - array(  
28 - 'id' => 1,  
29 - 'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/09/15/03/02e50b1037b45b90aa8f33ee328b18facf.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',  
30 - 'url' => '',  
31 - 'name' => 'Aape X YO’HOOD moon face YOH',  
32 - 'salePrice' => 599,  
33 - 'tags' => array(  
34 - 'is_new' => true,  
35 - 'is_discount' => true  
36 - ),  
37 - 'is_soon_sold_out' => true  
38 - ),  
39 - array(  
40 - 'id' => 2,  
41 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/09/15/03/0101b0c3998752d02724a5512c6efcb241.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',  
42 - 'url' => '',  
43 - 'name' => 'Aape X YO’HOOD moon face YOH',  
44 - 'salePrice' => 99,  
45 - 'tags' => array(  
46 - 'is_yohoood' => true  
47 - ),  
48 - 'is_soon_sold_out' => true  
49 - )  
50 - ),  
51 - 'filter' => array(  
52 - array(  
53 - 'classify' => array(  
54 - array(  
55 - 'title' => '性别',  
56 - 'name' => '全部性别',  
57 - 'default' => true,  
58 - 'subs' => array(  
59 - array(  
60 - 'chosed' => true,  
61 - 'dataId' => 0,  
62 - 'name' => '全部性别'  
63 - ),  
64 - array(  
65 - 'dataId' => 1,  
66 - 'name' => '男'  
67 - ),  
68 - array(  
69 - 'dataId' => 3,  
70 - 'name' => '女'  
71 - )  
72 - )  
73 - ),  
74 - array(  
75 - 'title' => '尺寸',  
76 - 'name' => 'XL',  
77 - 'subs' => array(  
78 - array(  
79 - 'dataId' => 0,  
80 - 'name' => '全部尺寸'  
81 - ),  
82 - array(  
83 - 'dataId' => 1,  
84 - 'name' => 'S'  
85 - ),  
86 - array(  
87 - 'dataId' => 2,  
88 - 'name' => 'M'  
89 - ),  
90 - array(  
91 - 'dataId' => 3,  
92 - 'name' => 'L'  
93 - ),  
94 - array(  
95 - 'chosed' => true,  
96 - 'dataId' => 4,  
97 - 'name' => 'XL'  
98 - ),  
99 - array(  
100 - 'dataId' => 5,  
101 - 'name' => 'XXL'  
102 - )  
103 - )  
104 - )  
105 - )  
106 - ) 58 + 'id' => $brand
107 ) 59 )
108 ) 60 )
109 ); 61 );
110 62
  63 + // 获取品牌介绍信息
  64 + $introData = BrandData::getBrandIntro($brand);
  65 + if(isset($introData['code']) && $introData['code'] === 200)
  66 + {
  67 + $data['goodList']['brand']['intro'] = isset($introData['data']['brand_intro']) ? $introData['data']['brand_intro'] : '';
  68 + }
  69 +
  70 + // 获取品牌banner的数据
  71 + $bannerData = BrandData::getBrandBanner($brand, 0);
  72 + if(isset($bannerData['code']) && $bannerData['code'] === 200)
  73 + {
  74 + $data['goodList']['brand']['banner'] = isset($bannerData['data']['banner']) ? Helpers::getImageUrl($bannerData['data']['banner'], 640, 75) : '';
  75 + }
  76 +
  77 + // 查询数据
  78 + $listData = BrandData::selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d);
  79 + // 处理返回的数据
  80 + if (isset($listData['code']) && $listData['code'] === 200) {
  81 + $tmpData = $listData['data'];
  82 + // 设置品牌名称
  83 + $data['pageHeader']['navTitle'] = isset($tmpData['brand_name']) ? $tmpData['brand_name'] : '';
  84 +
  85 + $data['goodList'] += ListProcess::getListData($tmpData);
  86 + }
  87 +
111 $this->_view->display('index', $data); 88 $this->_view->display('index', $data);
112 } 89 }
113 -}  
  90 +
  91 +
  92 +}
@@ -16,8 +16,10 @@ class NewsaleController extends AbstractAction @@ -16,8 +16,10 @@ class NewsaleController extends AbstractAction
16 16
17 $data = array( 17 $data = array(
18 'newArrival' => true, 18 'newArrival' => true,
19 - 'header' => array(  
20 - 'title' => '新品到着' 19 + 'pageHeader' => array(
  20 + 'navBack' => true,
  21 + 'navTitle' => '新品到着',
  22 + 'navHome' => '/'
21 ) 23 )
22 ); 24 );
23 25
@@ -74,8 +76,10 @@ class NewsaleController extends AbstractAction @@ -74,8 +76,10 @@ class NewsaleController extends AbstractAction
74 76
75 $data = array( 77 $data = array(
76 'discount' => true, 78 'discount' => true,
77 - 'header' => array(  
78 - 'title' => 'SALE' 79 + 'pageHeader' => array(
  80 + 'navBack' => true,
  81 + 'navTitle' => 'SALE',
  82 + 'navHome' => '/'
79 ) 83 )
80 ); 84 );
81 85