Authored by xuqi

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

@@ -46,7 +46,7 @@ class LoginData extends \LibModels\Wap\Passport\LoginData @@ -46,7 +46,7 @@ class LoginData extends \LibModels\Wap\Passport\LoginData
46 46
47 $param['client_secret'] = Sign::getSign($param); 47 $param['client_secret'] = Sign::getSign($param);
48 48
49 - return Yohobuy::get(Yohobuy::API_URL2, $param); 49 + return Yohobuy::get(Yohobuy::API_URL, $param);
50 } 50 }
51 51
52 } 52 }
@@ -2,33 +2,33 @@ @@ -2,33 +2,33 @@
2 namespace LibModels\Web\Product; 2 namespace LibModels\Web\Product;
3 3
4 use Api\Yohobuy; 4 use Api\Yohobuy;
5 -use Api\Sign;  
6 5
7 6
8 /** 7 /**
9 * 热销排行 8 * 热销排行
10 - *  
11 - * */ 9 + */
12 class HotrankData extends \LibModels\Wap\Product\SearchData 10 class HotrankData extends \LibModels\Wap\Product\SearchData
13 -{  
14 - const URI_HOTRANK_RES = '/operations/service/v4/resource';  
15 - const URI_HOTRANK_TAG = '/operations/api/v5/resource/get'; 11 +{
  12 + const URI_HOTRANK_TAG = 'http://test.service.api.yohobuy.com/operations/service/v1/hotranktag';
16 13
17 -  
18 /** 14 /**
19 - 获取热销排行  
20 - * 分类标签 15 + * 获取标签
  16 + * $client_type 客户端类型
  17 + * $channel 频道类型
21 */ 18 */
22 - public static function getHotranktag($client_type = 'web',$channel = 0, $is_concurrent = true, $callback = '') 19 + public static function getHotranktag($client_type = 'web',$channel = 0,$is_concurrent = true)
23 { 20 {
24 - // 构建必传参数  
25 - $params = Yohobuy::param();  
26 - $params['client_type'] = 'web';  
27 - $params['channel'] =$channel ;  
28 - $params['is_concurrent'] = true;  
29 - $params['callback'] = $callback;  
30 - $params['client_secret'] = Sign::getSign($params);  
31 - return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_HOTRANK_TAG, $params); 21 + $params = array('client_type'=>$client_type,'channel'=>$channel,'is_concurrent' => $is_concurrent);
  22 + return Yohobuy::yarClient(self::URI_HOTRANK_TAG, 'getTag',$params);
32 } 23 }
33 24
  25 + /**
  26 + * 通过ID获取标签信息
  27 + * $id 标签ID
  28 + */
  29 + public static function getTagById($id,$is_concurrent = true)
  30 + {
  31 + $params['id'] = $id;
  32 + return Yohobuy::yarClient(self::URI_HOTRANK_TAG, 'getOneTag',$params);
  33 + }
34 } 34 }
@@ -834,9 +834,8 @@ class Process @@ -834,9 +834,8 @@ class Process
834 { 834 {
835 $result = array(); 835 $result = array();
836 $temp = array(); 836 $temp = array();
837 - if ($data[$key]['template_name'] == 'custom_brands') 837 + if ($data[$key]['template_name'] == 'custom_brands' || $data[$key]['template_name'] == 'kids_brands')
838 { 838 {
839 - // print_r($data[$key]);  
840 $result = array( 839 $result = array(
841 'hotBrands' => array( 840 'hotBrands' => array(
842 'name' => '', 841 'name' => '',
@@ -856,7 +855,6 @@ class Process @@ -856,7 +855,6 @@ class Process
856 { 855 {
857 $width = 185; 856 $width = 185;
858 $height = 86; 857 $height = 86;
859 - $type = 'lifestyle';  
860 $val['src'] = Images::getImageUrl($val['src'], $width, $height, 2); 858 $val['src'] = Images::getImageUrl($val['src'], $width, $height, 2);
861 $val['url'] = Helpers::transUrl($val['url'], $type); 859 $val['url'] = Helpers::transUrl($val['url'], $type);
862 $floor['logoBrand'][] = array( 860 $floor['logoBrand'][] = array(
@@ -865,11 +863,8 @@ class Process @@ -865,11 +863,8 @@ class Process
865 ); 863 );
866 } 864 }
867 $floor['moreBrand'] = 'http://yohobuy.com/brands'; 865 $floor['moreBrand'] = 'http://yohobuy.com/brands';
868 - //$floor['moreBrand'] = 'http://yohobuy.com/brands?gender=1,3&openby:yohobuy={"action":"go.list","params":{"actiontype":0,"gender":"1,3"}}';  
869 - //print_r($floor);  
870 $type_key = sprintf("%s_%s", $type, $key); 866 $type_key = sprintf("%s_%s", $type, $key);
871 $cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key); 867 $cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key);
872 - //print_r($cacheKey);  
873 Cache::set($cacheKey, $floor, 7200); 868 Cache::set($cacheKey, $floor, 7200);
874 $result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key; 869 $result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key;
875 //print_r($result['hotBrands']['brandUrl']); 870 //print_r($result['hotBrands']['brandUrl']);
@@ -2,9 +2,14 @@ @@ -2,9 +2,14 @@
2 <div class="new-sale-page product-page yoho-page"> 2 <div class="new-sale-page product-page yoho-page">
3 {{# saleList}} 3 {{# saleList}}
4 {{# saleBanner}} 4 {{# saleBanner}}
5 - <div class="banner-img" style="height: {{bannerHeight}}px;background:url({{img}}) no-repeat top center;"></div> 5 + <div class="sale-list-banner" style="height: {{bannerHeight}}px;">
  6 + <ul style="height: {{bannerHeight}}px;">
  7 + {{# list}}
  8 + <li class="banner-img" style="background:url({{img}}) no-repeat top center;"></li>
  9 + {{/ list}}
  10 + </ul>
  11 + </div>
6 {{/ saleBanner}} 12 {{/ saleBanner}}
7 -  
8 <div class="center-content clearfix"> 13 <div class="center-content clearfix">
9 {{# saleTitle}} 14 {{# saleTitle}}
10 <div class="header-title"> 15 <div class="header-title">
@@ -144,7 +144,7 @@ @@ -144,7 +144,7 @@
144 {{!-- sale列表 --}} 144 {{!-- sale列表 --}}
145 {{#if saleListPage}} 145 {{#if saleListPage}}
146 <script> 146 <script>
147 - seajs.use(['js/product/list', 'js/product/product'], function (list, product) { 147 + seajs.use(['js/product/list', 'js/product/product', 'js/product/banner'], function (list, product) {
148 148
149 product.init(4); 149 product.init(4);
150 window.onresize = function () { 150 window.onresize = function () {
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 {{/ tags}} 25 {{/ tags}}
26 </div> 26 </div>
27 <div class="good-detail-img"> 27 <div class="good-detail-img">
28 - <a class="good-thumb" href="{{url}}"> 28 + <a class="good-thumb" href="{{url}}" target="_blank">
29 <img class="lazy" data-original="{{thumb}}"> 29 <img class="lazy" data-original="{{thumb}}">
30 </a> 30 </a>
31 {{# isFew}} 31 {{# isFew}}
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 {{/if}} 37 {{/if}}
38 </div> 38 </div>
39 <div class="good-detail-text"> 39 <div class="good-detail-text">
40 - <a href="{{url}}">{{name}}</a> 40 + <a href="{{url}}" target="_blank">{{name}}</a>
41 <p class="price"> 41 <p class="price">
42 {{# marketPrice}} 42 {{# marketPrice}}
43 <span class="market-price">¥{{.}}</span> 43 <span class="market-price">¥{{.}}</span>
@@ -417,6 +417,18 @@ function pwdFn($obj) { @@ -417,6 +417,18 @@ function pwdFn($obj) {
417 // Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题 417 // Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
418 // ( ▼-▼ )注册页和信息完善页面接口不同 418 // ( ▼-▼ )注册页和信息完善页面接口不同
419 exports.init = function(page) { 419 exports.init = function(page) {
  420 +
  421 + $('#agree-terms').click(function() {
  422 + if ($(this).attr('notchecked')) {
  423 + console.log(1);
  424 + $(this).removeAttr('notchecked');
  425 + } else {
  426 + console.log(2);
  427 + $(this).attr('notchecked', 'true');
  428 + }
  429 +
  430 + });
  431 +
420 $registerPage.find('.va').keyup(function() { 432 $registerPage.find('.va').keyup(function() {
421 433
422 var j, 434 var j,
@@ -438,7 +450,7 @@ exports.init = function(page) { @@ -438,7 +450,7 @@ exports.init = function(page) {
438 450
439 } 451 }
440 452
441 - if (statusLen === 4 && $('#agree-terms').is(':checked')) { 453 + if (statusLen === 4 && !$('#agree-terms').attr('notchecked')) {
442 $registerBtn.removeClass('disable').removeAttr('disabled'); 454 $registerBtn.removeClass('disable').removeAttr('disabled');
443 } else { 455 } else {
444 $registerBtn.addClass('disable').attr('disabled', 'true'); 456 $registerBtn.addClass('disable').attr('disabled', 'true');
@@ -515,18 +527,6 @@ exports.init = function(page) { @@ -515,18 +527,6 @@ exports.init = function(page) {
515 }); 527 });
516 528
517 // 防止粘贴密码 529 // 防止粘贴密码
518 - /*$('#pwd, #repwd').keydown(function (event) {  
519 -  
520 - console.log(event.ctrlKey);  
521 - console.log(isPwd);  
522 - console.log(event.keyCode);  
523 -  
524 - if (event.ctrlKey && isPwd && event.keyCode === 86) {  
525 - $(this).val(pwdVal);  
526 - }  
527 -  
528 - });*/  
529 -  
530 $pwd[0].onpaste = function() { 530 $pwd[0].onpaste = function() {
531 return false; 531 return false;
532 }; 532 };
  1 +/*
  2 + * author: chenglong
  3 + */
  4 +
  5 +var Slide = require('../common/yohoui/YH.slide');
  6 +var $ = require('yoho.jquery');
  7 +
  8 +var $contain = $('.sale-list-banner');
  9 +var $item = $contain.find('li');
  10 +var index = 0;
  11 +var pagationStr = '';
  12 +var pagationBoxStr = '';
  13 +var i;
  14 +var current = true;
  15 +var slide;
  16 +
  17 +for (i = 0; i < $item.length; i++) {
  18 +
  19 + if (i === 0) {
  20 + pagationStr += '<span class="active"></span>';
  21 + } else {
  22 + pagationStr += '<span></span>';
  23 + }
  24 +}
  25 +
  26 +pagationBoxStr = '<div class="sale-list-pagation"><div>' + pagationStr + '</div></div>';
  27 +
  28 +$contain.append($(pagationBoxStr));
  29 +
  30 +slide = new Slide({
  31 + length: $item.length,
  32 + loop: true,
  33 + auto: true,
  34 + timeout: 2,
  35 + index: 0
  36 +});
  37 +
  38 +
  39 +slide.on('change', function(data) {
  40 + if (current) {
  41 + current = false;
  42 + } else {
  43 + return;
  44 + }
  45 + index++;
  46 +
  47 +
  48 + $('.sale-list-pagation').find('span').removeClass('active');
  49 + $item.eq(data.from).animate({
  50 + opacity: 0
  51 + }, 300);
  52 + $item.eq(data.to).css({
  53 + zIndex: index
  54 + }).animate({
  55 + opacity: 1
  56 + }, 300, function() {
  57 + current = true;
  58 + });
  59 +
  60 + $('.sale-list-pagation').find('span').eq(data.to).addClass('active');
  61 +
  62 +});
  63 +
  64 +$contain.hover(function() {
  65 + if (current) {
  66 + slide.pause();
  67 + }
  68 +
  69 +}, function() {
  70 + slide.resume();
  71 +});
  72 +
  73 +$('.sale-list-pagation span').click(function() {
  74 +
  75 + var index = $(this).index();
  76 +
  77 + if (current) {
  78 + slide.go(index);
  79 + }
  80 +});
  81 +
  82 +slide.init();
@@ -117,6 +117,10 @@ $('.logo-brand').logoBrand({ @@ -117,6 +117,10 @@ $('.logo-brand').logoBrand({
117 var nowIndex = $(this).index(), 117 var nowIndex = $(this).index(),
118 sid = $(this).data('sid'); 118 sid = $(this).data('sid');
119 119
  120 + if ($(this).hasClass('current')) {
  121 + return;
  122 + }
  123 +
120 //处理current样式 124 //处理current样式
121 $(this).addClass('current').siblings().removeClass('current'); 125 $(this).addClass('current').siblings().removeClass('current');
122 $('.floatlayer').find('li').removeClass('current').eq(nowIndex).addClass('current'); 126 $('.floatlayer').find('li').removeClass('current').eq(nowIndex).addClass('current');
@@ -135,7 +139,11 @@ $('.logo-brand').logoBrand({ @@ -135,7 +139,11 @@ $('.logo-brand').logoBrand({
135 $('.floatlayer').on('click', 'li', function() { 139 $('.floatlayer').on('click', 'li', function() {
136 var nowIndex = $(this).index(); 140 var nowIndex = $(this).index();
137 141
138 - $('.hot-cate').find('li').trigger('click'); 142 + if ($(this).hasClass('current')) {
  143 + return;
  144 + }
  145 +
  146 + $('.hot-cate').find('li').eq(nowIndex).trigger('click');
139 147
140 //处理current样式 148 //处理current样式
141 $(this).addClass('current').siblings().removeClass('current'); 149 $(this).addClass('current').siblings().removeClass('current');
@@ -46,6 +46,9 @@ @@ -46,6 +46,9 @@
46 width: 209px; 46 width: 209px;
47 display: block; 47 display: block;
48 float: left; 48 float: left;
  49 + position: absolute;
  50 + top: 0;
  51 + right: 0;
49 } 52 }
50 53
51 &.captcha, &.msg-captcha{ 54 &.captcha, &.msg-captcha{
1 .new-sale-page { 1 .new-sale-page {
  2 +
  3 + /*Modify by chenglong.wang at 2016/1/18
  4 + *sale列表页面轮播图
  5 + */
  6 + .sale-list-banner {
  7 + width: 100%;
  8 + position: relative;
  9 +
  10 + ul {
  11 + overflow: hidden;
  12 + width: 100%;
  13 + position: relative;
  14 + z-index: 1;
  15 +
  16 + li {
  17 + width: 100%;
  18 + height: 100%;
  19 + display: block;
  20 + float: left;
  21 + position: absolute;
  22 + top: 0;
  23 + left: 0;
  24 + }
  25 + }
  26 +
  27 + .sale-list-pagation {
  28 + z-index: 2;
  29 + position: absolute;
  30 + left: 0;
  31 + bottom: 50px;
  32 + width: 100%;
  33 + height: 20px;
  34 + text-align: center;
  35 +
  36 + div {
  37 + display: inline-block;
  38 + }
  39 +
  40 + span {
  41 + display: block;
  42 + width: 20px;
  43 + height: 20px;
  44 + background: image_url('product/default-normal.png');
  45 + float: left;
  46 + margin: 0 10px;
  47 + cursor: pointer;
  48 +
  49 + &.active {
  50 + background: image_url('product/default-active.png');
  51 + }
  52 + }
  53 + }
  54 + }
  55 +
2 .header-title { 56 .header-title {
3 position: relative; 57 position: relative;
4 width: 100%; 58 width: 100%;
@@ -38,20 +38,14 @@ class BrandsController extends WebAction @@ -38,20 +38,14 @@ class BrandsController extends WebAction
38 */ 38 */
39 public function brandinfoAction() 39 public function brandinfoAction()
40 { 40 {
41 - $result = array();  
42 -  
43 do { 41 do {
44 /* 判断是不是AJAX请求 */ 42 /* 判断是不是AJAX请求 */
45 if (!$this->isAjax()) { 43 if (!$this->isAjax()) {
46 break; 44 break;
47 } 45 }
48 - $brandId = $this->get('brandId',0);  
49 - $uid=$this->getUid(false);  
50 - $brandId=144;  
51 - BrandsModel::getBrandInfo($brandId, $uid);  
52 -  
53 -  
54 - 46 + $brandId = $this->get('brandId', 0);
  47 + $uid = $this->getUid(false);
  48 + $data = BrandsModel::getBrandInfo($brandId, $uid);
55 $result = array( 49 $result = array(
56 'code' => 200, 50 'code' => 200,
57 'brand' => $data 51 'brand' => $data
@@ -62,9 +56,10 @@ class BrandsController extends WebAction @@ -62,9 +56,10 @@ class BrandsController extends WebAction
62 $this->echoJson($result); 56 $this->echoJson($result);
63 } 57 }
64 58
65 - /**  
66 - * 品牌一览 59 + /*
  60 + * 品牌list
67 */ 61 */
  62 +
68 public function indexAction() 63 public function indexAction()
69 { 64 {
70 $headerdata = array( 65 $headerdata = array(
@@ -7,6 +7,7 @@ use Plugin\HelperSearch; @@ -7,6 +7,7 @@ use Plugin\HelperSearch;
7 use LibModels\Web\Product\BrandData; 7 use LibModels\Web\Product\BrandData;
8 use Index\HomeModel; 8 use Index\HomeModel;
9 use Product\SearchModel; 9 use Product\SearchModel;
  10 +use Plugin\Helpers;
10 11
11 /** 12 /**
12 * 品牌首页模板数据模型 13 * 品牌首页模板数据模型
@@ -108,32 +109,41 @@ class BrandsModel @@ -108,32 +109,41 @@ class BrandsModel
108 { 109 {
109 $switchParams = self::switchBrandParams($channel); 110 $switchParams = self::switchBrandParams($channel);
110 $brandTop = array(); 111 $brandTop = array();
111 - /*  
112 - * $item1 = array(  
113 - 'name' => '所有品牌',  
114 - 'src' => $imgsrc,  
115 - 'url' => ''  
116 - );  
117 - */  
118 $brandAds = array(); 112 $brandAds = array();
119 $brandList = array(); 113 $brandList = array();
120 $res = BrandData::getTopBanner($switchParams['brandCode'], $switchParams['channelType']); 114 $res = BrandData::getTopBanner($switchParams['brandCode'], $switchParams['channelType']);
  115 + //头部10个品牌图块
  116 + if (isset($res['brandTop'][1]['data']['list']) && $res['brandTop'][1]['data']['list']) {
  117 + foreach ($res['brandTop'][1]['data']['list'] as $tbk => $tbv) {
  118 + $imgUrlTmp = explode("?", $tbv['src']);
  119 + $urlTmp = explode("?", $tbv['url']);
  120 + $topBrandTmp = array(
  121 + 'name' => $tbv['name'],
  122 + 'src' => Helpers::getImageUrl($imgUrlTmp[0], 80, 50, 3),
  123 + 'url' => str_replace('m.', '', $urlTmp[0]),
  124 + );
  125 + $brandAds[$tbk] = $topBrandTmp;
  126 + }
  127 + }
  128 + //头部品牌图块
121 if (isset($res['brandTop'][0]['data']) && $res['brandTop'][0]['data']) { 129 if (isset($res['brandTop'][0]['data']) && $res['brandTop'][0]['data']) {
122 foreach ($res['brandTop'][0]['data'] as $tk => $tv) { 130 foreach ($res['brandTop'][0]['data'] as $tk => $tv) {
123 - $imgUrl = explode("?", $tv['src']); 131 + $imgUrlTmp = explode("?", $tv['src']);
  132 + $urlTmp = explode("?", $tv['url']);
124 $topTmp = array( 133 $topTmp = array(
125 'name' => $tv['title'], 134 'name' => $tv['title'],
126 - 'src' => $imgUrl[0],  
127 - 'url' => $tv['url'],  
128 - 'items' => array() 135 + 'src' => $imgUrlTmp[0],
  136 + 'url' => $urlTmp[0],
  137 + 'items' => $brandAds
129 ); 138 );
130 $brandTop[$tk] = $topTmp; 139 $brandTop[$tk] = $topTmp;
131 } 140 }
132 } 141 }
  142 + //品牌list
133 if (isset($res['brandList']['brands']) && $res['brandList']['brands']) { 143 if (isset($res['brandList']['brands']) && $res['brandList']['brands']) {
134 foreach ($res['brandList']['brands'] as $lk => $lv) { 144 foreach ($res['brandList']['brands'] as $lk => $lv) {
  145 + $listTmp = array();
135 if (isset($lv) && $lv) { 146 if (isset($lv) && $lv) {
136 - $listTmp = array();  
137 foreach ($lv as $ltk => $ltv) { 147 foreach ($lv as $ltk => $ltv) {
138 $listTmp[$ltk] = array( 148 $listTmp[$ltk] = array(
139 'name' => $ltv['brand_name'], 149 'name' => $ltv['brand_name'],
@@ -158,33 +168,20 @@ class BrandsModel @@ -158,33 +168,20 @@ class BrandsModel
158 */ 168 */
159 public static function getBrandInfo($brandId, $uid) 169 public static function getBrandInfo($brandId, $uid)
160 { 170 {
161 - $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg';  
162 - $data = array(  
163 - 'key' => '1000011',  
164 - 'icon' => $imgsrc,  
165 - 'title' => '优显led触控台灯',  
166 - 'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯',  
167 - 'subtitle' => 'AAAAAA',  
168 - 'imgs' => array(  
169 - array(  
170 - 'src' => $imgsrc  
171 - ),  
172 - array(  
173 - 'src' => $imgsrc  
174 - ),  
175 - array(  
176 - 'src' => $imgsrc  
177 - )  
178 - )  
179 - ); 171 + $data = array();
180 $res = BrandData::getBrandIntro($brandId, $uid); 172 $res = BrandData::getBrandIntro($brandId, $uid);
181 -//if(isset($res['data']) && $res['data']){  
182 -// $data['key']=$brandId;  
183 -// $data['icon']=  
184 -//}  
185 - var_dump($res);  
186 - die();  
187 - 173 + if (isset($res['data']) && $res['data']) {
  174 + $icoUrlTmp = explode("?", $res['data']['brand_ico']) ;
  175 + $data = array(
  176 + 'key' => $res['data']['brand_id'],
  177 + 'icon' => $icoUrlTmp[0],
  178 + 'title' => $res['data']['brand_name'],
  179 + 'content' =>$res['data']['brand_intro'],
  180 + 'subtitle' => 'FEATURED ITEMS',
  181 + 'imgs' => array(),
  182 + );
  183 + }
  184 + return $data;
188 } 185 }
189 186
190 /* 187 /*
@@ -2,10 +2,9 @@ @@ -2,10 +2,9 @@
2 namespace product; 2 namespace product;
3 3
4 use Plugin\Images; 4 use Plugin\Images;
5 -use Plugin\Helpers;  
6 -use Plugin\Cache;  
7 -use Configs\CacheConfig;  
8 -use LibModels\Web\Home\IndexData; 5 +use Api\Yohobuy;
  6 +//use Plugin\Helpers;
  7 +//use LibModels\Web\Home\IndexData;
9 use \LibModels\Web\Product\HotrankData; 8 use \LibModels\Web\Product\HotrankData;
10 use \LibModels\Web\Product\SearchData; 9 use \LibModels\Web\Product\SearchData;
11 10
@@ -14,14 +13,14 @@ class HotrankModel { @@ -14,14 +13,14 @@ class HotrankModel {
14 /** 13 /**
15 * 人气单品 一周热卖 14 * 人气单品 一周热卖
16 */ 15 */
17 - static public function getSearchData($condition, $options) 16 + static public function getSearchData($param,$page,$ajax)
18 { 17 {
19 // 调用接口查询商品数据 18 // 调用接口查询商品数据
20 - $result = SearchData::searchElasticByCondition($condition); 19 + $result = SearchData::searchElasticByCondition($param);
21 //print_r($result); 20 //print_r($result);
22 21
23 if(!empty($result)){ 22 if(!empty($result)){
24 - $res = self::getProductList($result); 23 + $res = self::getProductList($result,$page,$ajax);
25 if(!empty($res['popular'])){ 24 if(!empty($res['popular'])){
26 $data['popular'] = $res['popular']; 25 $data['popular'] = $res['popular'];
27 } 26 }
@@ -37,18 +36,16 @@ class HotrankModel { @@ -37,18 +36,16 @@ class HotrankModel {
37 /** 36 /**
38 * 获取分类标签 37 * 获取分类标签
39 */ 38 */
40 - static public function getHotranktag($classes) 39 + static public function getHotranktag($client_type,$channel,$is_concurrent)
41 { 40 {
42 - $list = SearchData::getClassesData($classes);  
43 - //print_r($list); 41 + $list = \LibModels\Web\Product\HotrankData::getHotranktag($client_type,$channel,$is_concurrent);
44 $nav = array(); 42 $nav = array();
45 - if(!empty($list['data']['sort'])){  
46 - foreach($list['data']['sort'] as $li=>$lt){  
47 - $nav[$li]['sid'] = $lt['sort_id'];  
48 - $nav[$li]['textCn'] = $lt['sort_name']; 43 + if(!empty($list['data']['list'])){
  44 + foreach($list['data']['list'] as $li=>$lt){
  45 + $nav[$li]['sid'] = $lt['id'];
  46 + $nav[$li]['textCn'] = $lt['tag_name'];
49 } 47 }
50 } 48 }
51 - //print_r($nav);  
52 return $nav; 49 return $nav;
53 } 50 }
54 51
@@ -56,8 +53,10 @@ class HotrankModel { @@ -56,8 +53,10 @@ class HotrankModel {
56 /** 53 /**
57 * 人气单品 一周热卖 数据处理 54 * 人气单品 一周热卖 数据处理
58 */ 55 */
59 - static public function getProductList($result) 56 + static public function getProductList($result,$page,$ajax=0)
60 { 57 {
  58 + // 调用发起请求
  59 + Yohobuy::yarConcurrentLoop();
61 /*----product start---------*/ 60 /*----product start---------*/
62 if(empty($result) || empty($result['data']) || empty($result['data']['product_list'])){ 61 if(empty($result) || empty($result['data']) || empty($result['data']['product_list'])){
63 return; 62 return;
@@ -83,26 +82,35 @@ class HotrankModel { @@ -83,26 +82,35 @@ class HotrankModel {
83 $product_id = empty($val['product_id']) ? '' : $val['product_id']; 82 $product_id = empty($val['product_id']) ? '' : $val['product_id'];
84 $re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html'; 83 $re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
85 84
86 - $re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];  
87 - $re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];  
88 - $re['name'] = $val['product_name'];  
89 - if($key <= 9){  
90 - $re['rank'] = $key + 1;  
91 - if($key <= 5){  
92 - $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);  
93 - $popular['list'][] = $re;  
94 - }else{  
95 - $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);  
96 - $popular['list'][] = $re;  
97 - }  
98 - }else{  
99 - $re['rank'] = '';  
100 - $re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);  
101 - $hot[] = $re;  
102 - } 85 + $re['name'] = $val['product_name'];
  86 + if($key <= 9 && $page == 1 && $ajax == 0){
  87 + $re['rank'] = $key + 1;
  88 + if($key <= 5){
  89 + $re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
  90 + $re['sPrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
  91 + $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
  92 + $popular['list'][] = $re;
  93 + }else{
  94 + $re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
  95 + $re['sPrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
  96 + $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
  97 + $popular['list'][] = $re;
  98 + }
  99 + }else if ($ajax == 1){
  100 + $re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
  101 + $re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
  102 + $re['rank'] = '';
  103 + $re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
  104 + $hot[] = $re;
  105 + }else{
  106 + $re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
  107 + $re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
  108 + $re['rank'] = '';
  109 + $re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
  110 + $hot[] = $re;
  111 + }
103 } 112 }
104 $popular['name'] = '人气单品'; 113 $popular['name'] = '人气单品';
105 -  
106 $hotWeek = array( 114 $hotWeek = array(
107 'name'=>'一周热卖', 115 'name'=>'一周热卖',
108 'list'=>$hot, 116 'list'=>$hot,
@@ -112,6 +112,7 @@ class LoginController extends WebAction @@ -112,6 +112,7 @@ class LoginController extends WebAction
112 /* 设置登录有效时间30分钟, 防机器刷 */ 112 /* 设置登录有效时间30分钟, 防机器刷 */
113 $expire = $this->getSession('_LOGIN_EXPIRE'); 113 $expire = $this->getSession('_LOGIN_EXPIRE');
114 if (empty($expire) || $expire < time()) { 114 if (empty($expire) || $expire < time()) {
  115 + $data = array('code' => 400, 'message' => '页面停留时间过长,请刷新页面', 'data' => '');
115 break; 116 break;
116 } 117 }
117 118
@@ -135,13 +136,13 @@ class LoginController extends WebAction @@ -135,13 +136,13 @@ class LoginController extends WebAction
135 } 136 }
136 137
137 $refer = $this->getCookie('refer'); 138 $refer = $this->getCookie('refer');
138 - if (empty($refer)) {  
139 - $refer = SITE_MAIN . '/?go=1'; 139 + if (empty($refer) || strstr($refer, 'signin.html') || strstr($refer, 'passport/login/index')) {
  140 + $refer = SITE_MAIN;
140 } 141 }
141 else { 142 else {
142 $refer = rawurldecode($refer); 143 $refer = rawurldecode($refer);
143 } 144 }
144 - $data['data']['session'] = Helpers::syncUserSession($data['data']['uid']); 145 + $data['data']['session'] = Helpers::syncUserSession($data['data']['uid'],$refer);
145 $data['data']['href'] = $refer; 146 $data['data']['href'] = $refer;
146 147
147 $token = Helpers::makeToken($data['data']['uid']); 148 $token = Helpers::makeToken($data['data']['uid']);
@@ -2,12 +2,16 @@ @@ -2,12 +2,16 @@
2 use Action\WebAction; 2 use Action\WebAction;
3 use LibModels\Web\Product\BrandData; 3 use LibModels\Web\Product\BrandData;
4 4
5 -use LibModels\Web\Product\HotrankData; 5 +use \LibModels\Web\Product\HotrankData;
6 use product\HotrankModel; 6 use product\HotrankModel;
7 use LibModels\Web\Home\IndexData; 7 use LibModels\Web\Home\IndexData;
8 8
9 class IndexController extends WebAction 9 class IndexController extends WebAction
10 { 10 {
  11 + public $channel;
  12 + public $gender;
  13 + public $road;//频道
  14 + public $code;
11 /** 15 /**
12 * 品牌首页 16 * 品牌首页
13 */ 17 */
@@ -53,7 +57,7 @@ class IndexController extends WebAction @@ -53,7 +57,7 @@ class IndexController extends WebAction
53 } 57 }
54 58
55 public function hotrankAction() { 59 public function hotrankAction() {
56 - $this->setWebNavHeader(\Index\HomeModel::COOKIE_NAME_LIFESTYLE); 60 +
57 $data = array( 61 $data = array(
58 'hotrankPage' => true, 62 'hotrankPage' => true,
59 'hotrank' => array( 63 'hotrank' => array(
@@ -261,30 +265,124 @@ class IndexController extends WebAction @@ -261,30 +265,124 @@ class IndexController extends WebAction
261 ) 265 )
262 ) 266 )
263 ); 267 );
  268 +
  269 +
  270 + $cookie = $this->getCookie('_Channel');
  271 + $cookie = 'lifestyle';
  272 + $this->channel = isset($cookie) ? $cookie : 'boys';
  273 + switch ($this->channel){
  274 + case 'boys' :
  275 + $this->gender = '1,3';
  276 + $this->road = 1;
  277 + $this->code = '80d772d8dff25300a2a2e4c97165330c';
  278 + break;
  279 + case 'girls' :
  280 + $this->gender = '2,3';
  281 + $this->road = 2;
  282 + $this->code = '8df64e505e94edb9881fd1e7efb702e9';
  283 + break;
  284 + case 'lifestyle' :
  285 + $this->gender = '';
  286 + $this->road = 4;
  287 + $this->code = 'd131aba83a84a6977eee3a7403a713de';
  288 + break;
  289 + case 'kids' :
  290 + $this->gender = '';
  291 + $this->road = 3;
  292 + $this->code = 'bd6a06a08f8ca9b0db762f78e0bc5b68';
  293 + break;
  294 +
  295 + }
  296 + $this->setWebNavHeader(\Index\HomeModel::$this->channel);
264 $data = array( 'hotrankPage' => true, 297 $data = array( 'hotrankPage' => true,
265 'footerTop'=> true, 298 'footerTop'=> true,
266 'hotrank' => array() 299 'hotrank' => array()
267 ); 300 );
268 //焦点图 热门品牌 301 //焦点图 热门品牌
269 - $focus = \Index\HomeModel::getChannelResource('lifestyle', 'd131aba83a84a6977eee3a7403a713de');  
270 - //print_r($focus); 302 + $focus = \Index\HomeModel::getChannelResource($this->channel, $this->code);
271 $data['hotrank']['slide'] = $focus[0]['slide']; 303 $data['hotrank']['slide'] = $focus[0]['slide'];
272 $data['hotrank']['hotBrands'] = $focus[1]['hotBrands']; 304 $data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
273 305
274 //人气单品 一周热卖 306 //人气单品 一周热卖
275 - $page = 1;  
276 - $param = array('order'=>'s_n_desc','viewNum'=>60,'page'=>1,'stocknumber'=>1,'status'=>1,'gender'=>'','attribute_not'=>2);  
277 - $publiclist = \product\HotrankModel::getSearchData($param,$page); 307 + $page = $this->get('page',1);
  308 + $sort_id = $this->get('sid',0);
  309 + $viewNum = 60;
  310 + $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$this->gender,'attribute_not'=>2);
  311 + if($sort_id != 0){
  312 + $param['sort'] = $sort_id;
  313 + }
  314 + if($this->road == 3){
  315 + $param['msort'] = 365;
  316 + }elseif($this->road == 4){
  317 + $param['msort'] = 10;
  318 + }else{
  319 + $param['not_maxSortId'] = '10,365';
  320 + }
  321 + $publiclist = \product\HotrankModel::getSearchData($param,$page,0);
278 $data['hotrank']['popular'] = $publiclist['popular']; 322 $data['hotrank']['popular'] = $publiclist['popular'];
279 $data['hotrank']['hotWeek'] = $publiclist['hotWeek']; 323 $data['hotrank']['hotWeek'] = $publiclist['hotWeek'];
280 - //print_r($publiclist);  
281 - 324 +
282 //分类标签 325 //分类标签
283 - $classes = array('gender' => 2);  
284 - $nav = \product\HotrankModel::getHotranktag($classes);  
285 - $data['hotrank']['hotWeek']['nav'] = $nav;  
286 - //print_r($data); 326 + $nav = \product\HotrankModel::getHotranktag('web',$this->road,true);
  327 + $data['hotrank']['hotWeek']['nav'] = $nav;
287 $this->_view->display('hotrank', $data); 328 $this->_view->display('hotrank', $data);
288 } 329 }
  330 +
  331 + /*
  332 + * 一周热卖加载更多
  333 + */
  334 + public function getdataAction()
  335 + {
  336 + $page = $this->get('page',1);
  337 + //加载到100个以后停止
  338 + if($page > 2)
  339 + {
  340 + echo json_encode(array('code'=>201,'data'=>''));
  341 + exit;
  342 + }
  343 + $sid = $this->get('sid',1);
  344 + $sort = '';
  345 + //是否是默认标签
  346 + if($sid > 1)
  347 + {
  348 + //通过ID获取标签信息
  349 + $info = \LibModels\Web\Product\HotrankData::getTagById($sid, false);
  350 + if(!empty($info['data']))
  351 + {
  352 + $sort = $info['data']['category_id'];
  353 + }
  354 + }
  355 + $viewNum = 60;
  356 + //过滤掉赠品
  357 + $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1,'gender'=>$this->gender,
  358 + 'attribute_not'=>2);
  359 + if(empty($param['sort']))
  360 + {
  361 + if($this->road == 3)
  362 + {
  363 + $param['msort'] = 365;
  364 + }elseif($this->road == 4){
  365 + $param['msort'] = 10;
  366 + }else{
  367 + $param['not_maxSortId'] = '10,365';
  368 + }
  369 + }
  370 +
  371 + $list = \product\HotrankModel::getSearchData($param, $page, 1);
  372 + $lister = $list['hotWeek']['list'];
  373 + $lister = array_values($lister);
  374 + if($sid == 1 && $page == 1)
  375 + {
  376 + $lister = array_slice($lister, 10, 50);
  377 + }else{
  378 + $lister = array_slice($lister, 0, 50);
  379 + }
  380 + $data = array(
  381 + 'code'=>200,
  382 + 'data'=>$lister,
  383 + );
  384 + echo json_encode($data);
  385 + exit;
  386 + }
289 } 387 }
290 ?> 388 ?>
@@ -166,7 +166,32 @@ class Sale1Controller extends WebAction @@ -166,7 +166,32 @@ class Sale1Controller extends WebAction
166 'saleList' => array( 166 'saleList' => array(
167 'saleBanner' => array( 167 'saleBanner' => array(
168 'bannerHeight' => 350, 168 'bannerHeight' => 350,
169 - 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg' 169 + 'list' => array(
  170 + array(
  171 + 'bannerHeight' => 350,
  172 + 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'
  173 + ),
  174 + array(
  175 + 'bannerHeight' => 350,
  176 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/06/05/02062366574a01418596caa38a773f6beb.jpg?imageView/1/w/1150/h/450'
  177 + ),
  178 + array(
  179 + 'bannerHeight' => 350,
  180 + 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/01/06/05/013341a0632177cc3425c3c6082845be57.jpg?imageView/1/w/1150/h/450'
  181 + ),
  182 + array(
  183 + 'bannerHeight' => 350,
  184 + 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'
  185 + ),
  186 + array(
  187 + 'bannerHeight' => 350,
  188 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/06/05/02062366574a01418596caa38a773f6beb.jpg?imageView/1/w/1150/h/450'
  189 + ),
  190 + array(
  191 + 'bannerHeight' => 350,
  192 + 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/01/06/05/013341a0632177cc3425c3c6082845be57.jpg?imageView/1/w/1150/h/450'
  193 + )
  194 + )
170 ), 195 ),
171 'saleTitle' => array( 196 'saleTitle' => array(
172 'name' => '全部商品', 197 'name' => '全部商品',