Authored by hf

do fixes bug refs YW-797

  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://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/lib.js"></script>
  40 +<script src="http://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/lib.js"></script>
  61 +<script src="http://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/lib.js"></script>
  58 +<script src="http://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/lib.js"></script>
  59 +<script src="http://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/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://cdn.yoho.cn/myohobuy/0.0.2/lib.js"></script>
  73 +<script src="http://cdn.yoho.cn/myohobuy/0.0.2/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>
@@ -20,4 +20,7 @@ class CacheConfig @@ -20,4 +20,7 @@ class CacheConfig
20 const KEY_ACTION_PRODUCT_NEWSALE_INDEX = 'key_action_product_newsale_index'; // 新品到着 20 const KEY_ACTION_PRODUCT_NEWSALE_INDEX = 'key_action_product_newsale_index'; // 新品到着
21 const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT = 'key_action_product_newsale_discount'; // 折扣专区 21 const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT = 'key_action_product_newsale_discount'; // 折扣专区
22 22
  23 + const KEY_ACTION_GUANG_PLUSSTAR_INDEX = 'key_action_guang_plusstar_index'; // 国际优选
  24 + const KEY_ACTION_GUANG_PLUSSTAR_LIST = 'key_action_guang_plusstar_list'; // 明星原创
  25 +
23 } 26 }
@@ -24,7 +24,45 @@ class PlusstarData @@ -24,7 +24,45 @@ class PlusstarData
24 const URI_BRANDINFO_ARTICLE = 'guang/service/v1/article/'; 24 const URI_BRANDINFO_ARTICLE = 'guang/service/v1/article/';
25 25
26 /** 26 /**
27 - * 品牌列表 27 + * 国际优选-品牌列表
  28 + *
  29 + * @param string $gender "1,3"表示男, "2,3"表示女
  30 + * @param string $channel 1表示男, 2表示女
  31 + * @return array(
  32 + * "star" => array(推荐品牌列表数据),
  33 + * "original" => array(所有品牌列表数据)
  34 + * )
  35 + */
  36 + public static function firstBrandList($gender, $channel)
  37 + {
  38 + // 存放接口列表
  39 + $urlList = array();
  40 + // 接口调用的URL
  41 + $url = Yohobuy::SERVICE_URL . self::URI_BRANDLIST;
  42 +
  43 + // 公共的参数
  44 + $param = Yohobuy::param();
  45 + $param['brand_type'] = '1';
  46 + $param['gender'] = $gender;
  47 + $param['yh_channel'] = $channel;
  48 +
  49 + // 构建推荐的品牌参数及调用接口的URL
  50 + $build = $param;
  51 + $build['is_recommend'] = '1';
  52 + $build['client_secret'] = Sign::getSign($build);
  53 + $urlList['recom'] = Yohobuy::httpBuildQuery($url, $build);
  54 +
  55 + // 构建所有的品牌参数及调用接口的URL
  56 + $build = $param;
  57 + $build['is_recommend'] = '0';
  58 + $build['client_secret'] = Sign::getSign($build);
  59 + $urlList['all'] = Yohobuy::httpBuildQuery($url, $build);
  60 +
  61 + return Yohobuy::getMulti($urlList);
  62 + }
  63 +
  64 + /**
  65 + * 明星原创-品牌列表
28 * 66 *
29 * @param string $gender "1,3"表示男, "2,3"表示女 67 * @param string $gender "1,3"表示男, "2,3"表示女
30 * @param string $channel 1表示男, 2表示女 68 * @param string $channel 1表示男, 2表示女
@@ -89,8 +127,7 @@ class PlusstarData @@ -89,8 +127,7 @@ class PlusstarData
89 $brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id))); 127 $brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)));
90 if (!isset($brandInfo['data']['brand_id'])) { 128 if (!isset($brandInfo['data']['brand_id'])) {
91 return $result; 129 return $result;
92 - }  
93 - else { 130 + } else {
94 $result['getBrandInfo'] = $brandInfo; 131 $result['getBrandInfo'] = $brandInfo;
95 } 132 }
96 133
@@ -153,8 +190,7 @@ class PlusstarData @@ -153,8 +190,7 @@ class PlusstarData
153 190
154 $i ++; 191 $i ++;
155 } 192 }
156 - }  
157 - while (false); 193 + } while (false);
158 194
159 // 调用发起请求 195 // 调用发起请求
160 Yohobuy::yarConcurrentLoop(); 196 Yohobuy::yarConcurrentLoop();
  1 +{{>layout/header}}
  2 +<div class="ps-list-page ps-page yoho-page">
  3 + {{# ps}}
  4 + <ul id="nav-tab" class="nav-tab clearfix">
  5 + <li class="star-nav focus">推荐</li>
  6 + <li class="plus-nav">ALL</li>
  7 + </ul>
  8 + <div id="ps-content" class="ps-content">
  9 + <ul class="star-content content">
  10 + {{# star}}
  11 + {{> guang/ps_item}}
  12 + {{/ star}}
  13 + </ul>
  14 + <ul class="plus-content content hide">
  15 + {{# plus}}
  16 + {{> guang/ps_item}}
  17 + {{/ plus}}
  18 + </ul>
  19 + </div>
  20 + {{/ ps}}
  21 +</div>
  22 +{{>layout/footer}}
  1 +<?php
  2 +
  3 +namespace Guang;
  4 +
  5 +use Configs\CacheConfig;
  6 +use LibModels\Wap\Guang\PlusstarData;
  7 +use Plugin\Helpers;
  8 +
  9 +/**
  10 + * 明星原创品牌相关的模板数据模型
  11 + *
  12 + * @name PlusstarModel
  13 + * @package models/Guang
  14 + * @copyright yoho.inc
  15 + * @version 1.0 (2015-10-23 15:30:00)
  16 + * @author fei.hong <fei.hong@yoho.cn>
  17 + */
  18 +class PlusstarModel
  19 +{
  20 +
  21 + /**
  22 + * 获取国际优先的品牌列表
  23 + *
  24 + * @param string $gender "1,3"表示男, "2,3"表示女
  25 + * @return array
  26 + */
  27 + public static function getFirstBrands($gender)
  28 + {
  29 + $channel = '1';
  30 + switch (strval($gender)) {
  31 + case '1,3': // 男
  32 + $channel = '1';
  33 + break;
  34 + case '2,3': // 女
  35 + $channel = '2';
  36 + break;
  37 + default: // 默认
  38 + $gender = '1,3';
  39 + $channel = '1';
  40 + break;
  41 + }
  42 +
  43 + if (USE_CACHE) {
  44 + $key = CacheConfig::KEY_ACTION_GUANG_PLUSSTAR_INDEX . $channel;
  45 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  46 + $result = Cache::get($key, 'master');
  47 + if (!empty($result)) {
  48 + return $result;
  49 + }
  50 + }
  51 +
  52 + $result = array();
  53 + $brandList = PlusstarData::firstBrandList($gender, $channel);
  54 + if (!empty($brandList['recom']['data']['list'][0]['data'])) {
  55 + $result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true);
  56 + $result['leftName'] = isset($brandList['recom']['data']['brand_type_name']) ? $brandList['recom']['data']['brand_type_name'] : '';
  57 + }
  58 + if (!empty($brandList['all']['data']['list'][0]['data'])) {
  59 + $result['ps']['plus'] = self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true);
  60 + $result['rightName'] = isset($brandList['all']['data']['brand_type_name']) ? $brandList['all']['data']['brand_type_name'] : '';
  61 + }
  62 +
  63 + if (USE_CACHE) {
  64 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  65 + if (empty($result)) {
  66 + $result = Cache::get($key, 'slave');
  67 + }
  68 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  69 + else {
  70 + Cache::set($key, $result);
  71 + }
  72 + }
  73 +
  74 + return $result;
  75 + }
  76 +
  77 + /**
  78 + * 获取明星原创的品牌列表
  79 + *
  80 + * @param string $gender "1,3"表示男, "2,3"表示女
  81 + * @return array
  82 + */
  83 + public static function getBrands($gender)
  84 + {
  85 + $channel = '1';
  86 + switch (strval($gender)) {
  87 + case '1,3': // 男
  88 + $channel = '1';
  89 + break;
  90 + case '2,3': // 女
  91 + $channel = '2';
  92 + break;
  93 + default: // 默认
  94 + $gender = '1,3';
  95 + $channel = '1';
  96 + break;
  97 + }
  98 +
  99 + if (USE_CACHE) {
  100 + $key = CacheConfig::KEY_ACTION_GUANG_PLUSSTAR_LIST . $channel;
  101 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  102 + $result = Cache::get($key, 'master');
  103 + if (!empty($result)) {
  104 + return $result;
  105 + }
  106 + }
  107 +
  108 + $result = array();
  109 + $brandList = PlusstarData::brandList($gender, $channel);
  110 + if (!empty($brandList['star']['data']['list'][0]['data'])) {
  111 + $result['ps']['star'] = self::formatData($brandList['star']['data']['list'][0]['data'], $gender, false);
  112 + $result['leftName'] = isset($brandList['star']['data']['brand_type_name']) ? $brandList['star']['data']['brand_type_name'] : '';
  113 + }
  114 + if (!empty($brandList['original']['data']['list'][0]['data'])) {
  115 + $result['ps']['plus'] = self::formatData($brandList['original']['data']['list'][0]['data'], $gender, true);
  116 + $result['leftName'] = isset($brandList['original']['data']['brand_type_name']) ? $brandList['original']['data']['brand_type_name'] : '';
  117 + }
  118 +
  119 + if (USE_CACHE) {
  120 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  121 + if (empty($result)) {
  122 + $result = Cache::get($key, 'slave');
  123 + }
  124 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  125 + else {
  126 + Cache::set($key, $result);
  127 + }
  128 + }
  129 +
  130 + return $result;
  131 + }
  132 +
  133 + /**
  134 + * 格式化成模板数据格式
  135 + *
  136 + * @param array $data 源数据
  137 + * @param string $gender "1,3"表示男, "2,3"表示女
  138 + * @param bool $showDesciption 控制是否显示摘要内容
  139 + * @return array
  140 + */
  141 + private static function formatData($data, $gender, $showSummary = true)
  142 + {
  143 + $result = array();
  144 +
  145 + $build = array();
  146 + $imgs = array();
  147 + foreach ($data as $value) {
  148 + $build = array();
  149 + // 情况1: 多张图
  150 + if (isset($value['data'][1])) {
  151 + $imgs = array();
  152 + foreach ($value['data'] as $ps) {
  153 + $build['url'] = '/guang/plusstar/detail?id=' . $value['id'] . '&gender=' . $gender;
  154 + $build['img'] = Helpers::getImageUrl($ps['src'], 640, 310);
  155 + $build['deps'] = $showSummary ? $value['brand_title'] : false;
  156 + $imgs[] = $build;
  157 + }
  158 + $result[] = array('imgs' => $imgs);
  159 + }
  160 + // 情况2: 单张图
  161 + elseif (isset($value['data'][0])) {
  162 + $build['url'] = '/guang/plusstar/detail?id=' . $value['id'] . '&gender=' . $gender;
  163 + $build['img'] = Helpers::getImageUrl($value['data'][0]['src'], 640, 310);
  164 + $build['deps'] = $showSummary ? $value['brand_title'] : false;
  165 + $result[] = $build;
  166 + }
  167 + }
  168 +
  169 + return $result;
  170 + }
  171 +
  172 +}
@@ -11,82 +11,39 @@ class PlusstarController extends AbstractAction @@ -11,82 +11,39 @@ class PlusstarController extends AbstractAction
11 { 11 {
12 12
13 /** 13 /**
14 - * 品牌列表页 14 + * 国际精选-品牌列表页
15 * 15 *
16 * @param int gender "1,3"表示男, "2,3"表示女 16 * @param int gender "1,3"表示男, "2,3"表示女
17 */ 17 */
18 - public function listAction() 18 + public function indexAction()
19 { 19 {
20 - $data = array('psList' => true, 'ps' => array('star' => array(), 'plus' => array()));  
21 -  
22 - $brandList = array();  
23 - $build = array();  
24 - $imgs = array(); 20 + $this->setTitle('国际优选');
  21 + $this->setNavHeader('国际优选', true, SITE_MAIN);
25 22
26 $gender = $this->get('gender', '1,3'); 23 $gender = $this->get('gender', '1,3');
27 - // 女  
28 - if ($gender === '2,3') {  
29 - $brandList = PlusstarData::brandList('2,3', 2);  
30 - }  
31 - // 男  
32 - else {  
33 - $brandList = PlusstarData::brandList('1,3', 1);  
34 - }  
35 24
36 - // 明星品牌列表  
37 - if (!empty($brandList['star']['data']['list'][0]['data'])) {  
38 - foreach ($brandList['star']['data']['list'][0]['data'] as $star) {  
39 - $imgs = array();  
40 - $build = array();  
41 -  
42 - // 情况1: 多张图  
43 - if (isset($star['data'][1])) {  
44 - foreach ($star['data'] as $value) {  
45 - $build['url'] = '/guang/plusstar/detail?id=' . $star['id'] . '&gender='.$gender;  
46 - $build['img'] = Helpers::getImageUrl($value['src'], 640, 310);  
47 - $imgs[] = $build;  
48 - }  
49 - $data['ps']['star'][] = array('imgs' => $imgs);  
50 - }  
51 - // 情况2: 单张图  
52 - elseif (isset($star['data'][0])) {  
53 - $build['url'] = '/guang/plusstar/detail?id=' . $star['id'] . '&gender='.$gender;  
54 - $build['img'] = Helpers::getImageUrl($star['data'][0]['src'], 640, 310);  
55 - $data['ps']['star'][] = $build;  
56 - }  
57 - }  
58 - } 25 + $data = Guang\PlusstarModel::getFirstBrands($gender);
  26 + $data['psList'] = true; // 控制模板中的JS使用
59 27
60 - // 原创品牌列表  
61 - if (!empty($brandList['original']['data']['list'][0]['data'])) {  
62 - foreach ($brandList['original']['data']['list'][0]['data'] as $original) {  
63 - $imgs = array();  
64 - $build = array();  
65 -  
66 - // 情况1: 多张图  
67 - if (isset($original['data'][1])) {  
68 - foreach ($original['data'] as $value) {  
69 - $build['url'] = '/guang/plusstar/detail?id=' . $original['id'] . '&gender='.$gender;  
70 - $build['img'] = Helpers::getImageUrl($value['src'], 640, 310);  
71 - $build['deps'] = $original['brand_title'];  
72 - $imgs[] = $build;  
73 - }  
74 - $data['ps']['plus'][] = array('imgs' => $imgs);  
75 - }  
76 - // 情况2: 单张图  
77 - elseif (isset($original['data'][0])) {  
78 - $build['url'] = '/guang/plusstar/detail?id=' . $original['id'] . '&gender='.$gender;  
79 - $build['img'] = Helpers::getImageUrl($original['data'][0]['src'], 640, 310);  
80 - $build['deps'] = $original['brand_title'];  
81 - $data['ps']['plus'][] = $build;  
82 - }  
83 - } 28 + $this->_view->display('index', $data);
84 } 29 }
85 30
86 - $this->_view->display('list', $data); 31 + /**
  32 + * 明星原创-品牌列表页
  33 + *
  34 + * @param int gender "1,3"表示男, "2,3"表示女
  35 + */
  36 + public function listAction()
  37 + {
  38 + $this->setTitle('明星原创');
  39 + $this->setNavHeader('明星原创', true, SITE_MAIN);
87 40
88 - $brandList = array();  
89 - $data = array(); 41 + $gender = $this->get('gender', '1,3');
  42 +
  43 + $data = Guang\PlusstarModel::getBrands($gender);
  44 + $data['psList'] = true; // 控制模板中的JS使用
  45 +
  46 + $this->_view->display('list', $data);
90 } 47 }
91 48
92 /** 49 /**
@@ -120,7 +77,7 @@ class PlusstarController extends AbstractAction @@ -120,7 +77,7 @@ class PlusstarController extends AbstractAction
120 $data['ps']['name'] = $brandInfo['getBrandInfo']['data']['brand_name']; 77 $data['ps']['name'] = $brandInfo['getBrandInfo']['data']['brand_name'];
121 $data['ps']['isLike'] = $brandInfo['getUidBrandFav']; 78 $data['ps']['isLike'] = $brandInfo['getUidBrandFav'];
122 $data['ps']['likeUrl'] = false; //"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&amp;openby:yohobuy={&quot;action&quot;:&quot;go.weblogin&quot;,&quot;params&quot;:{&quot;jumpurl&quot;:{&quot;url&quot;:&quot;http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo&quot;,&quot;param&quot;:{&quot;id&quot;:285}},&quot;requesturl&quot;:{&quot;url&quot;:&quot;\/guang\/api\/v1\/favorite\/togglebrand&quot;,&quot;param&quot;:{&quot;brand_id&quot;:&quot;701&quot;}},&quot;priority&quot;:&quot;Y&quot;}}"; 79 $data['ps']['likeUrl'] = false; //"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&amp;openby:yohobuy={&quot;action&quot;:&quot;go.weblogin&quot;,&quot;params&quot;:{&quot;jumpurl&quot;:{&quot;url&quot;:&quot;http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo&quot;,&quot;param&quot;:{&quot;id&quot;:285}},&quot;requesturl&quot;:{&quot;url&quot;:&quot;\/guang\/api\/v1\/favorite\/togglebrand&quot;,&quot;param&quot;:{&quot;brand_id&quot;:&quot;701&quot;}},&quot;priority&quot;:&quot;Y&quot;}}";
123 - $data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array('&nbsp;' => ' ') ); 80 + $data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array('&nbsp;' => ' '));
124 $data['ps']['newArrival'] = array(); 81 $data['ps']['newArrival'] = array();
125 $data['ps']['newArrival']['moreUrl'] = ''; // @todo 品牌列表页面 82 $data['ps']['newArrival']['moreUrl'] = ''; // @todo 品牌列表页面
126 $data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct']; 83 $data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct'];
@@ -136,7 +93,6 @@ class PlusstarController extends AbstractAction @@ -136,7 +93,6 @@ class PlusstarController extends AbstractAction
136 } 93 }
137 94
138 $brandInfo = array(); 95 $brandInfo = array();
139 -  
140 } while (false); 96 } while (false);
141 97
142 if (array() === $data) { 98 if (array() === $data) {