Authored by 郭成尧

'rcmnd4umerge'

@@ -22,21 +22,21 @@ class Yohobuy @@ -22,21 +22,21 @@ class Yohobuy
22 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 22 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
23 23
24 //java API 24 //java API
25 - // const API_URL = 'http://api.yoho.yohoops.org/';//  
26 - // const API_URL2 = 'http://api.yoho.yohoops.org/';//  
27 - // const SERVICE_URL = 'http://service.yoho.yohoops.org/';  
28 - // const YOHOBUY_URL = 'http://www.yohobuy.com/';  
29 - // const API_OLD = 'http://api2.open.yohobuy.com/';  
30 - // 支付回调地址  
31 - // const SERVICE_NOTIFY = 'http://service.yoho.cn/';  
32 - 25 + // const API_URL = 'http://api.yoho.yohoops.org/';//
  26 + // const API_URL2 = 'http://api.yoho.yohoops.org/';//
  27 + // const SERVICE_URL = 'http://service.yoho.yohoops.org/';
  28 + // const YOHOBUY_URL = 'http://www.yohobuy.com/';
  29 + // const API_OLD = 'http://api2.open.yohobuy.com/';
  30 + // 支付回调地址
  31 + // const SERVICE_NOTIFY = 'http://service.yoho.cn/';
  32 +
33 // 测试环境 */ 33 // 测试环境 */
34 - const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'  
35 - const SERVICE_URL = 'http://testservice.yoho.cn:28077/';  
36 - const YOHOBUY_URL = 'http://www.yohobuy.com/';  
37 - const API_OLD = 'http://test2.open.yohobuy.com/';  
38 -// 支付回调地址  
39 - const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/'; 34 + const API_URL = 'http://testapi.yoho.cn:28078/'; // http://testapi.yoho.cn:28078/ http://devapi.yoho.cn:58078/
  35 + const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; // http://testservice.yoho.cn:28077/ http://devservice.yoho.cn:58077/
  36 + const YOHOBUY_URL = 'http://www.yohobuy.com/';
  37 + const API_OLD = 'http://test2.open.yohobuy.com/';
  38 +// 支付回调地址
  39 + const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';
40 40
41 /* 预览环境 */ 41 /* 预览环境 */
42 // const API_URL = 'http://preapi.yoho.cn/'; 42 // const API_URL = 'http://preapi.yoho.cn/';
@@ -44,13 +44,13 @@ class Yohobuy @@ -44,13 +44,13 @@ class Yohobuy
44 // const SERVICE_URL = 'http://preservice.yoho.cn/'; 44 // const SERVICE_URL = 'http://preservice.yoho.cn/';
45 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 45 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
46 // const API_OLD = 'http://api2.open.yohobuy.com/'; 46 // const API_OLD = 'http://api2.open.yohobuy.com/';
47 - 47 +
48 /** 48 /**
49 * 登录老接口Api配置 49 * 登录老接口Api配置
50 */ 50 */
51 const API_LOGIN_URL = 'http://api.open.yohobuy.com'; 51 const API_LOGIN_URL = 'http://api.open.yohobuy.com';
52 const API_LOGIN_URL_TEST = 'http://test.open.yohobuy.com'; 52 const API_LOGIN_URL_TEST = 'http://test.open.yohobuy.com';
53 - 53 +
54 /** 54 /**
55 * 私钥列表 55 * 私钥列表
56 * 56 *
@@ -63,7 +63,7 @@ class Yohobuy @@ -63,7 +63,7 @@ class Yohobuy
63 'web' => '0ed29744ed318fd28d2c07985d3ba633', 63 'web' => '0ed29744ed318fd28d2c07985d3ba633',
64 'h5' => 'fd4ad5fcfa0de589ef238c0e7331b585', 64 'h5' => 'fd4ad5fcfa0de589ef238c0e7331b585',
65 ); 65 );
66 - 66 +
67 67
68 68
69 /** 69 /**
@@ -77,7 +77,7 @@ class Yohobuy @@ -77,7 +77,7 @@ class Yohobuy
77 else { 77 else {
78 return 'web'; 78 return 'web';
79 } 79 }
80 - 80 +
81 // // 苹果设备 81 // // 苹果设备
82 // if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) { 82 // if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
83 // return 'iphone'; 83 // return 'iphone';
@@ -187,7 +187,7 @@ class Yohobuy @@ -187,7 +187,7 @@ class Yohobuy
187 curl_setopt($ch, CURLOPT_HEADER, 0); 187 curl_setopt($ch, CURLOPT_HEADER, 0);
188 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 188 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
189 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 189 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
190 - if ($useGzip) { 190 + if ($useGzip) {
191 curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); 191 curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
192 } 192 }
193 if (!empty($userAgent)) { 193 if (!empty($userAgent)) {
@@ -230,7 +230,7 @@ class Yohobuy @@ -230,7 +230,7 @@ class Yohobuy
230 public static function post($url, $data = array(), $returnJson = false, $timeout = 10, $header = array(), $cookie = array()) 230 public static function post($url, $data = array(), $returnJson = false, $timeout = 10, $header = array(), $cookie = array())
231 { 231 {
232 $ch = curl_init($url); 232 $ch = curl_init($url);
233 - 233 +
234 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 234 curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
235 if (!empty($header)) { 235 if (!empty($header)) {
236 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 236 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
@@ -352,7 +352,7 @@ class Yohobuy @@ -352,7 +352,7 @@ class Yohobuy
352 continue; 352 continue;
353 } 353 }
354 $result[$name] = $response['data']; 354 $result[$name] = $response['data'];
355 - } 355 + }
356 else { 356 else {
357 $result[$name] = $response; 357 $result[$name] = $response;
358 } 358 }
@@ -496,7 +496,7 @@ class Yohobuy @@ -496,7 +496,7 @@ class Yohobuy
496 496
497 return $result; 497 return $result;
498 } 498 }
499 - 499 +
500 /** 500 /**
501 * 获取用户User-Agent 501 * 获取用户User-Agent
502 * @return bool 502 * @return bool
@@ -508,7 +508,7 @@ class Yohobuy @@ -508,7 +508,7 @@ class Yohobuy
508 } 508 }
509 return $_SERVER['HTTP_USER_AGENT']; 509 return $_SERVER['HTTP_USER_AGENT'];
510 } 510 }
511 - 511 +
512 /** 512 /**
513 * 判断是否手机 513 * 判断是否手机
514 * @return bool 514 * @return bool
@@ -28,7 +28,7 @@ class UserData @@ -28,7 +28,7 @@ class UserData
28 28
29 /** 29 /**
30 * 根据email获取用户信息 30 * 根据email获取用户信息
31 - * 31 + *
32 * @param string $email 32 * @param string $email
33 * @return array 33 * @return array
34 */ 34 */
@@ -149,7 +149,7 @@ class UserData @@ -149,7 +149,7 @@ class UserData
149 * 修改用户习惯信息 149 * 修改用户习惯信息
150 * @param array $params 需要修改的参数集合 150 * @param array $params 需要修改的参数集合
151 * uid:用户ID 151 * uid:用户ID
152 - * shopping:购物习惯 字符串 1 152 + * shopping:购物习惯 字符串 1
153 * dress:着装习惯 字符串 1,2 153 * dress:着装习惯 字符串 1,2
154 */ 154 */
155 public static function editUserHabitsInfo($params) 155 public static function editUserHabitsInfo($params)
@@ -217,13 +217,23 @@ class UserData @@ -217,13 +217,23 @@ class UserData
217 * 个人中心页面优选新品数据 217 * 个人中心页面优选新品数据
218 * 218 *
219 * @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活 219 * @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
  220 + * @param $uid 用户ID
  221 + * @param $udid 设备ID
  222 + * @param $rec_pos 位置码
  223 + * @param $limit 数量限制
220 * @return array 接口返回的数据 224 * @return array 接口返回的数据
221 */ 225 */
222 - public static function preference($channel) 226 + public static function newPreference($channel, $uid, $udid, $rec_pos, $limit)
223 { 227 {
224 $param = Yohobuy::param(); 228 $param = Yohobuy::param();
225 - $param['method'] = 'app.home.preference'; 229 + $param['method'] = 'app.home.newPreference';
226 $param['yh_channel'] = $channel; 230 $param['yh_channel'] = $channel;
  231 + if ($uid != 0 && $uid != null) {
  232 + $param['uid'] = $uid;
  233 + }
  234 + $param['udid'] = $udid;
  235 + $param['rec_pos'] = $rec_pos;
  236 + $param['limit'] = $limit;
227 $param['client_secret'] = Sign::getSign($param); 237 $param['client_secret'] = Sign::getSign($param);
228 238
229 return Yohobuy::get(Yohobuy::API_URL, $param); 239 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -453,7 +463,7 @@ class UserData @@ -453,7 +463,7 @@ class UserData
453 463
454 /** 464 /**
455 * 获取省市区县的列表数据 465 * 获取省市区县的列表数据
456 - * 466 + *
457 * @param int $id ID 467 * @param int $id ID
458 * @return array 468 * @return array
459 */ 469 */
@@ -492,8 +502,7 @@ class UserData @@ -492,8 +502,7 @@ class UserData
492 if (!empty($id)) { // 修改 502 if (!empty($id)) { // 修改
493 $param['id'] = $id; 503 $param['id'] = $id;
494 $param['method'] = 'app.address.update'; 504 $param['method'] = 'app.address.update';
495 - }  
496 - else { // 添加 505 + } else { // 添加
497 $param['method'] = 'app.address.add'; 506 $param['method'] = 'app.address.add';
498 } 507 }
499 508
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="default-me-page me-page yoho-page clearfix"> 2 <div class="default-me-page me-page yoho-page clearfix">
3 {{# me}} 3 {{# me}}
4 - {{> home/path}} 4 + {{> home/path}}
5 5
6 - {{> home/navigation}} 6 + {{> home/navigation}}
7 7
8 - <div class="me-main">  
9 - {{# content}}  
10 - {{#if messages}}  
11 - <p class="message-tip">  
12 - 消息提示:  
13 - {{# messages}}  
14 - <a href="{{href}}">{{name}}</a>  
15 - <b>({{count}})</b>  
16 - {{/ messages}} 8 + <div class="me-main">
  9 + {{# content}}
  10 + {{#if messages}}
  11 + <p class="message-tip">
  12 + 消息提示:
  13 + {{# messages}}
  14 + <a href="{{href}}">{{name}}</a>
  15 + <b>({{count}})</b>
  16 + {{/ messages}}
17 17
18 - <span id="close-message" class="close iconfont">&#xe602;</span>  
19 - </p>  
20 - {{/if}} 18 + <span id="close-message" class="close iconfont">&#xe602;</span>
  19 + </p>
  20 + {{/if}}
21 21
22 - {{# latestOrders}}  
23 - <div class="latest-orders block">  
24 - <h2 class="title">  
25 - <a class="more-orders more" href="{{more}}">  
26 - 更多订单  
27 - </a>  
28 - </h2>  
29 - {{> home/order-block}}  
30 - </div>  
31 - {{/ latestOrders}} 22 + {{# latestOrders}}
  23 + <div class="latest-orders block">
  24 + <h2 class="title">
  25 + <a class="more-orders more" href="{{more}}">
  26 + 更多订单
  27 + </a>
  28 + </h2>
  29 + {{> home/order-block}}
  30 + </div>
  31 + {{/ latestOrders}}
32 32
33 - {{# favBrand}}  
34 - <div class="brands block">  
35 - <h2 class="title">  
36 - <a class="more-orders more" href="{{more}}">  
37 - 更多品牌  
38 - </a>  
39 - </h2>  
40 - <ul class="clearfix">  
41 - {{# brands}}  
42 - <li>  
43 - <a href="{{href}}">  
44 - <img class="brand-logo" src="{{logo}}">  
45 - <span class="brand-name">{{name}}</span>  
46 - </a>  
47 - </li>  
48 - {{/ brands}}  
49 - </ul>  
50 - </div>  
51 - {{/ favBrand}} 33 + {{# favBrand}}
  34 + <div class="brands block">
  35 + <h2 class="title">
  36 + <a class="more-orders more" href="{{more}}">
  37 + 更多品牌
  38 + </a>
  39 + </h2>
  40 + <ul class="clearfix">
  41 + {{# brands}}
  42 + <li>
  43 + <a href="{{href}}">
  44 + <img class="brand-logo" src="{{logo}}">
  45 + <span class="brand-name">{{name}}</span>
  46 + </a>
  47 + </li>
  48 + {{/ brands}}
  49 + </ul>
  50 + </div>
  51 + {{/ favBrand}}
52 52
53 - {{#if newArrival}}  
54 - <div class="new-arrival block">  
55 - <h2 class="title">  
56 - <p class="na-pager-wrap"> 53 + {{#if newArrival}}
  54 + <div class="new-arrival block">
  55 + <h2 class="title">
  56 + <p class="na-pager-wrap">
57 <span class="na-pager pre no-visible"> 57 <span class="na-pager pre no-visible">
58 <i class="iconfont">&#xe622;</i> 58 <i class="iconfont">&#xe622;</i>
59 </span> 59 </span>
60 <span class="na-pager next"> 60 <span class="na-pager next">
61 <i class="iconfont">&#xe621;</i> 61 <i class="iconfont">&#xe621;</i>
62 </span> 62 </span>
63 - </p>  
64 - </h2>  
65 - <ul class="clearfix">  
66 - {{# newArrival}}  
67 - <li>  
68 - <a href="{{href}}">  
69 - <img class="thumb" src="{{thumb}}">  
70 - <p class="name">{{name}}</p>  
71 - <span class="price">¥{{price}}</span>  
72 - </a>  
73 - </li>  
74 - {{/ newArrival}}  
75 - </ul>  
76 - </div>  
77 - {{/if}} 63 + </p>
  64 + </h2>
  65 + <ul class="clearfix">
  66 + {{# newArrival}}
  67 + <li>
  68 + <a href="{{href}}">
  69 + <img class="thumb" src="{{thumb}}">
  70 + <p class="name">{{name}}</p>
  71 + <span class="price">¥{{price}}</span>
  72 + </a>
  73 + </li>
  74 + {{/ newArrival}}
  75 + </ul>
  76 + </div>
  77 + {{/if}}
78 78
79 - {{{banner}}}  
80 - {{/ content}}  
81 79
82 - {{> home/help-us}}  
83 - </div> 80 + {{/ content}}
  81 +
  82 +
  83 + </div>
  84 + <!--recommend-for-you-->
  85 + {{#if recommend}}
  86 + <div class="recommend block">
  87 + <h2 class="title">
  88 + <p class="na-pager-wrap">
  89 + <span class="rc-pager pre no-visible">
  90 + <i class="iconfont">&#xe622;</i>
  91 + </span>
  92 + <span class="rc-pager next">
  93 + <i class="iconfont">&#xe621;</i>
  94 + </span>
  95 + </p>
  96 + </h2>
  97 + <ul class="clearfix">
  98 + {{# recommend}}
  99 + <li>
  100 + <a href="{{href}}">
  101 + <img class="thumb" src="{{thumb}}">
  102 + <p class="name">{{name}}</p>
  103 + <span class="price">¥{{price}}</span>
  104 + </a>
  105 + </li>
  106 + {{/ recommend}}
  107 + </ul>
  108 + </div>
  109 + {{/if}}
  110 + <!--recommend-for-you-->
  111 + <div class="ho-btm">
  112 + {{{banner}}}
  113 + {{> home/help-us}}
  114 + </div>
84 {{/ me}} 115 {{/ me}}
85 </div> 116 </div>
86 {{> layout/footer}} 117 {{> layout/footer}}
@@ -201,8 +201,8 @@ function getTogetherProduct($obj, url, page) { @@ -201,8 +201,8 @@ function getTogetherProduct($obj, url, page) {
201 }); 201 });
202 } 202 }
203 203
204 -// 最近浏览  
205 -getTogetherProduct($histroy, '/cart/index/getHistroyProduct'); 204 +// 为你优选
  205 +getTogetherProduct($histroy, '/cart/index/getRecommendProduct');
206 206
207 // 凑单商品 207 // 凑单商品
208 getTogetherProduct($together, '/cart/index/getTogetherProduct'); 208 getTogetherProduct($together, '/cart/index/getTogetherProduct');
@@ -215,7 +215,7 @@ $together.on('click', '.pagenext, .pageprev', function() { @@ -215,7 +215,7 @@ $together.on('click', '.pagenext, .pageprev', function() {
215 215
216 }); 216 });
217 217
218 -//凑单商品,历史商品商品折叠 218 +//凑单商品,为你优选商品商品折叠
219 $shopCart.on('click', '.icon-minus, .icon-add', function() { 219 $shopCart.on('click', '.icon-minus, .icon-add', function() {
220 if ($(this).hasClass('icon-minus')) { 220 if ($(this).hasClass('icon-minus')) {
221 $(this).parents('.title').next('.main').hide(); 221 $(this).parents('.title').next('.main').hide();
@@ -236,7 +236,7 @@ $histroy.on('click', '.pagenext, .pageprev', function() { @@ -236,7 +236,7 @@ $histroy.on('click', '.pagenext, .pageprev', function() {
236 } else { 236 } else {
237 --pageNum > 0 || (pageNum = 1); 237 --pageNum > 0 || (pageNum = 1);
238 } 238 }
239 - getTogetherProduct($histroy, '/cart/index/getHistroyProduct', { 239 + getTogetherProduct($histroy, '/cart/index/getRecommendProduct', {
240 page: pageNum 240 page: pageNum
241 }); 241 });
242 242
@@ -281,15 +281,16 @@ function productInfo(data) { @@ -281,15 +281,16 @@ function productInfo(data) {
281 $('.detail-bigpic:not(.none) .bigpic:gt(0)').hide(); 281 $('.detail-bigpic:not(.none) .bigpic:gt(0)').hide();
282 282
283 $('.showSizeBox:not(.none)').find('span').each(function() { 283 $('.showSizeBox:not(.none)').find('span').each(function() {
284 - if ($(this).hasClass('null-atcivec')) {  
285 - $('.addcart').addClass('none');  
286 - $('.btn_sellout').removeClass('none');  
287 - } else {  
288 - $('.addcart').removeClass('none');  
289 - $('.btn_sellout').addClass('none');  
290 - return false;  
291 - }  
292 - }); 284 + if ($(this).hasClass('null-atcivec')) {
  285 + $('.addcart').addClass('none');
  286 + $('.btn_sellout').removeClass('none');
  287 + } else {
  288 + $('.addcart').removeClass('none');
  289 + $('.btn_sellout').addClass('none');
  290 + return false;
  291 + }
  292 + });
  293 +
293 }); 294 });
294 } 295 }
295 296
@@ -314,7 +315,7 @@ $payWapper.on('click', '.cart-add-btn', function() { @@ -314,7 +315,7 @@ $payWapper.on('click', '.cart-add-btn', function() {
314 }); 315 });
315 }); 316 });
316 317
317 -//凑单商品,历史商品商品记录 318 +//凑单商品,为你优选商品商品记录
318 $('.clearfix').on('click', '.btn_view_s', function() { 319 $('.clearfix').on('click', '.btn_view_s', function() {
319 productId = $(this).data('id'); 320 productId = $(this).data('id');
320 promotionId = $(this).parents('table').data('promotion'); 321 promotionId = $(this).parents('table').data('promotion');
@@ -13,55 +13,92 @@ $('#close-message').click(function() { @@ -13,55 +13,92 @@ $('#close-message').click(function() {
13 $('.message-tip').slideUp(200); 13 $('.message-tip').slideUp(200);
14 }); 14 });
15 15
  16 +/**
  17 + *
  18 + * @param self 点击的控件
  19 + * @param $ul 列表父
  20 + * @param page 总共页数
  21 + * @param itemWith 子元素宽
  22 + * @param curPage 当前页码
  23 + * @param num 一页商品数量
  24 + */
  25 +function pageChange(self, $ul, page, itemWith, curPage, num) {
  26 + var $this = self,
  27 + left;
  28 +
  29 + if ($this.hasClass('next')) {
  30 +
  31 + //第2页显示前翻按钮
  32 + if (curPage === 2) {
  33 + $this.siblings().removeClass('no-visible');
  34 + }
  35 +
  36 + //最后一页隐藏后翻按钮
  37 + if (curPage === page) {
  38 + $this.addClass('no-visible');
  39 + }
  40 + } else {
  41 +
  42 + //倒数第2页显示后翻按钮
  43 + if (curPage === page - 1) {
  44 + $this.siblings().removeClass('no-visible');
  45 + }
  46 +
  47 + //第1页隐藏前翻按钮
  48 + if (curPage === 1) {
  49 + $this.addClass('no-visible');
  50 + }
  51 + }
  52 +
  53 + left = -num * (curPage - 1) * itemWith;
  54 +
  55 + $ul.animate({
  56 + marginLeft: left
  57 + }, 400);
  58 +}
  59 +
16 //新品上架 60 //新品上架
17 (function() { 61 (function() {
18 var $naPager = $('.na-pager'), 62 var $naPager = $('.na-pager'),
  63 + $rcPager = $('.rc-pager'),
19 $naUl = $('.new-arrival ul'), 64 $naUl = $('.new-arrival ul'),
  65 + $rcUl = $('.recommend ul'),
20 naPage = Math.ceil($naUl.children('li').length / 5), 66 naPage = Math.ceil($naUl.children('li').length / 5),
  67 + rcPage = Math.ceil($rcUl.children('li').length / 6),
21 naItemWith = $naUl.children('li:last-child').outerWidth(), 68 naItemWith = $naUl.children('li:last-child').outerWidth(),
22 - naCurPage = 1; 69 + rcItemWith = $rcUl.children('li:last-child').outerWidth(),
  70 + naCurPage = 1,
  71 + rcCurPage = 1;
23 72
24 $naUl.width($naUl.width() * naPage); 73 $naUl.width($naUl.width() * naPage);
  74 + $rcUl.width($rcUl.width() * rcPage);
25 75
26 //最新上架翻页 76 //最新上架翻页
27 $naPager.click(function() { 77 $naPager.click(function() {
28 - var $this = $(this),  
29 - left;  
30 -  
31 - if ($this.hasClass('next')) {  
32 -  
33 - //后翻  
34 - ++naCurPage;  
35 -  
36 - //第2页显示前翻按钮  
37 - if (naCurPage === 2) {  
38 - $this.siblings().removeClass('no-visible');  
39 - } 78 + var $this = $(this);
40 79
41 - //最后一页隐藏后翻按钮  
42 - if (naCurPage === naPage) {  
43 - $this.addClass('no-visible'); 80 + if (naPage > 1) {
  81 + if ($this.hasClass('next')) {
  82 + ++naCurPage;
  83 + } else {
  84 + --naCurPage;
44 } 85 }
45 - } else { 86 + pageChange($this, $naUl, naPage, naItemWith, naCurPage, 5);
  87 + }
  88 + });
46 89
47 - //前翻  
48 - --naCurPage; 90 + //为你推荐翻页
  91 + $rcPager.click(function() {
  92 + var $this = $(this);
49 93
50 - //倒数第2页显示后翻按钮  
51 - if (naCurPage === naPage - 1) {  
52 - $this.siblings().removeClass('no-visible'); 94 + if (rcPage > 1) {
  95 + if ($this.hasClass('next')) {
  96 + ++rcCurPage;
  97 + } else {
  98 + --rcCurPage;
53 } 99 }
54 100
55 - //第1页隐藏前翻按钮  
56 - if (naCurPage === 1) {  
57 - $this.addClass('no-visible');  
58 - } 101 + pageChange($this, $rcUl, rcPage, rcItemWith, rcCurPage, 6);
59 } 102 }
60 -  
61 - left = -5 * (naCurPage - 1) * naItemWith;  
62 -  
63 - $naUl.animate({  
64 - marginLeft: left  
65 - }, 400);  
66 }); 103 });
67 }()); 104 }());
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 } 81 }
82 } 82 }
83 83
84 - .new-arrival { 84 + .new-arrival,.recommend {
85 overflow: hidden; 85 overflow: hidden;
86 86
87 .na-pager-wrap { 87 .na-pager-wrap {
@@ -144,6 +144,25 @@ @@ -144,6 +144,25 @@
144 } 144 }
145 } 145 }
146 146
  147 + .recommend {
  148 + margin-bottom: 10px;
  149 +
  150 + ul {
  151 + width: 990px;
  152 + }
  153 +
  154 + li {
  155 + width: 106px;
  156 + }
  157 + }
  158 +
  159 +
  160 +
  161 + .ho-btm{
  162 + float: right;
  163 + width: 800px;
  164 + }
  165 +
147 .banner { 166 .banner {
148 display: block; 167 display: block;
149 width: 800px; 168 width: 800px;
@@ -161,4 +180,8 @@ @@ -161,4 +180,8 @@
161 .new-arrival .title { 180 .new-arrival .title {
162 background-image: resolve(/home/new-arrival.png); 181 background-image: resolve(/home/new-arrival.png);
163 } 182 }
  183 +
  184 + .recommend .title {
  185 + background-image: resolve(/home/recommend.png);
  186 + }
164 } 187 }
@@ -139,6 +139,7 @@ @@ -139,6 +139,7 @@
139 .me-main { 139 .me-main {
140 float: left; 140 float: left;
141 width: 800px; 141 width: 800px;
  142 + min-height: 945px;
142 } 143 }
143 144
144 .me-pager { 145 .me-pager {
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace Home; 3 namespace Home;
4 4
5 use Home\UserModel; 5 use Home\UserModel;
  6 +use LibModels\Web\Home\UserData;
6 use LibModels\Web\Product\BrandData; 7 use LibModels\Web\Product\BrandData;
7 use WebPlugin\Helpers; 8 use WebPlugin\Helpers;
8 use WebPlugin\HelperHome; 9 use WebPlugin\HelperHome;
@@ -75,6 +76,25 @@ class IndexModel @@ -75,6 +76,25 @@ class IndexModel
75 } 76 }
76 77
77 /** 78 /**
  79 + * @param $channel
  80 + * @param $uid
  81 + * @param $udid
  82 + * @param $recPos
  83 + * @param $limit
  84 + * @return array
  85 + */
  86 + public static function preferenceData($channel, $uid, $udid, $recPos, $limit)
  87 + {
  88 + $response = UserData::newPreference($channel, $uid, $udid, $recPos, $limit);
  89 +
  90 + if ($response['code'] === 200) {
  91 + return HelperHome::formatNew($response['data']['product_list']);
  92 + } else {
  93 + return array();
  94 + }
  95 + }
  96 +
  97 + /**
78 * 底部banner 98 * 底部banner
79 * @param string $code 99 * @param string $code
80 * @return mixed 100 * @return mixed
@@ -82,7 +102,7 @@ class IndexModel @@ -82,7 +102,7 @@ class IndexModel
82 public static function getFooterBanner($code = '20110609-152143') 102 public static function getFooterBanner($code = '20110609-152143')
83 { 103 {
84 104
85 - $banner = BrandData::getByNodeContent($code); 105 + $banner = BrandData::getByNodeContent($code);
86 if (isset($banner['code']) && !empty($banner['data'])) { 106 if (isset($banner['code']) && !empty($banner['data'])) {
87 return $banner['data']; 107 return $banner['data'];
88 } 108 }
@@ -16,7 +16,7 @@ use Configs\ChannelConfig; @@ -16,7 +16,7 @@ use Configs\ChannelConfig;
16 16
17 /** 17 /**
18 * 购物车相关的模板数据模型 18 * 购物车相关的模板数据模型
19 - * 19 + *
20 * @name CartModel 20 * @name CartModel
21 * @package Shopping 21 * @package Shopping
22 * @copyright yoho.inc 22 * @copyright yoho.inc
@@ -30,7 +30,7 @@ class CartModel @@ -30,7 +30,7 @@ class CartModel
30 30
31 /** 31 /**
32 * 获取我的购物车数据 32 * 获取我的购物车数据
33 - * 33 + *
34 * @param int $uid 当前登录用户ID 34 * @param int $uid 当前登录用户ID
35 * @param string $shoppingKey 购物车在浏览器的唯一识别码 35 * @param string $shoppingKey 购物车在浏览器的唯一识别码
36 * @param mixed $cartDelList 删除的商品列表 36 * @param mixed $cartDelList 删除的商品列表
@@ -39,7 +39,7 @@ class CartModel @@ -39,7 +39,7 @@ class CartModel
39 public static function myCartData($uid, $shoppingKey, $cartDelList) 39 public static function myCartData($uid, $shoppingKey, $cartDelList)
40 { 40 {
41 $result = array(); 41 $result = array();
42 - 42 +
43 // 存放分析用的数据 43 // 存放分析用的数据
44 $analysisData = array('ipinyou' => ''); 44 $analysisData = array('ipinyou' => '');
45 45
@@ -59,7 +59,7 @@ class CartModel @@ -59,7 +59,7 @@ class CartModel
59 $result['isEmpty'] = true; 59 $result['isEmpty'] = true;
60 $result['guangUrl'] = Helpers::url('', null, 'list'); 60 $result['guangUrl'] = Helpers::url('', null, 'list');
61 $result['viewOrderUrl'] = Helpers::url('/home/orders', array('t' => time())); 61 $result['viewOrderUrl'] = Helpers::url('/home/orders', array('t' => time()));
62 - UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'shoppingKey:'.$shoppingKey); 62 + UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'shoppingKey:' . $shoppingKey);
63 break; 63 break;
64 } 64 }
65 65
@@ -107,16 +107,14 @@ class CartModel @@ -107,16 +107,14 @@ class CartModel
107 $result['productAllA'] = Helpers::transPrice($advanceCartData['shopping_cart_data']['last_order_amount']); 107 $result['productAllA'] = Helpers::transPrice($advanceCartData['shopping_cart_data']['last_order_amount']);
108 // 获赠YOHO币个数 108 // 获赠YOHO币个数
109 $result['getYoho'] = $advanceCartData['shopping_cart_data']['gain_yoho_coin']; 109 $result['getYoho'] = $advanceCartData['shopping_cart_data']['gain_yoho_coin'];
110 - }  
111 - // 普通的 110 + } // 普通的
112 elseif ($ordinaryCount !== 0 && $advanceCount === 0) { 111 elseif ($ordinaryCount !== 0 && $advanceCount === 0) {
113 //$result['productAmmount'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['order_amount']); 112 //$result['productAmmount'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['order_amount']);
114 $result['productAmmount'] = self::genProductAmount($ordinaryCartData['shopping_cart_data']['promotion_formula_list'], $ordinaryCartData['shopping_cart_data']['order_amount']); 113 $result['productAmmount'] = self::genProductAmount($ordinaryCartData['shopping_cart_data']['promotion_formula_list'], $ordinaryCartData['shopping_cart_data']['order_amount']);
115 $result['activeSale'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['discount_amount']); 114 $result['activeSale'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['discount_amount']);
116 $result['productAllA'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['last_order_amount']); 115 $result['productAllA'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['last_order_amount']);
117 $result['getYoho'] = $ordinaryCartData['shopping_cart_data']['gain_yoho_coin']; 116 $result['getYoho'] = $ordinaryCartData['shopping_cart_data']['gain_yoho_coin'];
118 - }  
119 - // 所有的 117 + } // 所有的
120 else { 118 else {
121 $result['productAmmount'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['order_amount'] + $advanceCartData['shopping_cart_data']['order_amount']); 119 $result['productAmmount'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['order_amount'] + $advanceCartData['shopping_cart_data']['order_amount']);
122 $result['activeSale'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['discount_amount'] + $advanceCartData['shopping_cart_data']['discount_amount']); 120 $result['activeSale'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['discount_amount'] + $advanceCartData['shopping_cart_data']['discount_amount']);
@@ -185,8 +183,7 @@ class CartModel @@ -185,8 +183,7 @@ class CartModel
185 // 普通的 183 // 普通的
186 if (!empty($ordinaryCartData['promotion_info'])) { 184 if (!empty($ordinaryCartData['promotion_info'])) {
187 $result['salesPromotion'] = self::buildPromotionData($ordinaryCartData['promotion_info']); 185 $result['salesPromotion'] = self::buildPromotionData($ordinaryCartData['promotion_info']);
188 - }  
189 - // 预售的 186 + } // 预售的
190 elseif (!empty($advanceCartData['promotion_info'])) { 187 elseif (!empty($advanceCartData['promotion_info'])) {
191 //$result['salesPromotion'] = array_merge($result['salesPromotion'], self::buildPromotionData($advanceCartData['promotion_info'])); 188 //$result['salesPromotion'] = array_merge($result['salesPromotion'], self::buildPromotionData($advanceCartData['promotion_info']));
192 $result['salesPromotion'] = self::buildPromotionData($advanceCartData['promotion_info']); 189 $result['salesPromotion'] = self::buildPromotionData($advanceCartData['promotion_info']);
@@ -196,9 +193,9 @@ class CartModel @@ -196,9 +193,9 @@ class CartModel
196 $advanceCartData = array(); 193 $advanceCartData = array();
197 $ordinaryCartData = array(); 194 $ordinaryCartData = array();
198 $cartData = array(); 195 $cartData = array();
199 - 196 +
200 } while (false); 197 } while (false);
201 - 198 +
202 // 增加第三方分析用的数据 199 // 增加第三方分析用的数据
203 $result['ids'] = empty($analysisData['ids']) ? '' : implode(',', $analysisData['ids']); 200 $result['ids'] = empty($analysisData['ids']) ? '' : implode(',', $analysisData['ids']);
204 $result['ipinyou'] = empty($analysisData['ipinyou']) ? '' : $analysisData['ipinyou']; 201 $result['ipinyou'] = empty($analysisData['ipinyou']) ? '' : $analysisData['ipinyou'];
@@ -227,8 +224,8 @@ class CartModel @@ -227,8 +224,8 @@ class CartModel
227 $addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey); 224 $addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);
228 if ($addCart && isset($addCart['code'])) { 225 if ($addCart && isset($addCart['code'])) {
229 $result = $addCart; 226 $result = $addCart;
230 - }else{  
231 - UdpLog::info('【购物车】校验参数传递auth','productSku:'.$productSku.'buyNumber:'.$buyNumber.'goodsType:'.$goodsType,'isEdit:'.$isEdit.'promotionId:'.$promotionId.'uid:'.$uid.'shoppingKey:'.$shoppingKey); 227 + } else {
  228 + UdpLog::info('【购物车】校验参数传递auth', 'productSku:' . $productSku . 'buyNumber:' . $buyNumber . 'goodsType:' . $goodsType, 'isEdit:' . $isEdit . 'promotionId:' . $promotionId . 'uid:' . $uid . 'shoppingKey:' . $shoppingKey);
232 } 229 }
233 230
234 return $result; 231 return $result;
@@ -249,7 +246,7 @@ class CartModel @@ -249,7 +246,7 @@ class CartModel
249 246
250 do { 247 do {
251 if (empty($skuList)) { 248 if (empty($skuList)) {
252 - UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList); 249 + UdpLog::info('【购物车】校验参数传递auth', 'skuList:' . $skuList);
253 break; 250 break;
254 } 251 }
255 252
@@ -257,8 +254,8 @@ class CartModel @@ -257,8 +254,8 @@ class CartModel
257 if ($select && isset($select['code'])) { 254 if ($select && isset($select['code'])) {
258 $result['code'] = $select['code']; 255 $result['code'] = $select['code'];
259 $result['message'] = $select['message']; 256 $result['message'] = $select['message'];
260 - }else{  
261 - UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'shoppingKey:'.$shoppingKey.'hasPromotion:'.$hasPromotion); 257 + } else {
  258 + UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
262 } 259 }
263 } while (false); 260 } while (false);
264 261
@@ -281,7 +278,7 @@ class CartModel @@ -281,7 +278,7 @@ class CartModel
281 278
282 do { 279 do {
283 if (empty($skuList)) { 280 if (empty($skuList)) {
284 - UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList); 281 + UdpLog::info('【购物车】校验参数传递auth', 'skuList:' . $skuList);
285 break; 282 break;
286 } 283 }
287 284
@@ -292,8 +289,8 @@ class CartModel @@ -292,8 +289,8 @@ class CartModel
292 if (isset($remove['data']['goods_count'])) { 289 if (isset($remove['data']['goods_count'])) {
293 $result['total_goods_num'] = $remove['data']['goods_count']; 290 $result['total_goods_num'] = $remove['data']['goods_count'];
294 } 291 }
295 - }else{  
296 - UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'shoppingKey:'.$shoppingKey.'hasPromotion:'.$hasPromotion); 292 + } else {
  293 + UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
297 } 294 }
298 } while (false); 295 } while (false);
299 296
@@ -321,7 +318,7 @@ class CartModel @@ -321,7 +318,7 @@ class CartModel
321 } 318 }
322 319
323 if (empty($skuList)) { 320 if (empty($skuList)) {
324 - UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList); 321 + UdpLog::info('【购物车】校验参数传递auth', 'skuList:' . $skuList);
325 break; 322 break;
326 } 323 }
327 324
@@ -329,8 +326,8 @@ class CartModel @@ -329,8 +326,8 @@ class CartModel
329 if ($add && isset($add['code'])) { 326 if ($add && isset($add['code'])) {
330 $result['code'] = $add['code']; 327 $result['code'] = $add['code'];
331 $result['message'] = $add['message']; 328 $result['message'] = $add['message'];
332 - }else{  
333 - UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'hasPromotion:'.$hasPromotion); 329 + } else {
  330 + UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'hasPromotion:' . $hasPromotion);
334 } 331 }
335 } while (false); 332 } while (false);
336 333
@@ -353,7 +350,7 @@ class CartModel @@ -353,7 +350,7 @@ class CartModel
353 350
354 do { 351 do {
355 if (empty($sku)) { 352 if (empty($sku)) {
356 - UdpLog::info('【购物车】校验参数传递auth','sku:'.$sku); 353 + UdpLog::info('【购物车】校验参数传递auth', 'sku:' . $sku);
357 break; 354 break;
358 } 355 }
359 356
@@ -361,8 +358,8 @@ class CartModel @@ -361,8 +358,8 @@ class CartModel
361 if ($modify && isset($modify['code'])) { 358 if ($modify && isset($modify['code'])) {
362 $result['code'] = $modify['code']; 359 $result['code'] = $modify['code'];
363 $result['message'] = $modify['message']; 360 $result['message'] = $modify['message'];
364 - }else{  
365 - UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'sku:'.$sku,'increaseNum:'.$increaseNum.'decreaseNum:'.$decreaseNum.'shoppingKey:'.$shoppingKey); 361 + } else {
  362 + UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'sku:' . $sku, 'increaseNum:' . $increaseNum . 'decreaseNum:' . $decreaseNum . 'shoppingKey:' . $shoppingKey);
366 } 363 }
367 } while (false); 364 } while (false);
368 365
@@ -371,7 +368,7 @@ class CartModel @@ -371,7 +368,7 @@ class CartModel
371 368
372 /** 369 /**
373 * 获取凑单商品 370 * 获取凑单商品
374 - * 371 + *
375 * @param int $page 分页页码 372 * @param int $page 分页页码
376 * @return array 373 * @return array
377 */ 374 */
@@ -420,8 +417,115 @@ class CartModel @@ -420,8 +417,115 @@ class CartModel
420 } 417 }
421 418
422 /** 419 /**
  420 + * 获取为你优选商品 待处理
  421 + *
  422 + * @param $channel 频道
  423 + * @param $uid 用户id
  424 + * @param $udid 设备id
  425 + * @param int $page 分页页码
  426 + * @return array
  427 + * @internal param $rec_pos
  428 + * @internal param $limit
  429 + */
  430 + public static function getRecommendProduct($channel, $uid, $udid, $page)
  431 + {
  432 + $result = array('code' => 200, 'message' => '', 'data' => array('header' => '为你优选', 'hasPrev' => false, 'hasNext' => false, 'item' => array()));
  433 +
  434 + do {
  435 + if (!is_numeric($page)) {
  436 + break;
  437 + }
  438 +
  439 + $channelNum = 1;
  440 + switch ($channel) {
  441 + case 'boys':
  442 + $channelNum = 1;
  443 + break;
  444 + case 'girls':
  445 + $channelNum = 2;
  446 + break;
  447 + case 'kids':
  448 + $channelNum = 3;
  449 + break;
  450 + case 'lifestyle':
  451 + $channelNum = 4;
  452 + break;
  453 + default:
  454 + break;
  455 + }
  456 +
  457 + $together = UserData::newPreference($channelNum, $uid, $udid, '100003', 30);
  458 + if (empty($together['data']['product_list'])) {
  459 + break;
  460 + }
  461 +
  462 + $result['data']['hasNext'] = true;
  463 + $result['data']['hasPrev'] = true;
  464 +
  465 + $build = array();
  466 + $begin = 0;
  467 + $end = 0;
  468 + switch ($page) {
  469 + case 1:
  470 + $begin = 0;
  471 + $end = 5;
  472 + break;
  473 + case 2:
  474 + $begin = 6;
  475 + $end = 11;
  476 + break;
  477 + case 3:
  478 + $begin = 12;
  479 + $end = 17;
  480 + break;
  481 + case 4:
  482 + $begin = 18;
  483 + $end = 23;
  484 + break;
  485 + case 5:
  486 + $begin = 18;
  487 + $end = 23;
  488 + break;
  489 + case 6:
  490 + $begin = 24;
  491 + $end = 30;
  492 + break;
  493 + default:
  494 + $begin = 0;
  495 + $end = 5;
  496 + break;
  497 + }
  498 + foreach ($together['data']['product_list'] as $key => $value) {
  499 + if ($key >= $begin && $key <= $end) {
  500 + $build = array();
  501 + $build['id'] = $value['product_id'];
  502 + $build['skn'] = $value['product_skn'];
  503 + $build['href'] = Helpers::getUrlBySkc($value['product_id'], $value['goods_list'][0]['product_skc'], $value['cn_alphabet']);;
  504 + $build['title'] = $value['product_name'];
  505 + $build['img'] = Helpers::getImageUrl($value['default_images'], 100, 100);
  506 + $build['alt'] = $value['product_name'];
  507 + $build['price'] = $value['price']['sales_price'];
  508 + if ($value['price']['sales_price'] !== $value['price']['market_price']) {
  509 + $build['marketPrice'] = $value['price']['market_price'];
  510 + }
  511 +
  512 + $result['data']['item'][] = $build;
  513 + }
  514 + }
  515 +
  516 + // 当数据量不足6个时,判定为没有下一页
  517 + if ($page == 1 && !isset($result['data']['item'][5])) {
  518 + $result['data']['hasPrev'] = false;
  519 + $result['data']['hasNext'] = false;
  520 + }
  521 + } while (false);
  522 +
  523 + return $result;
  524 + }
  525 +
  526 + /**
423 * 获取最近浏览商品 527 * 获取最近浏览商品
424 - * 528 + *
425 * @param int $page 分页页码 529 * @param int $page 分页页码
426 * @return array 530 * @return array
427 */ 531 */
@@ -436,7 +540,7 @@ class CartModel @@ -436,7 +540,7 @@ class CartModel
436 540
437 $browse = CartData::browseRecord($uid, $udid, $page, 6); 541 $browse = CartData::browseRecord($uid, $udid, $page, 6);
438 if (empty($browse['data']['product_list'])) { 542 if (empty($browse['data']['product_list'])) {
439 - UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'udid'.$udid.'page'.$page); 543 + UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'udid' . $udid . 'page' . $page);
440 break; 544 break;
441 } 545 }
442 546
@@ -476,7 +580,7 @@ class CartModel @@ -476,7 +580,7 @@ class CartModel
476 580
477 /** 581 /**
478 * 基于本地浏览器Cookie的指定浏览记录 582 * 基于本地浏览器Cookie的指定浏览记录
479 - * 583 + *
480 * @param int $page 页码 584 * @param int $page 页码
481 * @param int $limit 限制数 585 * @param int $limit 限制数
482 * @return array 586 * @return array
@@ -595,8 +699,7 @@ class CartModel @@ -595,8 +699,7 @@ class CartModel
595 if ($value['payment_type'] == 1 && $value['is_support'] === 'Y') { 699 if ($value['payment_type'] == 1 && $value['is_support'] === 'Y') {
596 $result['onlinePay']['checked'] = $isDefault ? true : false; 700 $result['onlinePay']['checked'] = $isDefault ? true : false;
597 $result['onlinePay']['paymentId'] = $value['payment_id']; 701 $result['onlinePay']['paymentId'] = $value['payment_id'];
598 - }  
599 - // 货到付款 702 + } // 货到付款
600 elseif ($value['payment_type'] == 2 && $value['is_support'] === 'Y') { 703 elseif ($value['payment_type'] == 2 && $value['is_support'] === 'Y') {
601 $result['deliveryPay']['checked'] = $isDefault ? true : false; 704 $result['deliveryPay']['checked'] = $isDefault ? true : false;
602 $result['deliveryPay']['paymentId'] = $value['payment_id']; 705 $result['deliveryPay']['paymentId'] = $value['payment_id'];
@@ -609,9 +712,9 @@ class CartModel @@ -609,9 +712,9 @@ class CartModel
609 } 712 }
610 } 713 }
611 // tar add 1605061351 货到付款提示信息处理 714 // tar add 1605061351 货到付款提示信息处理
612 - if(isset($pay['data']['payment_way'])){ 715 + if (isset($pay['data']['payment_way'])) {
613 foreach ($pay['data']['payment_way'] as $item) { 716 foreach ($pay['data']['payment_way'] as $item) {
614 - if($item['payment_type'] === 2){ 717 + if ($item['payment_type'] === 2) {
615 $result['paymentInCashInfo'] = $item['is_support_message']; 718 $result['paymentInCashInfo'] = $item['is_support_message'];
616 } 719 }
617 } 720 }
@@ -778,8 +881,7 @@ class CartModel @@ -778,8 +881,7 @@ class CartModel
778 881
779 //JIT拆单需求 package 882 //JIT拆单需求 package
780 $result['packages'] = self::getPackageInfo($pay['data']['shopping_cart_data']); 883 $result['packages'] = self::getPackageInfo($pay['data']['shopping_cart_data']);
781 - }  
782 - while (false); 884 + } while (false);
783 885
784 return $result; 886 return $result;
785 } 887 }
@@ -797,17 +899,17 @@ class CartModel @@ -797,17 +899,17 @@ class CartModel
797 if ($isMulti) { 899 if ($isMulti) {
798 $packageList = $cartInfo['package_list']; 900 $packageList = $cartInfo['package_list'];
799 foreach ($packageList as $pk => $pv) { 901 foreach ($packageList as $pk => $pv) {
800 - $pIndex = $pk+1;  
801 - $packages[$pk]['title'] = ($pv['supplier_id'] == 0) ? '包裹'.$pIndex.':总仓发货' : '包裹'.$pIndex.':异地调拨'; //仓库 902 + $pIndex = $pk + 1;
  903 + $packages[$pk]['title'] = ($pv['supplier_id'] == 0) ? '包裹' . $pIndex . ':总仓发货' : '包裹' . $pIndex . ':异地调拨'; //仓库
802 $goodList = $pv['goods_list']; 904 $goodList = $pv['goods_list'];
803 foreach ($goodList as $glk => $glv) { 905 foreach ($goodList as $glk => $glv) {
804 $packages[$pk]['goodlist'][$glk]['src'] = Images::getImageUrl($glv['goods_images'], 90, 90); 906 $packages[$pk]['goodlist'][$glk]['src'] = Images::getImageUrl($glv['goods_images'], 90, 90);
805 - $tagInfo= isset(ChannelConfig::$orderTagArr[$glv['goods_type']])?ChannelConfig::$orderTagArr[$glv['goods_type']]:'';  
806 - $packages[$pk]['goodlist'][$glk]['goodsType'] =!empty($tagInfo['name'])?$tagInfo['name']:false;  
807 - $packages[$pk]['goodlist'][$glk]['classname'] =!empty($tagInfo['classname'])?$tagInfo['classname']:false; 907 + $tagInfo = isset(ChannelConfig::$orderTagArr[$glv['goods_type']]) ? ChannelConfig::$orderTagArr[$glv['goods_type']] : '';
  908 + $packages[$pk]['goodlist'][$glk]['goodsType'] = !empty($tagInfo['name']) ? $tagInfo['name'] : false;
  909 + $packages[$pk]['goodlist'][$glk]['classname'] = !empty($tagInfo['classname']) ? $tagInfo['classname'] : false;
808 $packages[$pk]['goodlist'][$glk]['link'] = 'javascript:void(0)'; 910 $packages[$pk]['goodlist'][$glk]['link'] = 'javascript:void(0)';
809 } 911 }
810 - $packages[$pk]['fee'] = ($pv['shopping_cost']=='0.00')?false:$pv['shopping_cost']; 912 + $packages[$pk]['fee'] = ($pv['shopping_cost'] == '0.00') ? false : $pv['shopping_cost'];
811 $packages[$pk]['orign'] = $pv['shopping_orig_cost']; 913 $packages[$pk]['orign'] = $pv['shopping_orig_cost'];
812 $packages[$pk]['count'] = $pv['shopping_cut_cost']; 914 $packages[$pk]['count'] = $pv['shopping_cut_cost'];
813 } 915 }
@@ -828,7 +930,7 @@ class CartModel @@ -828,7 +930,7 @@ class CartModel
828 * @param int $redEnvelopes 红包 930 * @param int $redEnvelopes 红包
829 * @return array 接口返回的数据 931 * @return array 接口返回的数据
830 */ 932 */
831 - public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes) 933 + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $promotionCode, $yohoCoin, $redEnvelopes)
832 { 934 {
833 $result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE, 'data' => array()); 935 $result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE, 'data' => array());
834 936
@@ -836,7 +938,7 @@ class CartModel @@ -836,7 +938,7 @@ class CartModel
836 if (!empty($yohoCoin)) { 938 if (!empty($yohoCoin)) {
837 $yohoCoin = intval($yohoCoin) / 100; 939 $yohoCoin = intval($yohoCoin) / 100;
838 } 940 }
839 - $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes); 941 + $compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $promotionCode, $yohoCoin, $redEnvelopes);
840 if ($compute && isset($compute['code'])) { 942 if ($compute && isset($compute['code'])) {
841 /* 商品价格明细 */ 943 /* 商品价格明细 */
842 if (!empty($compute['data']['promotion_formula_list'])) { 944 if (!empty($compute['data']['promotion_formula_list'])) {
@@ -904,19 +1006,19 @@ class CartModel @@ -904,19 +1006,19 @@ class CartModel
904 1006
905 do { 1007 do {
906 if (empty($addressId)) { 1008 if (empty($addressId)) {
907 - UdpLog::info('【结算信息】配送地址参数校验','addressId为空'); 1009 + UdpLog::info('【结算信息】配送地址参数校验', 'addressId为空');
908 $result['code'] = 401; 1010 $result['code'] = 401;
909 $result['message'] = '配送地址不能为空'; 1011 $result['message'] = '配送地址不能为空';
910 break; 1012 break;
911 } 1013 }
912 if (empty($deliveryTimeId)) { 1014 if (empty($deliveryTimeId)) {
913 - UdpLog::info('【结算信息】配送时间参数校验','deliveryTime为空'); 1015 + UdpLog::info('【结算信息】配送时间参数校验', 'deliveryTime为空');
914 $result['code'] = 402; 1016 $result['code'] = 402;
915 $result['message'] = '请选择配送时间'; 1017 $result['message'] = '请选择配送时间';
916 break; 1018 break;
917 } 1019 }
918 if (empty($deliveryWayId)) { 1020 if (empty($deliveryWayId)) {
919 - UdpLog::info('【结算信息】配送方式参数校验','deliveryWay为空'); 1021 + UdpLog::info('【结算信息】配送方式参数校验', 'deliveryWay为空');
920 $result['code'] = 403; 1022 $result['code'] = 403;
921 $result['message'] = '请选择配送方式'; 1023 $result['message'] = '请选择配送方式';
922 break; 1024 break;
@@ -950,7 +1052,7 @@ class CartModel @@ -950,7 +1052,7 @@ class CartModel
950 1052
951 /** 1053 /**
952 * 用户的收货地址列表 1054 * 用户的收货地址列表
953 - * 1055 + *
954 * @param int $uid 用户ID 1056 * @param int $uid 用户ID
955 * @return array 1057 * @return array
956 */ 1058 */
@@ -1001,7 +1103,7 @@ class CartModel @@ -1001,7 +1103,7 @@ class CartModel
1001 1103
1002 /** 1104 /**
1003 * 设置默认的收货地址 1105 * 设置默认的收货地址
1004 - * 1106 + *
1005 * @param int $uid 用户ID 1107 * @param int $uid 用户ID
1006 * @param int $addressId 地址ID 1108 * @param int $addressId 地址ID
1007 * @return array 1109 * @return array
@@ -1019,7 +1121,7 @@ class CartModel @@ -1019,7 +1121,7 @@ class CartModel
1019 1121
1020 /** 1122 /**
1021 * 删除收货地址 1123 * 删除收货地址
1022 - * 1124 + *
1023 * @param int $uid 用户ID 1125 * @param int $uid 用户ID
1024 * @param int $addressId 地址ID 1126 * @param int $addressId 地址ID
1025 * @return array 1127 * @return array
@@ -1132,8 +1234,7 @@ class CartModel @@ -1132,8 +1234,7 @@ class CartModel
1132 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 1234 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
1133 if (empty($result)) { 1235 if (empty($result)) {
1134 $result = Cache::get($key, 'slave'); 1236 $result = Cache::get($key, 'slave');
1135 - }  
1136 - // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 1237 + } // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
1137 else { 1238 else {
1138 Cache::set($key, $result, 3600); // 缓存1小时 1239 Cache::set($key, $result, 3600); // 缓存1小时
1139 } 1240 }
@@ -1144,7 +1245,7 @@ class CartModel @@ -1144,7 +1245,7 @@ class CartModel
1144 1245
1145 /** 1246 /**
1146 * 获取用户的优惠券列表 1247 * 获取用户的优惠券列表
1147 - * 1248 + *
1148 * @param int $uid 用户ID 1249 * @param int $uid 用户ID
1149 * @param int $valid 控制是否返回已失效的券, 为true时不返回, false时返回 1250 * @param int $valid 控制是否返回已失效的券, 为true时不返回, false时返回
1150 * @return array 1251 * @return array
@@ -1161,7 +1262,7 @@ class CartModel @@ -1161,7 +1262,7 @@ class CartModel
1161 /* 调用接口, 获取优惠券 */ 1262 /* 调用接口, 获取优惠券 */
1162 $couponList = CartData::getListCoupon($uid); 1263 $couponList = CartData::getListCoupon($uid);
1163 $build = array(); 1264 $build = array();
1164 - 1265 +
1165 //不可用优惠券 1266 //不可用优惠券
1166 if (isset($couponList['data']['unusable_coupons'])) { 1267 if (isset($couponList['data']['unusable_coupons'])) {
1167 foreach ($couponList['data']['unusable_coupons'] as $value) { 1268 foreach ($couponList['data']['unusable_coupons'] as $value) {
@@ -1190,7 +1291,7 @@ class CartModel @@ -1190,7 +1291,7 @@ class CartModel
1190 1291
1191 /** 1292 /**
1192 * 检查用户是否收藏这一批商品 1293 * 检查用户是否收藏这一批商品
1193 - * 1294 + *
1194 * @param int $uid 用户ID 1295 * @param int $uid 用户ID
1195 * @param array $skuList 商品SKU列表 1296 * @param array $skuList 商品SKU列表
1196 * @return array 1297 * @return array
@@ -1220,7 +1321,7 @@ class CartModel @@ -1220,7 +1321,7 @@ class CartModel
1220 1321
1221 /** 1322 /**
1222 * 获取购物车总数 1323 * 获取购物车总数
1223 - * 1324 + *
1224 * @param int $uid 用户ID 1325 * @param int $uid 用户ID
1225 * @param string $shoppingKey 客户端购物标识 1326 * @param string $shoppingKey 客户端购物标识
1226 * @return array 1327 * @return array
@@ -1232,7 +1333,7 @@ class CartModel @@ -1232,7 +1333,7 @@ class CartModel
1232 1333
1233 /** 1334 /**
1234 * 追加商品 1335 * 追加商品
1235 - * 1336 + *
1236 * @param array $source 1337 * @param array $source
1237 * @param array $data 1338 * @param array $data
1238 * @param int $index 1339 * @param int $index
@@ -1250,7 +1351,7 @@ class CartModel @@ -1250,7 +1351,7 @@ class CartModel
1250 1351
1251 /** 1352 /**
1252 * 获取商品总价 1353 * 获取商品总价
1253 - * 1354 + *
1254 * @param array $promotionList 短语信息 1355 * @param array $promotionList 短语信息
1255 * @param int $default 默认值 1356 * @param int $default 默认值
1256 * @return float 1357 * @return float
@@ -1276,7 +1377,7 @@ class CartModel @@ -1276,7 +1377,7 @@ class CartModel
1276 1377
1277 /** 1378 /**
1278 * 构建促销短语数据 1379 * 构建促销短语数据
1279 - * 1380 + *
1280 * @param array $promotionInfo 促销信息 1381 * @param array $promotionInfo 促销信息
1281 * @return array 1382 * @return array
1282 */ 1383 */
@@ -176,6 +176,25 @@ class IndexController extends WebAction @@ -176,6 +176,25 @@ class IndexController extends WebAction
176 } 176 }
177 177
178 /** 178 /**
  179 + * 为你优选商品异步请求
  180 + */
  181 + public function getRecommendProductAction()
  182 + {
  183 + $result = array('code' => 200, 'data' => array(), 'message' => '为你优选');
  184 +
  185 + if ($this->isAjax()) {
  186 + $channel = Helpers::getChannelNameByCookie();
  187 + $uid = $this->getUid(false);
  188 + $udid = $uid . $this->getUdid();
  189 + $page = $this->get('page', 1);
  190 +
  191 + $result = CartModel::getRecommendProduct($channel, $uid, $udid, $page);
  192 + }
  193 +
  194 + $this->echoJson($result);
  195 + }
  196 +
  197 + /**
179 * 最近浏览的商品异步请求 198 * 最近浏览的商品异步请求
180 */ 199 */
181 public function getHistroyProductAction() 200 public function getHistroyProductAction()
@@ -183,7 +202,8 @@ class IndexController extends WebAction @@ -183,7 +202,8 @@ class IndexController extends WebAction
183 $result = array('code' => 200, 'data' => array(), 'message' => '浏览记录'); 202 $result = array('code' => 200, 'data' => array(), 'message' => '浏览记录');
184 203
185 // 按照产品把明扬的指示,去掉最近浏览记录 204 // 按照产品把明扬的指示,去掉最近浏览记录
186 - $this->echoJson($result); exit(); 205 + $this->echoJson($result);
  206 + exit();
187 207
188 do { 208 do {
189 if (!$this->isAjax()) { 209 if (!$this->isAjax()) {
@@ -204,8 +224,7 @@ class IndexController extends WebAction @@ -204,8 +224,7 @@ class IndexController extends WebAction
204 } 224 }
205 $sknList = explode(',', rawurldecode($sknList)); 225 $sknList = explode(',', rawurldecode($sknList));
206 $result = CartModel::getNamedBrowseProduct($page, 6, $sknList); 226 $result = CartModel::getNamedBrowseProduct($page, 6, $sknList);
207 - }  
208 - while (false); 227 + } while (false);
209 228
210 $this->echoJson($result); 229 $this->echoJson($result);
211 } 230 }
@@ -458,14 +477,13 @@ class IndexController extends WebAction @@ -458,14 +477,13 @@ class IndexController extends WebAction
458 $paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes); 477 $paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);
459 // 判断是否下单成功 478 // 判断是否下单成功
460 if (empty($result['data']['order_code'])) { 479 if (empty($result['data']['order_code'])) {
461 - UdpLog::info('【结算信息】判断是否下单成功','order_code'.$result['data']['order_code']); 480 + UdpLog::info('【结算信息】判断是否下单成功', 'order_code' . $result['data']['order_code']);
462 break; 481 break;
463 } 482 }
464 483
465 // 跳转到支付的URL链接 484 // 跳转到支付的URL链接
466 $result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code'])); 485 $result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code']));
467 - }  
468 - while (false); 486 + } while (false);
469 487
470 $this->echoJson($result); 488 $this->echoJson($result);
471 } 489 }
@@ -523,10 +541,10 @@ class IndexController extends WebAction @@ -523,10 +541,10 @@ class IndexController extends WebAction
523 $uid = $this->getUid(); 541 $uid = $this->getUid();
524 $vipLevel = -1; 542 $vipLevel = -1;
525 $data = array(); 543 $data = array();
526 - if(!empty($this->_vip)) { 544 + if (!empty($this->_vip)) {
527 $vipLevel = Helpers::getVipLevel($this->_vip); 545 $vipLevel = Helpers::getVipLevel($this->_vip);
528 } 546 }
529 - if(!empty($productId)) { 547 + if (!empty($productId)) {
530 $data = Product\ItemModel::getCartProductInfo($productId, $uid, $vipLevel); 548 $data = Product\ItemModel::getCartProductInfo($productId, $uid, $vipLevel);
531 } 549 }
532 $this->_view->display('goods-detail', $data); 550 $this->_view->display('goods-detail', $data);
@@ -31,9 +31,30 @@ class IndexController extends WebAction @@ -31,9 +31,30 @@ class IndexController extends WebAction
31 'name' => '个人中心' 31 'name' => '个人中心'
32 ), 32 ),
33 ); 33 );
34 - $leftNav = UserModel::getCenterLeftNav('',$uid); 34 + $leftNav = UserModel::getCenterLeftNav('', $uid);
35 $data = IndexModel::homeData(); 35 $data = IndexModel::homeData();
36 $udid = $uid . $this->getUdid(); 36 $udid = $uid . $this->getUdid();
  37 +
  38 + $channelNum = 1;
  39 + switch ($channel) {
  40 + case 'boys':
  41 + $channelNum = 1;
  42 + break;
  43 + case 'girls':
  44 + $channelNum = 2;
  45 + break;
  46 + case 'kids':
  47 + $channelNum = 3;
  48 + break;
  49 + case 'lifestyle':
  50 + $channelNum = 4;
  51 + break;
  52 + default:
  53 + break;
  54 + }
  55 + // 为你优选 tar add 160701
  56 + $data['recommend'] = IndexModel::preferenceData($channelNum, $uid, $udid, '100004', 30);
  57 +
37 //取消订单原因列表 58 //取消订单原因列表
38 $resons = OrderData::closeReasons(); 59 $resons = OrderData::closeReasons();
39 $cancelReason = isset($resons['data']) ? $resons['data'] : ''; 60 $cancelReason = isset($resons['data']) ? $resons['data'] : '';
@@ -54,10 +75,11 @@ class IndexController extends WebAction @@ -54,10 +75,11 @@ class IndexController extends WebAction
54 'more' => '/brands', 75 'more' => '/brands',
55 'brands' => $data['brand'] 76 'brands' => $data['brand']
56 ), 77 ),
57 - 'newArrival' => $data['new'],  
58 - 'banner' => IndexModel::getFooterBanner() 78 + 'newArrival' => $data['new']
59 ) 79 )
60 ), 80 ),
  81 + 'recommend' => $data['recommend'], //待处理
  82 + 'banner' => IndexModel::getFooterBanner(),
61 'helpUsUrl' => '' 83 'helpUsUrl' => ''
62 ); 84 );
63 $this->_view->display('index', array('meIndexPage' => true, 'me' => $data)); 85 $this->_view->display('index', array('meIndexPage' => true, 'me' => $data));