Authored by Rock Zhang

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

Showing 67 changed files with 1781 additions and 825 deletions
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 +<meta charset="utf-8">
  5 +<title>找回密码-通过邮箱 | YOHO!有货</title>
  6 +<meta name="keywords" content="Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
  7 +<meta name="description" content="YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
  8 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  9 +<meta http-equiv="cleartype" content="on">
  10 +<meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11 +<meta content="telephone=no" name="format-detection" />
  12 +<meta content="email=no" name="format-detection" />
  13 +<script type="text/javascript">
  14 + (function(doc, win) {
  15 + var docEl = doc.documentElement;
  16 + (function() {
  17 + var clientWidth = docEl.clientWidth;
  18 + if (!clientWidth) {
  19 + return;
  20 + }
  21 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  22 + }());
  23 + })(document, window);
  24 +</script>
  25 +<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
  26 +</head>
  27 +<body class=passport-body>
  28 + <div class="back-email-page passport-page yoho-page">
  29 + <div class="header">
  30 + <a class="go-back" href=/signin.html></a>
  31 + <p class="title">找回密码</p>
  32 + </div> <div class="content">
  33 + <div class="input-container row has-clear">
  34 + <input id="email" class="input email" type="text" placeholder="请输入邮箱" autocomplete="off">
  35 + </div>
  36 + <span id="btn-sure" class="btn btn-sure disable row">确定</span>
  37 + </div>
  38 +</div>
  39 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
  40 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
  41 +<script>
  42 + seajs.use('js/common');
  43 +</script>
  44 +<script>
  45 + seajs.use('js/passport/back/email');
  46 +</script>
  47 +</body>
  48 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 +<meta charset="utf-8">
  5 +<title>国际账号登录 | YOHO!有货</title>
  6 +<meta name="keywords" content="Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
  7 +<meta name="description" content="YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
  8 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  9 +<meta http-equiv="cleartype" content="on">
  10 +<meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11 +<meta content="telephone=no" name="format-detection" />
  12 +<meta content="email=no" name="format-detection" />
  13 +<script type="text/javascript">
  14 + (function(doc, win) {
  15 + var docEl = doc.documentElement;
  16 + (function() {
  17 + var clientWidth = docEl.clientWidth;
  18 + if (!clientWidth) {
  19 + return;
  20 + }
  21 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  22 + }());
  23 + })(document, window);
  24 +</script>
  25 +<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
  26 +</head>
  27 +<body class=passport-body>
  28 + <div class="login-international-page passport-page yoho-page">
  29 + <div class="header">
  30 + <a class="go-back" href=/></a>
  31 + <p class="title">登录</p>
  32 + </div> <div class="content">
  33 + <div class="select-container row">
  34 + <span class="select-title">国家和地区</span>
  35 + <select id="country-select" class="country-select select in-android-uc">
  36 + <option value=+61 >澳大利亚</option>
  37 + <option value=+82 >韩国</option>
  38 + <option value=+1 >加拿大</option>
  39 + <option value=+60 >马来西亚</option>
  40 + <option value=+1 >美国</option>
  41 + <option value=+81 >日本</option>
  42 + <option value=+65 >新加坡</option>
  43 + <option value=+44 >英国</option>
  44 + <option value=+86 selected>中国</option>
  45 + <option value=+853 >中国澳门</option>
  46 + <option value=+886 >中国台湾</option>
  47 + <option value=+852 >中国香港</option>
  48 + </select>
  49 + <div class="arrow-right"></div>
  50 + </div> <div class="input-container phone-container row has-clear">
  51 + <span id="area-code" class="area-code">+86</span>
  52 + <input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value=>
  53 + </div>
  54 + <div class="input-container row has-eye">
  55 + <input id="pwd" class="pwd input" type="password" placeholder="密码">
  56 + </div>
  57 + <span id="btn-login" class="btn btn-login disble row">登录</span>
  58 + </div>
  59 +</div>
  60 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
  61 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
  62 +<script>
  63 + seajs.use('js/common');
  64 +</script>
  65 + <script>
  66 + seajs.use('js/passport/login/international');
  67 + </script>
  68 +</body>
  69 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 +<meta charset="utf-8">
  5 +<title>找回密码-通过手机号 | YOHO!有货</title>
  6 +<meta name="keywords" content="Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
  7 +<meta name="description" content="YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
  8 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  9 +<meta http-equiv="cleartype" content="on">
  10 +<meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11 +<meta content="telephone=no" name="format-detection" />
  12 +<meta content="email=no" name="format-detection" />
  13 +<script type="text/javascript">
  14 + (function(doc, win) {
  15 + var docEl = doc.documentElement;
  16 + (function() {
  17 + var clientWidth = docEl.clientWidth;
  18 + if (!clientWidth) {
  19 + return;
  20 + }
  21 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  22 + }());
  23 + })(document, window);
  24 +</script>
  25 +<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
  26 +</head>
  27 +<body class=passport-body>
  28 + <div class="back-mobile-page passport-page yoho-page">
  29 + <div class="header">
  30 + <a class="go-back" href=/signin.html></a>
  31 + <p class="title">找回密码</p>
  32 + </div> <div class="content">
  33 + <div class="select-container row">
  34 + <span class="select-title">国家和地区</span>
  35 + <select id="country-select" class="country-select select in-android-uc">
  36 + <option value=+61 >澳大利亚</option>
  37 + <option value=+82 >韩国</option>
  38 + <option value=+1 >加拿大</option>
  39 + <option value=+60 >马来西亚</option>
  40 + <option value=+1 >美国</option>
  41 + <option value=+81 >日本</option>
  42 + <option value=+65 >新加坡</option>
  43 + <option value=+44 >英国</option>
  44 + <option value=+86 selected>中国</option>
  45 + <option value=+853 >中国澳门</option>
  46 + <option value=+886 >中国台湾</option>
  47 + <option value=+852 >中国香港</option>
  48 + </select>
  49 + <div class="arrow-right"></div>
  50 + </div> <div class="input-container phone-container row has-clear">
  51 + <span id="area-code" class="area-code"></span>
  52 + <input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
  53 + </div>
  54 + <span id="btn-next" class="btn btn-next disable row">下一步</span>
  55 + </div>
  56 +</div>
  57 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
  58 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
  59 +<script>
  60 + seajs.use('js/common');
  61 +</script>
  62 +<script>
  63 + seajs.use('js/passport/back/mobile');
  64 +</script>
  65 +</body>
  66 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 +<meta charset="utf-8">
  5 +<title>注册 | YOHO!有货</title>
  6 +<meta name="keywords" content="Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
  7 +<meta name="description" content="YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
  8 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  9 +<meta http-equiv="cleartype" content="on">
  10 +<meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11 +<meta content="telephone=no" name="format-detection" />
  12 +<meta content="email=no" name="format-detection" />
  13 +<script type="text/javascript">
  14 + (function(doc, win) {
  15 + var docEl = doc.documentElement;
  16 + (function() {
  17 + var clientWidth = docEl.clientWidth;
  18 + if (!clientWidth) {
  19 + return;
  20 + }
  21 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  22 + }());
  23 + })(document, window);
  24 +</script>
  25 +<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
  26 +</head>
  27 +<body class=passport-body>
  28 + <div class="reg-page passport-page yoho-page">
  29 + <div class="header">
  30 + <a class="go-back" href=/></a>
  31 + <p class="title">注册</p>
  32 + </div> <div class="content">
  33 + <div class="select-container row">
  34 + <span class="select-title">国家和地区</span>
  35 + <select id="country-select" class="country-select select in-android-uc">
  36 + <option value=+61 >澳大利亚</option>
  37 + <option value=+82 >韩国</option>
  38 + <option value=+1 >加拿大</option>
  39 + <option value=+60 >马来西亚</option>
  40 + <option value=+1 >美国</option>
  41 + <option value=+81 >日本</option>
  42 + <option value=+65 >新加坡</option>
  43 + <option value=+44 >英国</option>
  44 + <option value=+86 selected>中国</option>
  45 + <option value=+853 >中国澳门</option>
  46 + <option value=+886 >中国台湾</option>
  47 + <option value=+852 >中国香港</option>
  48 + </select>
  49 + <div class="arrow-right"></div>
  50 + </div> <div class="input-container phone-container row has-clear">
  51 + <span id="area-code" class="area-code">+86</span>
  52 + <input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
  53 + </div>
  54 + <span id="btn-next" class="btn btn-next disable row">下一步</span>
  55 + <p class="register-tip">YOHO!Family账号可登录YOHO!有货、YOHO!Boys、YOHO!Girls及SHOW</p>
  56 + </div>
  57 +</div>
  58 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
  59 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
  60 +<script>
  61 + seajs.use('js/common');
  62 +</script>
  63 +<script>
  64 + seajs.use('js/passport/register/register');
  65 +</script>
  66 +</body>
  67 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 +<meta charset="utf-8">
  5 +<title>登录 | YOHO!有货</title>
  6 +<meta name="keywords" content="Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
  7 +<meta name="description" content="YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
  8 +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  9 +<meta http-equiv="cleartype" content="on">
  10 +<meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11 +<meta content="telephone=no" name="format-detection" />
  12 +<meta content="email=no" name="format-detection" />
  13 +<script type="text/javascript">
  14 + (function(doc, win) {
  15 + var docEl = doc.documentElement;
  16 + (function() {
  17 + var clientWidth = docEl.clientWidth;
  18 + if (!clientWidth) {
  19 + return;
  20 + }
  21 + docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  22 + }());
  23 + })(document, window);
  24 +</script>
  25 +<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.css">
  26 +</head>
  27 +<body class=passport-body>
  28 + <div class="login-page passport-page yoho-page">
  29 + <div class="header">
  30 + <a class="go-back" href=/></a>
  31 + <div class="img-header"></div>
  32 + </div> <div class="content">
  33 + <div class="acc-container input-container row has-clear">
  34 + <div class="yoho-logo"></div>
  35 + <input id="account" class="input account" type="text" placeholder="手机号/邮箱" autocomplete="off" value=>
  36 + </div>
  37 + <div class="input-container row has-eye">
  38 + <input id="pwd" class="pwd input" type="password" placeholder="密码">
  39 + </div>
  40 + <span id="btn-login" class="btn btn-login disable">登录</span>
  41 + <p class="op-container">
  42 + <a class="go-register" href=/reg.html>免费注册</a>
  43 + <span id="forget-pwd" class="forget-pwd">忘记密码</span>
  44 + </p>
  45 + <div class="third-party-login">
  46 + <span>其他登录方式</span>
  47 + <div class="tp-link">
  48 + <a class="alipay" href=/passport/login/alipay></a>
  49 + <a class="weibo" href=/passport/login/sina></a>
  50 + <a class="qq" href=/passport/login/qq></a>
  51 + </div>
  52 + </div>
  53 + <a class="international" href=/login.html>International Customer</a>
  54 + <div class="login-tip">
  55 + <div class="info-icon"></div>
  56 + Yoho!Family账号可登录YOHO!有货
  57 + </div>
  58 + <div id="retrive-pwd-mask" class="mask"></div>
  59 + <ul id="retrive-pwd-ways" class="retrive-pwd-ways">
  60 + <li>
  61 + <a href=/passport/back/mobile>通过手机找回密码</a>
  62 + </li>
  63 + <li>
  64 + <a href=/passport/back/email>通过邮箱找回密码</a>
  65 + </li>
  66 + <li id="cancel-retrive">
  67 + 取消
  68 + </li>
  69 + </ul>
  70 + </div>
  71 +</div>
  72 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/lib.js"></script>
  73 +<script src="http://static.buy.test.yoho.cn/dist/myohobuy/0.0.1/index.js"></script>
  74 +<script>
  75 + seajs.use('js/common');
  76 +</script>
  77 +<script>
  78 + seajs.use('js/passport/login/login');
  79 +</script>
  80 +</body>
  81 +</html>
@@ -56,7 +56,7 @@ conf/vhosts,nginx注册表文件,restart-nginx.bat, start-nginx.bat, start-php5. @@ -56,7 +56,7 @@ conf/vhosts,nginx注册表文件,restart-nginx.bat, start-nginx.bat, start-php5.
56 127.0.0.1 static.m.dev.yohobuy.com 56 127.0.0.1 static.m.dev.yohobuy.com
57 57
58 ### 最后一步 58 ### 最后一步
59 -进入yohobuy/static目录,运行npm install 和 spm install安装下依赖, 成功后在当前目录运行`gulp`启动开发环境服务...看看[m.dev.yohobuy.com](m.dev.yohobuy.com)有没有反应? 59 +进入yohobuy/static目录,运行npm install 和 spm install(需要先`spm config set registry http://spm.yoho.cn`将源指定到我们自己的包仓库)安装下依赖, 成功后在当前目录运行`gulp`启动开发环境服务...看看[m.dev.yohobuy.com](m.dev.yohobuy.com)有没有反应?
60 60
61 Done ? 'congratulations' : '看看是不是缺了什么,不能解决的时候再问问其他人看看' 61 Done ? 'congratulations' : '看看是不是缺了什么,不能解决的时候再问问其他人看看'
62 62
framework @ 119c247f
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
@@ -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 }
@@ -44,7 +44,7 @@ class BrandData @@ -44,7 +44,7 @@ class BrandData
44 $param['method'] = 'app.brand.brandlist'; 44 $param['method'] = 'app.brand.brandlist';
45 $param['yh_channel'] = $channel; 45 $param['yh_channel'] = $channel;
46 $param['client_secret'] = Sign::getSign($param); 46 $param['client_secret'] = Sign::getSign($param);
47 - $urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); 47 + $urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param, 3600); // 有缓存1小时
48 48
49 return Yohobuy::getMulti($urlList); 49 return Yohobuy::getMulti($urlList);
50 } 50 }
@@ -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,53 @@ class Helpers @@ -29,13 +59,53 @@ 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, OLD_MAIN => SITE_MAIN));
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 + }
  87 +
  88 + /**
  89 + * 根据用户访问的COOKIE判断出频道
  90 + *
  91 + * @return int
  92 + */
  93 + public static function getChannelByCookie()
  94 + {
  95 + $cookie = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
  96 + switch (strval($cookie)) {
  97 + case 'boys': // 男
  98 + return 1;
  99 + case 'girls': // 女
  100 + return 2;
  101 + case 'kids': // 潮童
  102 + return 3;
  103 + case 'lifestyle': // 创意生活
  104 + return 4;
  105 + default: // 其它
  106 + return 1;
  107 + }
  108 + }
39 109
40 /** 110 /**
41 * 格式化商品信息 111 * 格式化商品信息
@@ -95,11 +165,11 @@ class Helpers @@ -95,11 +165,11 @@ class Helpers
95 * 165 *
96 * @param array $articleData 需要格式化的资讯数据 166 * @param array $articleData 需要格式化的资讯数据
97 * @param bool $showTag 是否显示左上角标签 167 * @param bool $showTag 是否显示左上角标签
98 - * @param mixed $share 是否显示分享,在APP客户端里嵌入需要传url链接 168 + * @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接
99 * @param bool $showAuthor 控制是否显示作者信息 169 * @param bool $showAuthor 控制是否显示作者信息
100 * @return array | false 170 * @return array | false
101 */ 171 */
102 - public static function formatArticle($articleData, $showTag = true, $share = false, $showAuthor = true) 172 + public static function formatArticle($articleData, $showTag = true, $isApp = false, $showAuthor = true)
103 { 173 {
104 // 资讯ID不存在,则不显示 174 // 资讯ID不存在,则不显示
105 if (!isset($articleData['id'])) { 175 if (!isset($articleData['id'])) {
@@ -110,7 +180,7 @@ class Helpers @@ -110,7 +180,7 @@ class Helpers
110 $result['id'] = $articleData['id']; 180 $result['id'] = $articleData['id'];
111 $result['showTags'] = $showTag; 181 $result['showTags'] = $showTag;
112 $result['img'] = self::getImageUrl($articleData['src'], 640, 640); 182 $result['img'] = self::getImageUrl($articleData['src'], 640, 640);
113 - $result['url'] = '/guang/detail/index?id=' . $articleData['id']; // @todo 183 + $result['url'] = $isApp && !empty($articleData['url']) ? $articleData['url'] : '/info/index?id=' . $articleData['id'];
114 $result['title'] = $articleData['title']; 184 $result['title'] = $articleData['title'];
115 $result['text'] = $articleData['intro']; 185 $result['text'] = $articleData['intro'];
116 $result['publishTime'] = $articleData['publish_time']; 186 $result['publishTime'] = $articleData['publish_time'];
@@ -121,7 +191,7 @@ class Helpers @@ -121,7 +191,7 @@ class Helpers
121 // 收藏 191 // 收藏
122 // $result['collect'] = array(); 192 // $result['collect'] = array();
123 // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; 193 // $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y';
124 - $result['share'] = $share; 194 + $result['share'] = $isApp && isset($articleData['share']['url']) ? $articleData['share']['url'] : false;
125 195
126 // 判断是否显示作者信息 196 // 判断是否显示作者信息
127 if ($showAuthor) { 197 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;
@@ -22,6 +22,37 @@ function cookie(name) { @@ -22,6 +22,37 @@ function cookie(name) {
22 return cookieVal; 22 return cookieVal;
23 } 23 }
24 24
  25 +function setCookie(name, value, options) {
  26 + var expires = '',
  27 + path,
  28 + domain,
  29 + secure,
  30 + date;
  31 +
  32 + if (typeof value !== 'undefined') {
  33 + options = options || {};
  34 + if (value === null) {
  35 + value = '';
  36 + options.expires = -1;
  37 + }
  38 +
  39 + if (options.expires &&
  40 + (typeof options.expires === 'number' || options.expires.toUTCString)) {
  41 + if (typeof options.expires === 'number') {
  42 + date = new Date();
  43 + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
  44 + } else {
  45 + date = options.expires;
  46 + }
  47 + expires = '; expires=' + date.toUTCString();
  48 + }
  49 + path = options.path ? '; path=' + options.path : '';
  50 + domain = options.domain ? '; domain=' + options.domain : '';
  51 + secure = options.secure ? '; secure' : '';
  52 + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
  53 + }
  54 +}
  55 +
25 function getUser() { 56 function getUser() {
26 var c = cookie('_UID'), 57 var c = cookie('_UID'),
27 user; 58 user;
@@ -60,7 +91,7 @@ function getShoppingKey() { @@ -60,7 +91,7 @@ function getShoppingKey() {
60 } 91 }
61 92
62 //页面通用底部位置及status设置 93 //页面通用底部位置及status设置
63 -(function() { 94 +(function () {
64 var $footer = $('#yoho-footer'), 95 var $footer = $('#yoho-footer'),
65 $op = $footer.children('.op-row'); 96 $op = $footer.children('.op-row');
66 97
@@ -94,8 +125,10 @@ function getShoppingKey() { @@ -94,8 +125,10 @@ function getShoppingKey() {
94 //暴露公共接口 125 //暴露公共接口
95 window.cookie = cookie; 126 window.cookie = cookie;
96 127
  128 +window.setCookie = setCookie;
  129 +
97 window.getUser = getUser; 130 window.getUser = getUser;
98 131
99 window.getUid = getUid; 132 window.getUid = getUid;
100 133
101 -window.getShoppingKey = getShoppingKey;  
  134 +window.getShoppingKey = getShoppingKey;
@@ -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 === ' ') {
@@ -28,7 +28,7 @@ lazyLoad($('img.lazy')); @@ -28,7 +28,7 @@ lazyLoad($('img.lazy'));
28 //$('img:in-viewport').trigger('appear'); 28 //$('img:in-viewport').trigger('appear');
29 29
30 //点击首页汉堡menu图标,滑出侧栏导航 30 //点击首页汉堡menu图标,滑出侧栏导航
31 -$('.nav-btn').on('click', function (event) { 31 +$('.nav-btn').on('tap', function (event) {
32 if (!$(this).hasClass('menu-open')) { 32 if (!$(this).hasClass('menu-open')) {
33 $('.mobile-wrap').addClass('menu-open'); 33 $('.mobile-wrap').addClass('menu-open');
34 $('.overlay').addClass('show'); 34 $('.overlay').addClass('show');
@@ -45,7 +45,7 @@ $('.nav-btn').on('click', function (event) { @@ -45,7 +45,7 @@ $('.nav-btn').on('click', function (event) {
45 }); 45 });
46 46
47 //点击页面主体,收起侧栏导航及二级导航 47 //点击页面主体,收起侧栏导航及二级导航
48 -$('.mobile-wrap').on('click', function () { 48 +$('.mobile-wrap').on('tap', function () {
49 if ($(this).hasClass('menu-open')) { 49 if ($(this).hasClass('menu-open')) {
50 $('.mobile-wrap').removeClass('menu-open'); 50 $('.mobile-wrap').removeClass('menu-open');
51 $('.overlay').removeClass('show'); 51 $('.overlay').removeClass('show');
@@ -59,7 +59,7 @@ $('.mobile-wrap').on('click', function () { @@ -59,7 +59,7 @@ $('.mobile-wrap').on('click', function () {
59 }); 59 });
60 60
61 //点击一级导航,弹出二级导航 61 //点击一级导航,弹出二级导航
62 -$('.side-nav').on('click', 'li', function () { 62 +$('.side-nav').on('tap', 'li', function () {
63 if ($(this).find('.sub-nav').size() > 0) { 63 if ($(this).find('.sub-nav').size() > 0) {
64 $('.sub-nav').removeClass('show'); 64 $('.sub-nav').removeClass('show');
65 $(this).find('.sub-nav').addClass('show'); 65 $(this).find('.sub-nav').addClass('show');
@@ -68,7 +68,7 @@ $('.side-nav').on('click', 'li', function () { @@ -68,7 +68,7 @@ $('.side-nav').on('click', 'li', function () {
68 68
69 //返回一级导航,收起二级导航 69 //返回一级导航,收起二级导航
70 $('.sub-nav').each(function () { 70 $('.sub-nav').each(function () {
71 - $(this).find('li').eq(0).on('click', function (e) { 71 + $(this).find('li').eq(0).on('tap', function (e) {
72 $('.sub-nav').removeClass('show'); 72 $('.sub-nav').removeClass('show');
73 e.stopPropagation(); 73 e.stopPropagation();
74 }); 74 });
@@ -84,6 +84,7 @@ $('.sub-nav').on('mouseenter', 'li', function () { @@ -84,6 +84,7 @@ $('.sub-nav').on('mouseenter', 'li', function () {
84 //头部banner轮播 84 //头部banner轮播
85 if ($('.banner-swiper').find('li').size() > 1) { 85 if ($('.banner-swiper').find('li').size() > 1) {
86 bannerSwiper = new Swiper('.banner-swiper', { 86 bannerSwiper = new Swiper('.banner-swiper', {
  87 + lazyLoading: true,
87 loop: true, 88 loop: true,
88 autoplay: 3000, 89 autoplay: 3000,
89 autoplayDisableOnInteraction: false, 90 autoplayDisableOnInteraction: false,
@@ -137,15 +138,8 @@ $('.category-swiper').each(function (i, index) { @@ -137,15 +138,8 @@ $('.category-swiper').each(function (i, index) {
137 } 138 }
138 }); 139 });
139 140
140 -  
141 -//回到顶部  
142 -// $('.back-to-top').bind('touchstart', function (e) {  
143 -// e.preventDefault();  
144 -// $(window).scrollTop(0);  
145 -// });  
146 -  
147 //关闭头部下载浮层 141 //关闭头部下载浮层
148 -$('.header-download').on('click', '.close-btn', function () { 142 +$('.header-download').on('tap', '.close-btn', function () {
149 $(this).parent().remove(); 143 $(this).parent().remove();
150 }); 144 });
151 145
@@ -34,7 +34,7 @@ if (kidsType) { @@ -34,7 +34,7 @@ if (kidsType) {
34 34
35 $curNav = $navList.children('.focus'); 35 $curNav = $navList.children('.focus');
36 36
37 -$('#maybe-like-nav').delegate('li', 'touchstart', function() { 37 +$('#maybe-like-nav').delegate('li', 'tap', function() {
38 var $this = $(this), 38 var $this = $(this),
39 $goods = $('.goods-list'), 39 $goods = $('.goods-list'),
40 $content; 40 $content;
  1 +/**
  2 + * 底部JS
  3 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  4 + * @date: 2015/10/26
  5 + */
  6 +
  7 +var $ = require('yoho.zepto');
  8 +
  9 +function downLoadApp() {
  10 + var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
  11 + var clickedAt = new Date();
  12 +
  13 + setTimeout(function () {
  14 + if ((new Date()) - clickedAt < 2000) {
  15 + window.location = appUrl;
  16 + }
  17 + }, 500);
  18 +}
  19 +
  20 +$('#float-layer-close').bind('tap', function () {
  21 + $('#float-layer-app').hide();
  22 + window.setCookie('_float-layer-app', 'id490655927',
  23 + {
  24 + domain: '.yohobuy.com'
  25 + });
  26 + window.setCookie('_float-layer-app-close', 1,
  27 + {
  28 + domain: '.yohobuy.com',
  29 + expires: 1
  30 + });
  31 +});
  32 +
  33 +$('#float-layer-btn').tap(function () {
  34 + downLoadApp('bottom');
  35 +});
  36 +
  37 +if (!window.cookie('_float-layer-app')) {
  38 + $('#float-layer-app').show();
  39 +} else {
  40 + $('#float-layer-app').hide();
  41 +}
  42 +
@@ -5,4 +5,5 @@ @@ -5,4 +5,5 @@
5 */ 5 */
6 6
7 require('./search'); 7 require('./search');
8 -require('./channel');  
  8 +require('./channel');
  9 +require('./footer');
@@ -26,7 +26,7 @@ $pwd.bind('input', function() { @@ -26,7 +26,7 @@ $pwd.bind('input', function() {
26 } 26 }
27 }); 27 });
28 28
29 -$btnOk.on('touchstart', function() { 29 +$btnOk.on('tap', function() {
30 var pwd = trim($pwd.val()), 30 var pwd = trim($pwd.val()),
31 mobileBack = true, 31 mobileBack = true,
32 setting, 32 setting,
@@ -54,7 +54,7 @@ var $listNav = $('#list-nav'), @@ -54,7 +54,7 @@ var $listNav = $('#list-nav'),
54 end: false 54 end: false
55 } 55 }
56 }, 56 },
57 - $pre, //纪录进入筛选前的active 57 + $pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中
58 searching; 58 searching;
59 59
60 /** 60 /**
@@ -59,6 +59,10 @@ var $listNav = $('#list-nav'), @@ -59,6 +59,10 @@ var $listNav = $('#list-nav'),
59 if ($('.swiper-container .swiper-slide').length > 1) { 59 if ($('.swiper-container .swiper-slide').length > 1) {
60 swiper = new Swiper('.swiper-container', { 60 swiper = new Swiper('.swiper-container', {
61 lazyLoading: true, 61 lazyLoading: true,
  62 + loop: true,
  63 + autoplay: 3000,
  64 + autoplayDisableOnInteraction: false,
  65 + paginationClickable: true,
62 pagination: '.swiper-pagination' 66 pagination: '.swiper-pagination'
63 }); 67 });
64 } 68 }
@@ -216,7 +220,7 @@ filter.registerCbFn(search); @@ -216,7 +220,7 @@ filter.registerCbFn(search);
216 //3.筛选无active时点击展开筛选面板 220 //3.筛选无active时点击展开筛选面板
217 //4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态 221 //4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
218 //5.当前active为筛选并且点击其他项时,隐藏筛选面板 222 //5.当前active为筛选并且点击其他项时,隐藏筛选面板
219 -$listNav.delegate('li', 'touchstart', function() { 223 +$listNav.delegate('li', 'tap', function() {
220 var $this = $(this), 224 var $this = $(this),
221 nav, 225 nav,
222 navType, 226 navType,
@@ -33,6 +33,10 @@ var defaultOpt = { @@ -33,6 +33,10 @@ var defaultOpt = {
33 p_d: $('#p_d').val() 33 p_d: $('#p_d').val()
34 }; 34 };
35 35
  36 +var now = new Date(),
  37 + month = now.getMonth() + 1,
  38 + date = now.getDate();
  39 +
36 var $listNav = $('#list-nav'), 40 var $listNav = $('#list-nav'),
37 41
38 //导航数据信息 42 //导航数据信息
@@ -59,9 +63,15 @@ var $listNav = $('#list-nav'), @@ -59,9 +63,15 @@ var $listNav = $('#list-nav'),
59 $pgc.addClass('hide'); 63 $pgc.addClass('hide');
60 $dgc.addClass('hide'); 64 $dgc.addClass('hide');
61 65
  66 +$('#today a').text(month + '月' + date + '号');
  67 +
62 if ($('.swiper-container .swiper-slide').length > 1) { 68 if ($('.swiper-container .swiper-slide').length > 1) {
63 swiper = new Swiper('.swiper-container', { 69 swiper = new Swiper('.swiper-container', {
64 lazyLoading: true, 70 lazyLoading: true,
  71 + loop: true,
  72 + autoplay: 3000,
  73 + autoplayDisableOnInteraction: false,
  74 + paginationClickable: true,
65 pagination: '.swiper-pagination' 75 pagination: '.swiper-pagination'
66 }); 76 });
67 } 77 }
@@ -237,7 +247,7 @@ filter.registerCbFn(search); @@ -237,7 +247,7 @@ filter.registerCbFn(search);
237 //3.筛选无active时点击展开筛选面板 247 //3.筛选无active时点击展开筛选面板
238 //4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态 248 //4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
239 //5.当前active为筛选并且点击其他项时,隐藏筛选面板 249 //5.当前active为筛选并且点击其他项时,隐藏筛选面板
240 -$listNav.delegate('li', 'touchstart', function() { 250 +$listNav.delegate('li', 'tap', function() {
241 var $this = $(this), 251 var $this = $(this),
242 nav, 252 nav,
243 navType, 253 navType,
@@ -273,7 +283,7 @@ $listNav.delegate('li', 'touchstart', function() { @@ -273,7 +283,7 @@ $listNav.delegate('li', 'touchstart', function() {
273 nav = navInfo[navType]; 283 nav = navInfo[navType];
274 284
275 if (!($this.hasClass('active'))) { 285 if (!($this.hasClass('active'))) {
276 - 286 +
277 $active = $this.siblings('.active'); 287 $active = $this.siblings('.active');
278 288
279 $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项 289 $pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
  1 +.float-layer {
  2 + height: 44px;
  3 + background: rgba(68, 68, 68, 0.95);
  4 + position: fixed;
  5 + width: 100%;
  6 + bottom: 0;
  7 + left: 0;
  8 + z-index: 9999;
  9 + padding: 10px 0;
  10 +
  11 + .float-layer-left {
  12 + padding-left: 22px;
  13 + overflow: hidden;
  14 + float: left;
  15 +
  16 + img {
  17 + height: 44px;
  18 + float: left;
  19 + margin-right: 10px;
  20 + }
  21 +
  22 + p {
  23 + float: left;
  24 + font-size: 16px;
  25 + height: 44px;
  26 + line-height: 44px;
  27 + color: white;
  28 + }
  29 + }
  30 +
  31 +}
  32 +
  33 +#float-layer-close {
  34 + position: absolute;
  35 + left: 0;
  36 + top: 0;
  37 + width: 50px;
  38 + height: 50px;
  39 +}
  40 +
  41 +#float-layer-btn {
  42 + position: absolute;
  43 + top: 50%;
  44 + right: 15px;
  45 + font-size: 16px;
  46 + padding: 0 10px;
  47 + height: 27px;
  48 + line-height: 27px;
  49 + background: white;
  50 + border-radius: 5px;
  51 + margin-top: -13px;
  52 + -webkit-tap-highlight-color: rgba(0, 0, 0, 0.5);
  53 +}
@@ -39,5 +39,5 @@ @@ -39,5 +39,5 @@
39 39
40 } 40 }
41 41
42 -@import "search"; 42 +@import "search","footer";
43 43
@@ -38,4 +38,5 @@ @@ -38,4 +38,5 @@
38 width: 100%; 38 width: 100%;
39 bottom: 0; 39 bottom: 0;
40 } 40 }
  41 +
41 } 42 }
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="mobile-wrap boys-wrap yoho-page"> 2 <div class="mobile-wrap boys-wrap yoho-page">
3 -  
4 - {{# headerDownload}}  
5 - {{> home/header_download}}  
6 - {{/ headerDownload}}  
7 -  
8 {{! 首页header}} 3 {{! 首页header}}
9 {{# homeHeader}} 4 {{# homeHeader}}
10 {{> home/home_header}} 5 {{> home/home_header}}
@@ -20,4 +15,5 @@ @@ -20,4 +15,5 @@
20 <div class="overlay"></div> 15 <div class="overlay"></div>
21 </div> 16 </div>
22 {{> home/side_nav}} 17 {{> home/side_nav}}
23 -{{> layout/footer}}  
  18 +{{> layout/footer}}
  19 +{{> layout/download_app}}
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="mobile-wrap girls-wrap yoho-page"> 2 <div class="mobile-wrap girls-wrap yoho-page">
3 -  
4 - {{# headerDownload}}  
5 - {{> home/header_download}}  
6 - {{/ headerDownload}}  
7 -  
8 - {{! 首页header}} 3 + {{! 首页header}}
9 {{# homeHeader}} 4 {{# homeHeader}}
10 {{> home/home_header}} 5 {{> home/home_header}}
11 {{/ homeHeader}} 6 {{/ homeHeader}}
@@ -14,5 +9,6 @@ @@ -14,5 +9,6 @@
14 9
15 <div class="overlay"></div> 10 <div class="overlay"></div>
16 </div> 11 </div>
17 - {{> home/side_nav}}  
18 -{{> layout/footer}}  
  12 + {{> home/side_nav}}
  13 +{{> layout/footer}}
  14 +{{> layout/download_app}}
@@ -16,4 +16,5 @@ @@ -16,4 +16,5 @@
16 </div> 16 </div>
17 </div> 17 </div>
18 18
19 -{{>layout/footer}}  
  19 +{{>layout/footer}}
  20 +{{> layout/download_app}}
1 {{> layout/header}} 1 {{> layout/header}}
2 2
3 <div class="mobile-wrap kids-wrap yoho-page"> 3 <div class="mobile-wrap kids-wrap yoho-page">
4 - {{! app下载}}  
5 - {{# headerDownload}}  
6 - {{> home/header_download}}  
7 - {{/ headerDownload}}  
8 -  
9 {{! 首页header}} 4 {{! 首页header}}
10 {{# homeHeader}} 5 {{# homeHeader}}
11 {{> home/home_header}} 6 {{> home/home_header}}
@@ -26,4 +21,5 @@ @@ -26,4 +21,5 @@
26 <div class="overlay"></div> 21 <div class="overlay"></div>
27 </div> 22 </div>
28 {{> home/side_nav}} 23 {{> home/side_nav}}
29 -{{> layout/footer}}  
  24 +{{> layout/footer}}
  25 +{{> layout/download_app}}
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="mobile-wrap lifestyle-wrap yoho-page"> 2 <div class="mobile-wrap lifestyle-wrap yoho-page">
3 - {{! app下载}}  
4 - {{# headerDownload}}  
5 - {{> home/header_download}}  
6 - {{/ headerDownload}}  
7 -  
8 {{! 首页header}} 3 {{! 首页header}}
9 {{# homeHeader}} 4 {{# homeHeader}}
10 {{> home/home_header}} 5 {{> home/home_header}}
@@ -24,4 +19,5 @@ @@ -24,4 +19,5 @@
24 <div class="overlay"></div> 19 <div class="overlay"></div>
25 </div> 20 </div>
26 {{> home/side_nav}} 21 {{> home/side_nav}}
27 -{{> layout/footer}}  
  22 +{{> layout/footer}}
  23 +{{> layout/download_app}}
  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">&#xe60f;</i>
  8 + <input type="text" value={{default}} name="query">
  9 + <i class="clear-input iconfont hide">&#xe61a;</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">&#xe614;</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">&#xe622;</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">&#xe623;</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">&#xe616;</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">&#xe615;</i>
  66 + <i class="iconfont down cur">&#xe616;</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">&#xe615;</i>
  75 + <i class="iconfont down cur">&#xe616;</i>
  76 + </span>
  77 + </a>
  78 + </li>
  79 + <li class="filter">
  80 + <a href="javascript:void(0);">
  81 + 筛选
  82 + <span class="iconfont">&#xe613;</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}}
@@ -5,9 +5,8 @@ @@ -5,9 +5,8 @@
5 {{/ headerBanner}} 5 {{/ headerBanner}}
6 6
7 <ul id="list-nav" class="list-nav clearfix"> 7 <ul id="list-nav" class="list-nav clearfix">
8 - <li class="today active">  
9 - <a href="javascript:void(0);">  
10 - 1026 8 + <li id="today" class="today active">
  9 + <a href="javascript:void(0);">
11 </a> 10 </a>
12 </li> 11 </li>
13 <li class="week"> 12 <li class="week">
  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">&#xe60f;</i>
  8 + <input type="text" value={{default}} name="query">
  9 + <i class="clear-input iconfont hide">&#xe61a;</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">&#xe614;</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">&#xe622;</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">&#xe623;</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">&#xe616;</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">&#xe615;</i>
  66 + <i class="iconfont down cur">&#xe616;</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">&#xe615;</i>
  75 + <i class="iconfont down cur">&#xe616;</i>
  76 + </span>
  77 + </a>
  78 + </li>
  79 + <li class="filter">
  80 + <a href="javascript:void(0);">
  81 + 筛选
  82 + <span class="iconfont">&#xe613;</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 +{{# new}}
  2 + {{> good}}
  3 +{{/ new}}
@@ -4,8 +4,9 @@ @@ -4,8 +4,9 @@
4 {{# list}} 4 {{# list}}
5 <li class="swiper-slide"> 5 <li class="swiper-slide">
6 <a href="{{url}}"> 6 <a href="{{url}}">
7 - <img src="{{img}}" alt=""> 7 + <img class="swiper-lazy" data-src="{{img}}">
8 </a> 8 </a>
  9 + <div class="swiper-lazy-preloader"></div>
9 </li> 10 </li>
10 {{/ list}} 11 {{/ list}}
11 </ul> 12 </ul>
  1 +{{#showDownloadApp}}
  2 +<div class="float-layer hide" id="float-layer-app">
  3 + <div class="float-layer-left">
  4 + <img src="http://static.yohobuy.com/m/v1/img/yohobuy_new.png" alt="">
  5 + <p>新用户首单减10元</p>
  6 + </div>
  7 + <a href="javascript:void(0);" id="float-layer-close" >
  8 + <img src="http://static.yohobuy.com/m/v1/img/close_new.png" width="22">
  9 + </a>
  10 + <a href="http://m.yohobuy.com/download/hyapp" id="float-layer-btn">
  11 + 立即下载
  12 + </a>
  13 +</div>
  14 +{{/showDownloadApp}}
  15 +
  16 +
  17 +
@@ -10,4 +10,6 @@ @@ -10,4 +10,6 @@
10 CopyRight©2007-2016 南京新与力文化传播有限公司 10 CopyRight©2007-2016 南京新与力文化传播有限公司
11 </address> 11 </address>
12 </footer> 12 </footer>
13 -{{/pageFooter}}  
  13 +{{/pageFooter}}
  14 +
  15 +
@@ -85,25 +85,36 @@ @@ -85,25 +85,36 @@
85 </script> 85 </script>
86 {{/if}} 86 {{/if}}
87 87
  88 +{{!-- 频道选择页 --}}
  89 +{{#if channelPage}}
  90 +<script>
  91 + seajs.use('js/index/footer');
  92 +</script>
  93 +{{/if}}
  94 +
88 {{!-- 首页 --}} 95 {{!-- 首页 --}}
89 {{#if grilsHomePage}} 96 {{#if grilsHomePage}}
90 <script> 97 <script>
91 seajs.use('js/home/home'); 98 seajs.use('js/home/home');
  99 + seajs.use('js/index/footer');
92 </script> 100 </script>
93 {{/if}} 101 {{/if}}
94 {{#if boysHomePage}} 102 {{#if boysHomePage}}
95 <script> 103 <script>
96 seajs.use('js/home/home'); 104 seajs.use('js/home/home');
  105 + seajs.use('js/index/footer');
97 </script> 106 </script>
98 {{/if}} 107 {{/if}}
99 {{#if kidsHomePage}} 108 {{#if kidsHomePage}}
100 <script> 109 <script>
101 seajs.use('js/home/home'); 110 seajs.use('js/home/home');
  111 + seajs.use('js/index/footer');
102 </script> 112 </script>
103 {{/if}} 113 {{/if}}
104 {{#if lifestyleHomePage}} 114 {{#if lifestyleHomePage}}
105 <script> 115 <script>
106 seajs.use('js/home/home'); 116 seajs.use('js/home/home');
  117 + seajs.use('js/index/footer');
107 </script> 118 </script>
108 {{/if}} 119 {{/if}}
109 120
@@ -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,9 +64,51 @@ class Bootstrap extends Bootstrap_Abstract @@ -64,9 +64,51 @@ class Bootstrap extends Bootstrap_Abstract
64 */ 64 */
65 public function _initRoute(Dispatcher $dispatcher) 65 public function _initRoute(Dispatcher $dispatcher)
66 { 66 {
67 - $config = new Config\Ini(APPLICATION_PATH . '/configs/routes.ini');  
68 - if (isset($config->routes)) {  
69 - $dispatcher->getRouter()->addConfig($config->routes); 67 + $hostParts = explode('.', $dispatcher->getRequest()->getServer('HTTP_HOST', ''));
  68 + $level = count($hostParts) - 1;
  69 +
  70 + /* 根据域名的级别,设置默认的模块、控制器、方法 */
  71 + $module = 'Index';
  72 + $controller = 'Index';
  73 + $action = 'Index';
  74 + // 三级域名
  75 + if (3 === $level) {
  76 + $subDomain = strval($hostParts[0]);
  77 + switch (strtolower($subDomain)) {
  78 + case 'm': // 老版(到频道选择)
  79 + case 'buy': // 测试环境的域名, 以后可去掉
  80 + break;
  81 + case 'new': // 原新版(到男生首页)
  82 + $controller = 'Boys';
  83 + break;
  84 + case 'search': // 搜索
  85 + $controller = 'Search';
  86 + $action = 'List';
  87 + break;
  88 + case 'guang': // 逛
  89 + $module = 'Guang';
  90 + break;
  91 + case 'list': // 商品列表
  92 + $module = 'Product';
  93 + break;
  94 + default: // 其它(识别为品牌)
  95 + $module = 'Product';
  96 + $action = 'Brand';
  97 + $dispatcher->getRequest()->setParam('named', $subDomain);
  98 + break;
  99 + }
  100 + }
  101 + $dispatcher->getRequest()->module = $module;
  102 + $dispatcher->getRequest()->controller = $controller;
  103 + $dispatcher->getRequest()->action = $action;
  104 +
  105 + /* 根据对应模块的配置,添加相应的路由规则 */
  106 + $iniFile = APPLICATION_PATH . '/configs/routes.' . strtolower($module) . '.ini';
  107 + if (file_exists($iniFile)) {
  108 + $config = new Config\Ini($iniFile);
  109 + if (isset($config->routes)) {
  110 + $dispatcher->getRouter()->addConfig($config->routes);
  111 + }
70 } 112 }
71 } 113 }
72 114
@@ -78,15 +120,15 @@ class Bootstrap extends Bootstrap_Abstract @@ -78,15 +120,15 @@ class Bootstrap extends Bootstrap_Abstract
78 { 120 {
79 // 关闭自动渲染模板 121 // 关闭自动渲染模板
80 $dispatcher->autoRender(false); 122 $dispatcher->autoRender(false);
81 - 123 +
82 // 判断到不是AJAX请求时, 使用自定义的模板渲染 (Mustache or Handlebars) 124 // 判断到不是AJAX请求时, 使用自定义的模板渲染 (Mustache or Handlebars)
83 //if (!$dispatcher->getRequest()->isXmlHttpRequest()) { 125 //if (!$dispatcher->getRequest()->isXmlHttpRequest()) {
84 - $layout = new TemplateLayout();  
85 - $layout->setScriptPath($this->_config->application->template->path);  
86 - $dispatcher->setView($layout); 126 + $layout = new TemplateLayout();
  127 + $layout->setScriptPath($this->_config->application->template->path);
  128 + $dispatcher->setView($layout);
87 //} 129 //}
88 } 130 }
89 - 131 +
90 // /** 132 // /**
91 // * 初始化第三方包 133 // * 初始化第三方包
92 // * @param Dispatcher $dispatcher 134 // * @param Dispatcher $dispatcher
@@ -97,5 +139,4 @@ class Bootstrap extends Bootstrap_Abstract @@ -97,5 +139,4 @@ class Bootstrap extends Bootstrap_Abstract
97 // require $this->_config->composer->path . '/vendor/autoload.php'; 139 // require $this->_config->composer->path . '/vendor/autoload.php';
98 // } 140 // }
99 // } 141 // }
100 -  
101 } 142 }
@@ -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 /**
@@ -53,6 +53,9 @@ class BrandModel @@ -53,6 +53,9 @@ class BrandModel
53 break; 53 break;
54 } 54 }
55 55
  56 + // 模板中的使用JS标识
  57 + $result['brandPage'] = true;
  58 +
56 /* 顶部的轮翻广告列表 */ 59 /* 顶部的轮翻广告列表 */
57 if (!empty($brand['brandTop'][0]['data'])) { 60 if (!empty($brand['brandTop'][0]['data'])) {
58 $build = array(); 61 $build = array();
@@ -86,7 +89,7 @@ class BrandModel @@ -86,7 +89,7 @@ class BrandModel
86 $list['name'] = $row['brand_name']; 89 $list['name'] = $row['brand_name'];
87 $list['isHot'] = ($row['is_hot'] === 'Y') ? true : false; 90 $list['isHot'] = ($row['is_hot'] === 'Y') ? true : false;
88 $list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false; 91 $list['isNew'] = ($row['is_show_new'] === 'Y') ? true : false;
89 - $list['url'] = 'http://' . $row['brand_domain'] . '.' . OLD_DOMAIN; 92 + $list['url'] = 'http://' . $row['brand_domain'] . SUB_DOMAIN;
90 $build['list'][] = $list; 93 $build['list'][] = $list;
91 } 94 }
92 $result['brandList'][] = $build; 95 $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,11 @@ class ClassModel @@ -66,8 +63,11 @@ 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'] = Helpers::url('/', array(
  67 + 'sort' => $value['relation_parameter']['sort'],
  68 + 'sort_name' => $value['category_name']
  69 + ), 'list');
  70 +
71 $item['sub'][] = $subitem; 71 $item['sub'][] = $subitem;
72 } 72 }
73 73
@@ -88,13 +88,11 @@ class ClassModel @@ -88,13 +88,11 @@ class ClassModel
88 Cache::set(CacheConfig::KEY_CATEGORY_CLASSES_DATA, $classes); 88 Cache::set(CacheConfig::KEY_CATEGORY_CLASSES_DATA, $classes);
89 } 89 }
90 } 90 }
91 -  
92 - }while(false); 91 + } while (false);
93 92
94 return $classes; 93 return $classes;
95 } 94 }
96 95
97 -  
98 /** 96 /**
99 * 返回品类构成的数组 97 * 返回品类构成的数组
100 * 98 *
@@ -115,12 +113,12 @@ class ClassModel @@ -115,12 +113,12 @@ class ClassModel
115 return $classes; 113 return $classes;
116 } 114 }
117 115
118 -  
119 /** 116 /**
120 * 自定义array_column函数 117 * 自定义array_column函数
121 * 118 *
122 * @return array 返回数组中指定的一列组成的数组 119 * @return array 返回数组中指定的一列组成的数组
123 */ 120 */
  121 +
124 /** 122 /**
125 * 自定义array_column函数 123 * 自定义array_column函数
126 * @param array $input 需要取出数组咧的多维数组 124 * @param array $input 需要取出数组咧的多维数组
@@ -132,19 +130,18 @@ class ClassModel @@ -132,19 +130,18 @@ class ClassModel
132 { 130 {
133 $array = array(); 131 $array = array();
134 foreach ($input as $value) { 132 foreach ($input as $value) {
135 - if ( ! isset($value[$columnKey])) { 133 + if (!isset($value[$columnKey])) {
136 trigger_error("Key \"$columnKey\" does not exist in array"); 134 trigger_error("Key \"$columnKey\" does not exist in array");
137 return false; 135 return false;
138 } 136 }
139 if (is_null($indexKey)) { 137 if (is_null($indexKey)) {
140 $array[] = $value[$columnKey]; 138 $array[] = $value[$columnKey];
141 - }  
142 - else {  
143 - if ( ! isset($value[$indexKey])) { 139 + } else {
  140 + if (!isset($value[$indexKey])) {
144 trigger_error("Key \"$indexKey\" does not exist in array"); 141 trigger_error("Key \"$indexKey\" does not exist in array");
145 return false; 142 return false;
146 } 143 }
147 - if ( ! is_scalar($value[$indexKey])) { 144 + if (!is_scalar($value[$indexKey])) {
148 trigger_error("Key \"$indexKey\" does not contain scalar value"); 145 trigger_error("Key \"$indexKey\" does not contain scalar value");
149 return false; 146 return false;
150 } 147 }
@@ -152,7 +149,6 @@ class ClassModel @@ -152,7 +149,6 @@ class ClassModel
152 } 149 }
153 } 150 }
154 return $array; 151 return $array;
155 -  
156 } 152 }
157 - 153 +
158 } 154 }
  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 +}
@@ -65,7 +65,7 @@ class NewsaleModel @@ -65,7 +65,7 @@ class NewsaleModel
65 * 65 *
66 * @return array 66 * @return array
67 */ 67 */
68 - public static function getSaleFocus() 68 + public static function getSaleFocus($channel)
69 { 69 {
70 $result = array(); 70 $result = array();
71 71
1 <?php 1 <?php
  2 +
2 use Action\AbstractAction; 3 use Action\AbstractAction;
3 4
4 /** 5 /**
@@ -6,257 +7,40 @@ use Action\AbstractAction; @@ -6,257 +7,40 @@ use Action\AbstractAction;
6 */ 7 */
7 class BrandController extends AbstractAction 8 class BrandController extends AbstractAction
8 { 9 {
  10 +
9 /** 11 /**
10 * 品牌一览 12 * 品牌一览
11 * 13 *
  14 + * @param string gender 老版本中使用的参数, 做兼容判断
12 * @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道 15 * @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
13 */ 16 */
14 public function indexAction() 17 public function indexAction()
15 { 18 {
16 $this->setTitle('品牌一览'); 19 $this->setTitle('品牌一览');
17 $this->setNavHeader('品牌一览'); 20 $this->setNavHeader('品牌一览');
18 - 21 +
19 /* 判断参数是否有效 */ 22 /* 判断参数是否有效 */
20 - $channel = $this->get('channel', 1);  
21 - if (!is_numeric($channel) || intval($channel) > 4) {  
22 - $channel = 1; 23 + $channel = null;
  24 + $gender = $this->get('gender');
  25 + if (!empty($gender)) {
  26 + switch ($gender) {
  27 + case '1,3': // 男
  28 + $channel = 1;
  29 + break;
  30 + case '2,3': // 女
  31 + $channel = 2;
  32 + break;
  33 + }
23 } 34 }
24 -  
25 - /* 获取渲染模板需要的数据 */  
26 - /*$data = Category\BrandModel::getBrandByChannel($channel);  
27 - if (!is_array($data)) {  
28 - $data = array(); 35 + if (!isset($channel)) {
  36 + $channel = $this->get('channel', 1);
  37 + if (!is_numeric($channel) || intval($channel) > 4) {
  38 + $channel = 1;
  39 + }
29 } 40 }
30 - $data['brandPage'] = true;  
31 -  
32 - $brandTop = array();  
33 - if($brandTopData['code'] == 200)  
34 - {  
35 - $brandTop = $brandTopData['data'];  
36 - }  
37 - $brands = array();  
38 - if($brandsData['code'] == 200)  
39 - {  
40 - $brands = $brandsData['data'];  
41 - }  
42 -  
43 - /*echo '<pre>';  
44 - var_dump($brandTop, $brands);exit;*/  
45 -  
46 - $data = array (  
47 - 'brandPage' => true,  
48 - 'pageHeader' => array (  
49 - 'navBack' => 'sss ',  
50 - 'navHome' => 'sss ',  
51 - 'navTitle' => 'sss '  
52 - ),  
53 - 'bannerTop' => array (  
54 - 'list' => array (  
55 - array (  
56 - 'url' => '',  
57 - 'img' => 'http://img10.static.yhbimg.com/adpic/2015/10/15/10/01c161398d3baec2868abe85e26ba1a71d.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'  
58 - ),  
59 - array (  
60 - 'url' => '',  
61 - 'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/027c45cdc03e23c367ec0ff3d29b7c3f79.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'  
62 - ),  
63 - array (  
64 - 'url' => '',  
65 - 'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/022e2ac6daa33fc3cb8a0f04025a35994f.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'  
66 - )  
67 - )  
68 - ),  
69 - 'hotBrand' => array (  
70 - 'list' => array (  
71 - array (  
72 - 'url' => '',  
73 - 'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/08/12/17/0233d54f34d2534c08271a8fc27090a6af.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
74 - ),  
75 - array (  
76 - 'url' => '',  
77 - 'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/020b17265b2103b49005c57395b8b154a9.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
78 - ),  
79 - array (  
80 - 'url' => '',  
81 - 'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/11/27/09/02b403bdcbfb965bdc632fea5c29816746.png?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
82 - ),  
83 - array (  
84 - 'url' => '',  
85 - 'img' => 'http://img13.static.yhbimg.com/brandLogo/2013/11/01/14/027e68260ba30c01b165c17fe043f2ce2c.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
86 - ),  
87 - array (  
88 - 'url' => '',  
89 - 'img' => 'http://img11.static.yhbimg.com/brandLogo/2014/04/25/14/0179fa8eacf51fd1a89ec6f7fdeab88fc2.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
90 - ),  
91 - array (  
92 - 'url' => '',  
93 - 'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/02608437f8d8b6b7b15786214b0a5ef502.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
94 - ),  
95 - array (  
96 - 'url' => '',  
97 - 'img' => 'http://img12.static.yhbimg.com/brandLogo/2013/02/28/17/020aae69720d683a7962c9b7fd3a92c801.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
98 - ),  
99 - array (  
100 - 'url' => '',  
101 - 'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/01/27/11/02bca7ac6414c7475b4a337e28a0365590.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'  
102 - )  
103 - )  
104 - ),  
105 - 'brandList' => array (  
106 - array (  
107 - 'title' => '0~9',  
108 - 'list' => array(  
109 - array (  
110 - 'name' => '004',  
111 - 'isHot' => true  
112 - ),  
113 - array (  
114 - 'name' => '10*1',  
115 - 'isNew' => true  
116 - ),  
117 - array (  
118 - 'name' => '2%'  
119 - )  
120 - )  
121 - ),  
122 - array (  
123 - 'title' => 'A',  
124 - 'list' => array(  
125 - array (  
126 - 'name' => 'Aape',  
127 - 'isHot' => true  
128 - ),  
129 - array (  
130 - 'name' => 'Adfdfd',  
131 - 'isNew' => true  
132 - ),  
133 - array (  
134 - 'name' => 'Acrwewwe'  
135 - )  
136 - )  
137 - ),  
138 - array (  
139 - 'title' => 'B',  
140 - 'list' => array(  
141 - array (  
142 - 'name' => 'Bape'  
143 - ),  
144 - array (  
145 - 'name' => 'Bdfdfd'  
146 - ),  
147 - array (  
148 - 'name' => 'Bcrwewwe'  
149 - )  
150 - )  
151 - ),  
152 - array (  
153 - 'title' => 'B',  
154 - 'list' => array(  
155 - array (  
156 - 'name' => 'Bape'  
157 - ),  
158 - array (  
159 - 'name' => 'Bdfdfd'  
160 - ),  
161 - array (  
162 - 'name' => 'Bcrwewwe'  
163 - )  
164 - )  
165 - ),  
166 - array (  
167 - 'title' => 'B',  
168 - 'list' => array(  
169 - array (  
170 - 'name' => 'Bape'  
171 - ),  
172 - array (  
173 - 'name' => 'Bdfdfd'  
174 - ),  
175 - array (  
176 - 'name' => 'Bcrwewwe'  
177 - )  
178 - )  
179 - ),  
180 - array (  
181 - 'title' => 'B',  
182 - 'list' => array(  
183 - array (  
184 - 'name' => 'Bape'  
185 - ),  
186 - array (  
187 - 'name' => 'Bdfdfd'  
188 - ),  
189 - array (  
190 - 'name' => 'Bcrwewwe'  
191 - )  
192 - )  
193 - ),  
194 - array (  
195 - 'title' => 'B',  
196 - 'list' => array(  
197 - array (  
198 - 'name' => 'Bape'  
199 - ),  
200 - array (  
201 - 'name' => 'Bdfdfd'  
202 - ),  
203 - array (  
204 - 'name' => 'Bcrwewwe'  
205 - )  
206 - )  
207 - ),  
208 - array (  
209 - 'title' => 'B',  
210 - 'list' => array(  
211 - array (  
212 - 'name' => 'Bape'  
213 - ),  
214 - array (  
215 - 'name' => 'Bdfdfd'  
216 - ),  
217 - array (  
218 - 'name' => 'Bcrwewwe'  
219 - )  
220 - )  
221 - ),  
222 - array (  
223 - 'title' => 'B',  
224 - 'list' => array(  
225 - array (  
226 - 'name' => 'Bape'  
227 - ),  
228 - array (  
229 - 'name' => 'Bdfdfd'  
230 - ),  
231 - array (  
232 - 'name' => 'Bcrwewwe'  
233 - )  
234 - )  
235 - ),  
236 - array (  
237 - 'title' => 'B',  
238 - 'list' => array(  
239 - array (  
240 - 'name' => 'Bape'  
241 - ),  
242 - array (  
243 - 'name' => 'Bdfdfd'  
244 - ),  
245 - array (  
246 - 'name' => 'Bcrwewwe'  
247 - )  
248 - )  
249 - )  
250 - )  
251 -  
252 -  
253 - );  
254 -  
255 -  
256 - $this->_view->assign('title', 'YOHO!有货');  
257 - //$this->_view->display('brand', compact('brands'));  
258 41
259 // 渲染模板 42 // 渲染模板
260 - $this->_view->display('index', $data); 43 + $this->_view->display('index', Category\BrandModel::getBrandByChannel($channel));
261 } 44 }
262 -}  
  45 +
  46 +}
@@ -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 }
@@ -7,159 +7,113 @@ use Plugin\Helpers; @@ -7,159 +7,113 @@ use Plugin\Helpers;
7 /** 7 /**
8 * 逛首页、列表页、编辑页 8 * 逛首页、列表页、编辑页
9 */ 9 */
10 -class ListController extends AbstractAction 10 +class IndexController extends AbstractAction
11 { 11 {
  12 +
12 /** 13 /**
13 * 首页 14 * 首页
14 * 15 *
15 - * @param int type 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士  
16 - * @param string gender '1,3'表示男,'2,3'表示女 16 + * @param int id 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士
  17 + * @param string gender '1,3'表示男,'2,3'表示女, 默认为所有
17 */ 18 */
18 public function indexAction() 19 public function indexAction()
19 { 20 {
20 $this->setTitle('逛'); 21 $this->setTitle('逛');
21 $this->setNavHeader('逛', true, SITE_MAIN); 22 $this->setNavHeader('逛', true, SITE_MAIN);
22 -  
23 - $category = ListData::category();  
24 - $articleGroup = array();  
25 - 23 +
26 $uid = $this->getUid(); 24 $uid = $this->getUid();
27 $udid = $this->getUdid(); 25 $udid = $this->getUdid();
28 - $type = $this->get('type', 0); 26 + $type = $this->get('id', 0);
29 $gender = $this->get('gender'); 27 $gender = $this->get('gender');
30 -  
31 - // 男  
32 - if ($gender === '1,3') {  
33 - $articleGroup = ListData::articleGroup($category['data'], '1,3', $uid, $udid);  
34 - }  
35 - // 女  
36 - elseif ($gender === '2,3') {  
37 - $articleGroup = ListData::articleGroup($category['data'], '2,3', $uid, $udid);  
38 - }  
39 - // 所有  
40 - else {  
41 - $articleGroup = ListData::articleGroup($category['data'], '1,2,3', $uid, $udid);  
42 - }  
43 -  
44 - $data = array();  
45 - $build = array();  
46 -  
47 - // 模板中使用JS的标识  
48 - $data['guangHome'] = true;  
49 -  
50 - // 顶部的分类列表  
51 - foreach ($category['data'] as $value) {  
52 - $build = array();  
53 - $build['typeId'] = $value['id'];  
54 - $build['type'] = $value['name'];  
55 - $build['focus'] = ($value['id'] == $type);  
56 - $data['navs'][] = $build;  
57 - }  
58 -  
59 - $data['guang']['swiper'] = array();  
60 - $data['guang']['infos'] = array();  
61 - foreach ($articleGroup as $id => $value) {  
62 - // 判断是否有内容  
63 - if (empty($value['list'])) {  
64 - continue;  
65 - }  
66 -  
67 - // 轮番广告  
68 - if ($id == 0) {  
69 - $build = array();  
70 - foreach ($value['list']['adlist'] as $banner) {  
71 - $build['url'] = $banner['url'];  
72 - $build['img'] = Helpers::getImageUrl($banner['src'], 830, 327);  
73 - $data['guang']['swiper'][] = $build;  
74 - }  
75 - }  
76 -  
77 - // 内容列表  
78 - $build = array();  
79 - $build['show'] = ($id == $type);  
80 - foreach ($value['list']['artList'] as $article) {  
81 - $build['info'][] = Helpers::formatArticle($article, true, false);  
82 - }  
83 - $data['guang']['infos'][] = $build;  
84 - }  
85 -  
86 - // 分页需要参数  
87 - $data['guang']['gender'] = $gender;  
88 28
89 - $this->_view->display('index', $data); 29 + $this->_view->display('index', Guang\IndexModel::getArticleGroup($gender, $type, $uid, $udid));
90 } 30 }
91 31
92 /** 32 /**
93 * 列表页 33 * 列表页
94 * 34 *
95 * @param string tag 标签名称 35 * @param string tag 标签名称
  36 + * @param int yh_channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活
96 */ 37 */
97 public function tagAction() 38 public function tagAction()
98 { 39 {
99 - $tag = $this->get('query');  
100 $uid = $this->getUid(); 40 $uid = $this->getUid();
101 $udid = $this->getUdid(); 41 $udid = $this->getUdid();
102 - 42 + $tag = $this->get('query');
  43 + $channel = $this->get('yh_channel');
  44 +
103 // 标签聚合内容列表 45 // 标签聚合内容列表
104 $article = ListData::article('', 0, $uid, $udid, 1, $tag); 46 $article = ListData::article('', 0, $uid, $udid, 1, $tag);
105 // 标签聚合内容不存在, 跳到错误页面 47 // 标签聚合内容不存在, 跳到错误页面
106 if (empty($article['data']['list']['artList'])) { 48 if (empty($article['data']['list']['artList'])) {
107 $this->error(); 49 $this->error();
108 - }  
109 - 50 + }
  51 + // 标识是不是APP客户端
  52 + $isApp = isset($channel);
  53 +
110 $this->setTitle($tag); 54 $this->setTitle($tag);
111 - $this->setNavHeader($tag, true, SITE_MAIN);  
112 - 55 + if (!$isApp) {
  56 + $this->setNavHeader($tag, true, SITE_MAIN);
  57 + }
  58 +
113 $data = array(); 59 $data = array();
114 // 模板中使用JS的标识 60 // 模板中使用JS的标识
115 $data['guangList'] = true; 61 $data['guangList'] = true;
116 - 62 +
117 // 构建资讯文章内容 63 // 构建资讯文章内容
118 $build = array(); 64 $build = array();
119 foreach ($article['data']['list']['artList'] as $article) { 65 foreach ($article['data']['list']['artList'] as $article) {
120 - $build[] = Helpers::formatArticle($article, true, false); 66 + $build[] = Helpers::formatArticle($article, true, $isApp);
121 } 67 }
122 $data['guang']['infos'] = $build; 68 $data['guang']['infos'] = $build;
123 - 69 +
124 // 分页需要的参数 70 // 分页需要的参数
125 $data['guang']['tag'] = $tag; 71 $data['guang']['tag'] = $tag;
126 - 72 +
127 $this->_view->display('list', $data); 73 $this->_view->display('list', $data);
128 } 74 }
129 - 75 +
130 /** 76 /**
131 * 编辑页 77 * 编辑页
  78 + *
  79 + * @param int id 作者ID
  80 + * @param int yh_channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活
132 */ 81 */
133 public function editorAction() 82 public function editorAction()
134 { 83 {
135 $id = $this->get('id'); 84 $id = $this->get('id');
136 - 85 + $channel = $this->get('yh_channel');
  86 +
137 // 获取作者信息 87 // 获取作者信息
138 - $author = ListData::author($id); 88 + $author = ListData::author($id);
139 // 作者信息不存在,则跳到错误页面 89 // 作者信息不存在,则跳到错误页面
140 if (!isset($author['name'])) { 90 if (!isset($author['name'])) {
141 $this->error(); 91 $this->error();
142 } 92 }
143 - 93 + // 标识是不是APP客户端
  94 + $isApp = isset($channel);
  95 +
144 $this->setTitle('编辑简介'); 96 $this->setTitle('编辑简介');
145 - $this->setNavHeader('编辑简介', true, SITE_MAIN);  
146 - 97 + if (!$isApp) {
  98 + $this->setNavHeader('编辑简介', true, SITE_MAIN);
  99 + }
  100 +
147 $uid = $this->getUid(); 101 $uid = $this->getUid();
148 $udid = $this->getUdid(); 102 $udid = $this->getUdid();
149 - 103 +
150 $data = array(); 104 $data = array();
151 // 模板中使用JS的标识 105 // 模板中使用JS的标识
152 $data['guangList'] = true; 106 $data['guangList'] = true;
153 - 107 +
154 // 作者信息 108 // 作者信息
155 $data['author'] = array(); 109 $data['author'] = array();
156 $data['author']['avatar'] = Helpers::getImageUrl($author['avatar'], 100, 100); 110 $data['author']['avatar'] = Helpers::getImageUrl($author['avatar'], 100, 100);
157 $data['author']['name'] = $author['name']; 111 $data['author']['name'] = $author['name'];
158 $data['author']['info'] = $author['author_desc']; 112 $data['author']['info'] = $author['author_desc'];
159 $data['author']['id'] = $id; 113 $data['author']['id'] = $id;
160 - 114 +
161 // 标签聚合内容列表 115 // 标签聚合内容列表
162 - $article = ListData::article('', 0, $uid, $udid, 1, null, $id); 116 + $article = ListData::article('', 0, $uid, $udid, 1, null, $id);
163 // 构建资讯文章内容 117 // 构建资讯文章内容
164 if (!empty($article['data']['list']['artList'])) { 118 if (!empty($article['data']['list']['artList'])) {
165 $build = array(); 119 $build = array();
@@ -171,7 +125,7 @@ class ListController extends AbstractAction @@ -171,7 +125,7 @@ class ListController extends AbstractAction
171 125
172 $this->_view->display('list', $data); 126 $this->_view->display('list', $data);
173 } 127 }
174 - 128 +
175 /** 129 /**
176 * 逛列表页面的资讯分页 130 * 逛列表页面的资讯分页
177 * 131 *
@@ -191,7 +145,7 @@ class ListController extends AbstractAction @@ -191,7 +145,7 @@ class ListController extends AbstractAction
191 if (!$this->isAjax()) { 145 if (!$this->isAjax()) {
192 break; 146 break;
193 } 147 }
194 - 148 +
195 /* 判断参数是否有效 */ 149 /* 判断参数是否有效 */
196 $tag = $this->get('tag'); 150 $tag = $this->get('tag');
197 $sortId = $this->get('type', 0); 151 $sortId = $this->get('type', 0);
@@ -203,22 +157,21 @@ class ListController extends AbstractAction @@ -203,22 +157,21 @@ class ListController extends AbstractAction
203 break; 157 break;
204 } 158 }
205 if (!empty($page) && !is_numeric($page)) { 159 if (!empty($page) && !is_numeric($page)) {
206 -  
207 break; 160 break;
208 } 161 }
209 if (!empty($authorId) && is_numeric($authorId)) { 162 if (!empty($authorId) && is_numeric($authorId)) {
210 $showAuthor = false; 163 $showAuthor = false;
211 } 164 }
212 - 165 +
213 /* 获取资讯文章列表 */ 166 /* 获取资讯文章列表 */
214 $uid = $this->getUid(); 167 $uid = $this->getUid();
215 $udid = $this->getUdid(); 168 $udid = $this->getUdid();
216 $page = intval($page) + 1; 169 $page = intval($page) + 1;
217 - $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId); 170 + $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);
218 if (empty($article['data']['list']['artList'])) { 171 if (empty($article['data']['list']['artList'])) {
219 break; 172 break;
220 } 173 }
221 - 174 +
222 /* 构建资讯文章内容 */ 175 /* 构建资讯文章内容 */
223 $data = array(); 176 $data = array();
224 $build = array(); 177 $build = array();
@@ -226,14 +179,14 @@ class ListController extends AbstractAction @@ -226,14 +179,14 @@ class ListController extends AbstractAction
226 $build[] = Helpers::formatArticle($article, true, false, $showAuthor); 179 $build[] = Helpers::formatArticle($article, true, false, $showAuthor);
227 } 180 }
228 $data['infos'] = $build; 181 $data['infos'] = $build;
229 - 182 +
230 $this->_view->display('page', $data); 183 $this->_view->display('page', $data);
231 - 184 +
232 exit(); 185 exit();
233 - }  
234 - while (false);  
235 - 186 +
  187 + } while (false);
  188 +
236 echo ' '; 189 echo ' ';
237 } 190 }
238 -  
239 -}  
  191 +
  192 +}
@@ -8,7 +8,7 @@ use Plugin\Helpers; @@ -8,7 +8,7 @@ use Plugin\Helpers;
8 /** 8 /**
9 * 逛详情页 9 * 逛详情页
10 */ 10 */
11 -class DetailController extends AbstractAction 11 +class InfoController extends AbstractAction
12 { 12 {
13 13
14 /** 14 /**
@@ -41,7 +41,7 @@ class DetailController extends AbstractAction @@ -41,7 +41,7 @@ class DetailController extends AbstractAction
41 $data['guang']['author']['avatar'] = $detail['getAuthor']['avatar']; 41 $data['guang']['author']['avatar'] = $detail['getAuthor']['avatar'];
42 $data['guang']['author']['name'] = $detail['getAuthor']['name']; 42 $data['guang']['author']['name'] = $detail['getAuthor']['name'];
43 $data['guang']['author']['intro'] = $detail['getAuthor']['author_desc']; 43 $data['guang']['author']['intro'] = $detail['getAuthor']['author_desc'];
44 - $data['guang']['author']['url'] = '/guang/list/editor?id=' . $detail['getArticle']['author_id']; 44 + $data['guang']['author']['url'] = Helpers::url('/author/index', array('id' => $detail['getArticle']['author_id']), 'guang');
45 } 45 }
46 46
47 $data['detail'] = array(); 47 $data['detail'] = array();
@@ -143,7 +143,7 @@ class DetailController extends AbstractAction @@ -143,7 +143,7 @@ class DetailController extends AbstractAction
143 // 相关标签 143 // 相关标签
144 if (!empty($detail['getArticle']['tags'])) { 144 if (!empty($detail['getArticle']['tags'])) {
145 foreach ($detail['getArticle']['tags'] as $value) { 145 foreach ($detail['getArticle']['tags'] as $value) {
146 - $value['url'] = '/guang/list/tag?query=' . $value['name']; 146 + $value['url'] = Helpers::url('/tags/index', array('query=' => $value['name']), 'guang');
147 $data['relatedTag'][] = $value; 147 $data['relatedTag'][] = $value;
148 } 148 }
149 } 149 }
@@ -151,7 +151,7 @@ class DetailController extends AbstractAction @@ -151,7 +151,7 @@ class DetailController extends AbstractAction
151 // 相关文章 151 // 相关文章
152 if (!empty($detail['getOtherArticle'])) { 152 if (!empty($detail['getOtherArticle'])) {
153 foreach ($detail['getOtherArticle'] as $value) { 153 foreach ($detail['getOtherArticle'] as $value) {
154 - $value['url'] = '/guang/detail/index?id=' . $value['id']; 154 + $value['url'] = Helpers::url('/info/index', array('id' => $value['id']), 'guang');
155 $value['thumb'] = Helpers::getImageUrl($value['thumb'], 279, 175); 155 $value['thumb'] = Helpers::getImageUrl($value['thumb'], 279, 175);
156 $data['relatedInfo'][] = $value; 156 $data['relatedInfo'][] = $value;
157 } 157 }
  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 -<?php  
2 -  
3 -use Action\AbstractAction;  
4 -use LibModels\Wap\Product\SearchData;  
5 -use LibModels\Wap\Category\BrandData;  
6 -use LibModels\Wap\Category\ClassData;  
7 -use Category\ClassModel;  
8 -use Plugin\DataProcess\ListProcess;  
9 -use Plugin\Helpers;  
10 -  
11 -/**  
12 - * 商品列表页  
13 - */  
14 -class ListController extends AbstractAction  
15 -{  
16 - /**  
17 - * 搜索列表页  
18 - */  
19 - public function indexAction()  
20 - {  
21 - $query = $this->get('query', null);  
22 - $brand = $this->get('brand', null);  
23 - $gender = $this->getCookie('_Channel', 'boys');  
24 - $p_d = $this->get('p_d', null);  
25 - $misort = $this->get('misort', null);  
26 - $msort = $this->get('msort', null);  
27 -  
28 - $data = array(  
29 - 'pageHeader' => array(  
30 - 'navBack' => true,  
31 - 'navTitle' => '搜索',  
32 - 'navHome' => '/'  
33 - ),  
34 - 'goodListPage' => true,  
35 - 'goodList' => array(  
36 - 'brand' => 0,  
37 - 'msort' => 0,  
38 - 'gender' => $gender,  
39 - 'price' => 0,  
40 - 'size' => 0,  
41 - 'discount' => ''  
42 - )  
43 - );  
44 -  
45 - // 首先查询是否属于内置品类  
46 - $classes = ClassModel::getClassesArr();  
47 - $classFlag = array_search($query, $classes);  
48 - if($classFlag !== false)// 属于内部品类  
49 - {  
50 - $data['pageHeader']['navTitle'] = '所有'.$query;  
51 - }  
52 -  
53 - // 如果存在搜索字符串就显示搜索栏  
54 - if(!is_null($query) && $classFlag === false)  
55 - {  
56 - $data['search'] = array(  
57 - 'default' => $query  
58 - );  
59 - }  
60 -  
61 - // 转换性别  
62 - $this->genderTrans($gender);  
63 -  
64 - // 查询数据  
65 - $listData = SearchData::searchLiDatas($query, $brand, $gender, $p_d, $misort, $msort);  
66 - // 处理返回的数据  
67 - if (isset($listData['code']) && $listData['code'] === 200) {  
68 - $tmpData = $listData['data'];  
69 -  
70 - // 如果存在品牌信息就显示品牌字段  
71 - if(isset($tmpData['brand']) && !empty($tmpData['brand']))  
72 - {  
73 - $brandData = $tmpData['brand'];  
74 - $data['brandWay'] = array(  
75 - 'url' => '/product/list/brand?brand='.$brandData['id'],  
76 - 'thumb' => Helpers::getImageUrl($brandData['brand_ico'], 75, 40),  
77 - 'name' => $brandData['brand_name']  
78 - );  
79 -  
80 - // 设置品牌默认值  
81 - $data['goodList']['brand'] = $brandData['id'];  
82 - }  
83 -  
84 - $data['goodList'] += ListProcess::getListData($tmpData);  
85 - }  
86 -  
87 - $this->_view->display('index', $data);  
88 - }  
89 -  
90 -  
91 - /**  
92 - * Ajax异步筛选请求  
93 - */  
94 - public function searchAction()  
95 - {  
96 - if($this->isAjax())  
97 - {  
98 - $query = $this->get('query', null);  
99 - $brand = $this->get('brand', null);  
100 - $gender = $this->get('gender', null);  
101 - $color = $this->get('color', null);  
102 - $size = $this->get('size', null);  
103 - $price = $this->get('price', null);  
104 - $p_d = $this->get('discount', null);  
105 - $sort = $this->get('msort', null);  
106 -  
107 - // 转换性别  
108 - $this->genderTrans($gender);  
109 -  
110 - // 转换排序方式  
111 - $order = $this->get('order', null);  
112 - $type = $this->get('type', '');  
113 - switch ($type) {  
114 - case 'price':  
115 - $order = ($order == 0) ? 's_p_desc' : 's_p_asc';  
116 - break;  
117 - case 'discount':  
118 - $order = ($order == 0) ? 'p_d_desc' : 'p_d_asc';  
119 - break;  
120 - case 'newest':  
121 - default:  
122 - $order = ($order == 0) ? 's_t_desc' : 's_t_asc';  
123 - break;  
124 - }  
125 -  
126 - $data = array();  
127 - // 查询数据  
128 - $listData = SearchData::searchLiDatas($query, $brand, $gender, $color, $size, $price, $p_d, $sort, $order);  
129 - // 处理返回的数据  
130 - if (isset($listData['code']) && $listData['code'] === 200) {  
131 - $tmpData = $listData['data'];  
132 -  
133 - unset($tmpData['filter']);// 不要筛选条件的数据  
134 - $data = ListProcess::getListData($tmpData);  
135 - }  
136 -  
137 - if(empty($data))  
138 - {  
139 - echo ' ';  
140 - }  
141 - else  
142 - {  
143 - $this->_view->display('list', $data);  
144 - }  
145 - }  
146 - }  
147 -  
148 -  
149 - /**  
150 - * 品牌商品列表页  
151 - */  
152 - public function brandAction()  
153 - {  
154 - $brand = $this->get('brand', null);  
155 - $gender = $this->getCookie('_Channel', 'boys');  
156 - $sort = $this->get('sort', null);  
157 - $color = $this->get('color', null);  
158 - $size = $this->get('size', null);  
159 - $price = $this->get('price', null);  
160 - $p_d = $this->get('discount', null);  
161 -  
162 - $data = array(  
163 - 'pageHeader' => array(  
164 - 'navBack' => true,  
165 - 'navHome' => '/'  
166 - ),  
167 - 'goodListPage' => true,  
168 - 'goodList' => array(  
169 - 'brandHome' => array(  
170 - 'id' => $brand  
171 - ),  
172 - 'brand' => $brand,  
173 - 'msort' => 0,  
174 - 'gender' => $gender,  
175 - 'sort' => 0,  
176 - 'price' => 0,  
177 - 'size' => 0,  
178 - 'discount' => '',  
179 - 'p_d' => ''  
180 - )  
181 - );  
182 -  
183 - // 获取品牌介绍信息  
184 - $introData = BrandData::getBrandIntro($brand);  
185 - if(isset($introData['code']) && $introData['code'] === 200)  
186 - {  
187 - $data['goodList']['brandHome']['intro'] = isset($introData['data']['brand_intro']) ? $introData['data']['brand_intro'] : '';  
188 - }  
189 -  
190 - // 获取品牌banner的数据  
191 - $uid = $this->getUid();  
192 - $bannerData = BrandData::getBrandBanner($brand, $uid);  
193 - if(isset($bannerData['code']) && $bannerData['code'] === 200)  
194 - {  
195 - $data['goodList']['brandHome']['banner'] = isset($bannerData['data']['banner']) ? Helpers::getImageUrl($bannerData['data']['banner'], 640, 75) : '';  
196 - }  
197 -  
198 - // 查询数据  
199 - // 转换性别  
200 - $this->genderTrans($gender);  
201 - $listData = BrandData::selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d);  
202 - // 处理返回的数据  
203 - if (isset($listData['code']) && $listData['code'] === 200) {  
204 - $tmpData = $listData['data'];  
205 - // 设置品牌名称  
206 - $data['pageHeader']['navTitle'] = isset($tmpData['brand_name']) ? $tmpData['brand_name'] : '';  
207 -  
208 - $data['goodList'] += ListProcess::getListData($tmpData);  
209 - }  
210 -  
211 - $this->_view->display('index', $data);  
212 - }  
213 -  
214 -  
215 - /**  
216 - * 品类商品列表页  
217 - */  
218 - public function classAction()  
219 - {  
220 - $brand = $this->get('brand', null);  
221 - $gender = $this->getCookie('_Channel', 'boys');  
222 - $sort = $this->get('sort', null);  
223 - $color = $this->get('color', null);  
224 - $size = $this->get('size', null);  
225 - $price = $this->get('price', null);  
226 - $p_d = $this->get('discount', null);  
227 -  
228 - $data = array(  
229 - 'pageHeader' => array(  
230 - 'navBack' => true,  
231 - 'navHome' => '/'  
232 - ),  
233 - 'goodListPage' => true,  
234 - 'goodList' => array(  
235 - 'brand' => 0,  
236 - 'msort' => 0,  
237 - 'gender' => $gender,  
238 - 'sort' => $sort,  
239 - 'price' => 0,  
240 - 'size' => 0,  
241 - 'discount' => ''  
242 - )  
243 - );  
244 -  
245 - // 根据id查询类的名称  
246 - $classes = ClassModel::getClassesArr();  
247 - $data['pageHeader']['navTitle'] = isset($classes[$sort]) ? $classes[$sort] : '';  
248 -  
249 - // 查询数据  
250 - // 转换性别  
251 - $this->genderTrans($gender);  
252 - $listData = ClassData::selectClassDetail($gender, $brand, $sort, $color, $size, $price, $p_d);  
253 - // 处理返回的数据  
254 - if (isset($listData['code']) && $listData['code'] === 200) {  
255 - $tmpData = $listData['data'];  
256 -  
257 - $data['goodList'] += ListProcess::getListData($tmpData);  
258 - }  
259 -  
260 - $this->_view->display('index', $data);  
261 - }  
262 -  
263 -  
264 - /**  
265 - * 性别数据转换  
266 - *  
267 - * @param string &$gender 从cookie中获取的gender值,最后得到转换之后接口调用的值  
268 - */  
269 - private function genderTrans(&$gender)  
270 - {  
271 - if($gender === 'boys')  
272 - {  
273 - $gender = '1,3';  
274 - }  
275 - elseif($gender === 'girls')  
276 - {  
277 - $gender = '2,3';  
278 - }  
279 - else  
280 - {  
281 - $gender = '1,2,3';  
282 - }  
283 - }  
284 -  
285 -}  
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use LibModels\Wap\Product\NewsaleData; 4 use LibModels\Wap\Product\NewsaleData;
5 use Product\NewsaleModel; 5 use Product\NewsaleModel;
  6 +use Plugin\Helpers;
6 7
7 /** 8 /**
8 * 新品到着 9 * 新品到着
@@ -20,8 +21,7 @@ class NewsaleController extends AbstractAction @@ -20,8 +21,7 @@ class NewsaleController extends AbstractAction
20 $this->setTitle('新品到着'); 21 $this->setTitle('新品到着');
21 $this->setNavHeader('新品到着'); 22 $this->setNavHeader('新品到着');
22 23
23 - $channel = $this->getCookie('_Channel', 'boys');  
24 - $this->channelTrans($channel); 24 + $channel = Helpers::getChannelByCookie();
25 25
26 $data = array(); 26 $data = array();
27 $data['newArrivalPage'] = true; 27 $data['newArrivalPage'] = true;
@@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction @@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction
34 $data += array( 34 $data += array(
35 'brand' => 0, 35 'brand' => 0,
36 'msort' => 0, 36 'msort' => 0,
37 - 'gender' => $this->getCookie('_Channel', 'boys'), 37 + 'gender' => Helpers::getGenderByCookie(),
38 'price' => 0, 38 'price' => 0,
39 'size' => 0, 39 'size' => 0,
40 'dayLimit' => 1, 40 'dayLimit' => 1,
@@ -54,9 +54,8 @@ class NewsaleController extends AbstractAction @@ -54,9 +54,8 @@ class NewsaleController extends AbstractAction
54 $this->setTitle('折扣专区'); 54 $this->setTitle('折扣专区');
55 $this->setNavHeader('Sale'); 55 $this->setNavHeader('Sale');
56 56
57 - $channel = $this->getCookie('_Channel', 'boys');  
58 - $this->channelTrans($channel);  
59 - 57 + $channel = Helpers::getChannelByCookie();
  58 +
60 $data = array(); 59 $data = array();
61 $data['discountPage'] = true; 60 $data['discountPage'] = true;
62 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel); 61 $data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel);
@@ -68,7 +67,7 @@ class NewsaleController extends AbstractAction @@ -68,7 +67,7 @@ class NewsaleController extends AbstractAction
68 $data += array( 67 $data += array(
69 'brand' => 0, 68 'brand' => 0,
70 'msort' => 0, 69 'msort' => 0,
71 - 'gender' => $this->getCookie('_Channel', 'boys'), 70 + 'gender' => Helpers::getGenderByCookie(),
72 'price' => 0, 71 'price' => 0,
73 'size' => 0, 72 'size' => 0,
74 'discount' => '0.1,0.9' 73 'discount' => '0.1,0.9'
@@ -92,7 +91,6 @@ class NewsaleController extends AbstractAction @@ -92,7 +91,6 @@ class NewsaleController extends AbstractAction
92 $size = $this->get('size', null); 91 $size = $this->get('size', null);
93 $price = $this->get('price', null); 92 $price = $this->get('price', null);
94 $p_d = $this->get('discount', null); 93 $p_d = $this->get('discount', null);
95 - $channel = $this->getCookie('_Channel', 'boys');  
96 $dayLimit = $this->get('dayLimit', null); 94 $dayLimit = $this->get('dayLimit', null);
97 $limit = $this->get('limit', 60); 95 $limit = $this->get('limit', 60);
98 $page = $this->get('page', 1); 96 $page = $this->get('page', 1);
@@ -128,7 +126,7 @@ class NewsaleController extends AbstractAction @@ -128,7 +126,7 @@ class NewsaleController extends AbstractAction
128 } 126 }
129 127
130 // 转换频道 128 // 转换频道
131 - $this->channelTrans($channel); 129 + $channel = Helpers::getChannelByCookie();
132 130
133 $data = NewsaleData::selectNewSaleProducts( 131 $data = NewsaleData::selectNewSaleProducts(
134 $gender, $brand, $sort, $color, 132 $gender, $brand, $sort, $color,
@@ -149,28 +147,4 @@ class NewsaleController extends AbstractAction @@ -149,28 +147,4 @@ class NewsaleController extends AbstractAction
149 } 147 }
150 } 148 }
151 149
152 - /**  
153 - * 转换频道  
154 - * @param string &$channel 待转换的频道  
155 - * @return integer 转换之后的频道  
156 - */  
157 - private function channelTrans(&$channel)  
158 - {  
159 - switch ($channel) {  
160 - case 'girls':  
161 - $channel = 2;  
162 - break;  
163 - case 'kids':  
164 - $channel = 3;  
165 - break;  
166 - case 'lifestyle':  
167 - $channel = 4;  
168 - break;  
169 - case 'boys':  
170 - default:  
171 - $channel = 1;  
172 - break;  
173 - }  
174 - }  
175 -  
176 } 150 }
  1 +<?php
  2 +
  3 +/**
  4 + *
  5 + * @name Opt
  6 + * @package
  7 + * @copyright yoho.inc
  8 + * @version 1.0 (2015-10-27 19:13:28)
  9 + * @author fei.hong <fei.hong@yoho.cn>
  10 + */
  11 +class Opt
  12 +{
  13 +
  14 +}
  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 ; 默认页 1 ; 默认页
2 routes.index.type = "rewrite" 2 routes.index.type = "rewrite"
3 -routes.index.match = "/index.html$" 3 +routes.index.match = "/index.html"
4 routes.index.route.module = Index 4 routes.index.route.module = Index
5 routes.index.route.controller = Index 5 routes.index.route.controller = Index
6 routes.index.route.action = Index 6 routes.index.route.action = Index
7 7
8 ; 错误页 8 ; 错误页
9 routes.error.type = "rewrite" 9 routes.error.type = "rewrite"
10 -routes.error.match = "/error.html$" 10 +routes.error.match = "/error.html"
11 routes.error.route.module = Index 11 routes.error.route.module = Index
12 routes.error.route.controller = Error 12 routes.error.route.controller = Error
13 routes.error.route.action = Index 13 routes.error.route.action = Index
14 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 +
15 ; 注册页 22 ; 注册页
16 routes.reg.type = "rewrite" 23 routes.reg.type = "rewrite"
17 -routes.reg.match = "/reg.html$" 24 +routes.reg.match = "/reg.html"
18 routes.reg.route.module = Passport 25 routes.reg.route.module = Passport
19 routes.reg.route.controller = Reg 26 routes.reg.route.controller = Reg
20 routes.reg.route.action = Index 27 routes.reg.route.action = Index
21 28
22 ; 登录页 29 ; 登录页
23 routes.login.type = "rewrite" 30 routes.login.type = "rewrite"
24 -routes.login.match = "/signin.html$" 31 +routes.login.match = "/signin.html"
25 routes.login.route.module = Passport 32 routes.login.route.module = Passport
26 routes.login.route.controller = Login 33 routes.login.route.controller = Login
27 routes.login.route.action = Index 34 routes.login.route.action = Index
28 35
29 ; 登录页(国际账号) 36 ; 登录页(国际账号)
30 routes.interational.type = "rewrite" 37 routes.interational.type = "rewrite"
31 -routes.interational.match = "/login.html$" 38 +routes.interational.match = "/login.html"
32 routes.interational.route.module = Passport 39 routes.interational.route.module = Passport
33 routes.interational.route.controller = Login 40 routes.interational.route.controller = Login
34 routes.interational.route.action = International 41 routes.interational.route.action = International
35 42
36 ; 找回密码(手机号) 43 ; 找回密码(手机号)
37 routes.phoneback.type = "rewrite" 44 routes.phoneback.type = "rewrite"
38 -routes.phoneback.match = "/phoneback.html$" 45 +routes.phoneback.match = "/phoneback.html"
39 routes.phoneback.route.module = Passport 46 routes.phoneback.route.module = Passport
40 routes.phoneback.route.controller = Back 47 routes.phoneback.route.controller = Back
41 routes.phoneback.route.action = Mobile 48 routes.phoneback.route.action = Mobile
42 49
43 ; 找回密码(邮箱) 50 ; 找回密码(邮箱)
44 routes.emailback.type = "rewrite" 51 routes.emailback.type = "rewrite"
45 -routes.emailback.match = "/emailback.html$" 52 +routes.emailback.match = "/emailback.html"
46 routes.emailback.route.module = Passport 53 routes.emailback.route.module = Passport
47 routes.emailback.route.controller = Back 54 routes.emailback.route.controller = Back
48 routes.emailback.route.action = Email 55 routes.emailback.route.action = Email
49 56
  57 +; 所有品类
  58 +routes.cate.type = "rewrite"
  59 +routes.cate.match = "/cate"
  60 +routes.cate.route.module = Category
  61 +routes.cate.route.controller = Class
  62 +routes.cate.route.action = Index
  63 +
  64 +; 品牌一览
  65 +routes.brands.type = "rewrite"
  66 +routes.brands.match = "/brands"
  67 +routes.brands.route.module = Category
  68 +routes.brands.route.controller = Brand
  69 +routes.brands.route.action = Index
  70 +
  71 +; 新品到着(NEW)
  72 +routes.productnew.type = "rewrite"
  73 +routes.productnew.match = "/product/new"
  74 +routes.productnew.route.module = Product
  75 +routes.productnew.route.controller = Newsale
  76 +routes.productnew.route.action = Index
  77 +
  78 +; 折扣专区(SALE)
  79 +routes.productsale.type = "rewrite"
  80 +routes.productsale.match = "/sale"
  81 +routes.productsale.route.module = Product
  82 +routes.productsale.route.controller = Newsale
  83 +routes.productsale.route.action = Discount
  84 +
50 85
@@ -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))); // 根目录