Authored by Rock Zhang

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

Conflicts:
	template/m.yohobuy.com/partials/cart/good.phtml
	yohobuy/m.yohobuy.com/application/models/Index/Cart.php
	yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
@@ -18,6 +18,8 @@ class CacheConfig @@ -18,6 +18,8 @@ class CacheConfig
18 const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页 18 const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页
19 const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页 19 const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页
20 const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页 20 const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页
  21 +
  22 + const KEY_ACTION_INDEX_CONFIG = 'key_action_index_config'; // 频道配置
21 23
22 const KEY_ACTION_BOYS_BOTTOM_BANNER = 'key_action_boys_bottom_banner'; // 男生首页底部banner 24 const KEY_ACTION_BOYS_BOTTOM_BANNER = 'key_action_boys_bottom_banner'; // 男生首页底部banner
23 const KEY_ACTION_GRILS_BOTTOM_BANNER = 'key_action_girls_bottom_banner';// 女生首页底部banner 25 const KEY_ACTION_GRILS_BOTTOM_BANNER = 'key_action_girls_bottom_banner';// 女生首页底部banner
@@ -51,6 +53,6 @@ class CacheConfig @@ -51,6 +53,6 @@ class CacheConfig
51 const KEY_ACTION_GUANG_DETAIL_DATA = 'key_action_guang_detail_data'; // 逛内容详情 53 const KEY_ACTION_GUANG_DETAIL_DATA = 'key_action_guang_detail_data'; // 逛内容详情
52 const KEY_ACTION_GUANG_RSS_DATA = 'key_action_guang_detail_data'; // 逛订阅内容 54 const KEY_ACTION_GUANG_RSS_DATA = 'key_action_guang_detail_data'; // 逛订阅内容
53 55
54 - const KEY_ACTION_ADDRESS_LIST_DATA = 'key_action_address_list_data'; // 地址树数据 56 + const KEY_ACTION_ADDRESS_LIST_DATA = 'key_action_address_list_data'; // 地址树数据
55 57
56 } 58 }
@@ -77,7 +77,8 @@ class IndexData @@ -77,7 +77,8 @@ class IndexData
77 { 77 {
78 $param = Yohobuy::param(); 78 $param = Yohobuy::param();
79 $param['client_secret'] = Sign::getSign($param); 79 $param['client_secret'] = Sign::getSign($param);
80 - return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/entrance/getEntrance',$param,3600); 80 +
  81 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/entrance/getEntrance', $param);
81 } 82 }
82 83
83 } 84 }
@@ -20,7 +20,7 @@ var requesting = false; @@ -20,7 +20,7 @@ var requesting = false;
20 ellipsis.init(); 20 ellipsis.init();
21 21
22 lazyLoad({ 22 lazyLoad({
23 - try_again_css: 'order-failure' 23 + try_again_css: 'good-failure'
24 }); 24 });
25 25
26 26
@@ -10,7 +10,7 @@ var $ = require('jquery'), @@ -10,7 +10,7 @@ var $ = require('jquery'),
10 Handlebars = require('yoho.handlebars'), 10 Handlebars = require('yoho.handlebars'),
11 tip = require('../plugin/tip'), 11 tip = require('../plugin/tip'),
12 loading = require('../plugin/loading'), 12 loading = require('../plugin/loading'),
13 - orderInfo = require('./order-info').orderInfo; 13 + order = require('./order-info');
14 14
15 var dispatchModeHammer, 15 var dispatchModeHammer,
16 dispatchTimeHammer, 16 dispatchTimeHammer,
@@ -18,10 +18,15 @@ var dispatchModeHammer, @@ -18,10 +18,15 @@ var dispatchModeHammer,
18 $price = $('.price-cal'), 18 $price = $('.price-cal'),
19 payType, 19 payType,
20 priceTmpl = Handlebars.compile($('#tmpl-price').html()), 20 priceTmpl = Handlebars.compile($('#tmpl-price').html()),
21 - queryString = $.queryString(); 21 + queryString = $.queryString(),
  22 + orderInfo = order.orderInfo;
22 23
23 lazyLoad(); 24 lazyLoad();
24 25
  26 +if (window.getUid() !== orderInfo('uid')) {
  27 + order.init();
  28 +}
  29 +
25 function dispacthTapEvt(e) { 30 function dispacthTapEvt(e) {
26 var $cur = $(e.target).closest('li'); 31 var $cur = $(e.target).closest('li');
27 32
@@ -79,6 +84,15 @@ function orderCompute() { @@ -79,6 +84,15 @@ function orderCompute() {
79 if (!res) { 84 if (!res) {
80 tip.show('网络出错'); 85 tip.show('网络出错');
81 } else { 86 } else {
  87 + if (res.order_amount) {
  88 + res.order_amount = (+res.order_amount).toFixed(2);
  89 + }
  90 + if (res.discount_amount) {
  91 + res.discount_amount = (+res.discount_amount).toFixed(2);
  92 + }
  93 + if (res.last_order_amount) {
  94 + res.last_order_amount = (+res.last_order_amount).toFixed(2);
  95 + }
82 priceHtml = priceTmpl({ 96 priceHtml = priceTmpl({
83 sumPrice: res.order_amount, 97 sumPrice: res.order_amount,
84 salePrice: res.discount_amount, 98 salePrice: res.discount_amount,
@@ -6,11 +6,9 @@ @@ -6,11 +6,9 @@
6 var $ = require('jquery'); 6 var $ = require('jquery');
7 var info = window.cookie('order-info'); 7 var info = window.cookie('order-info');
8 8
9 -// info 必须是 JSON 字符串  
10 -try {  
11 - info = JSON.parse(info);  
12 -} catch (e) { 9 +function init() {
13 info = { 10 info = {
  11 + uid: window.getUid(),
14 deliveryId: 1, 12 deliveryId: 1,
15 deliveryTimeId: 1, 13 deliveryTimeId: 1,
16 paymentTypeId: 1, 14 paymentTypeId: 1,
@@ -26,6 +24,15 @@ try { @@ -26,6 +24,15 @@ try {
26 window.setCookie('order-info', JSON.stringify(info)); 24 window.setCookie('order-info', JSON.stringify(info));
27 } 25 }
28 26
  27 +// info 必须是 JSON 字符串
  28 +try {
  29 + info = JSON.parse(info);
  30 +} catch (e) {
  31 + init();
  32 +}
  33 +
  34 +exports.init = init;
  35 +
29 exports.orderInfo = function(key, value) { 36 exports.orderInfo = function(key, value) {
30 if (value === undefined) { 37 if (value === undefined) {
31 return info[key]; 38 return info[key];
@@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), @@ -22,18 +22,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
22 ellipsis.init(); 22 ellipsis.init();
23 23
24 $newCoupon.on('submit', function() { 24 $newCoupon.on('submit', function() {
  25 + var $this = $(this);
  26 +
  27 + if (!$this.find('[name="couponCode"]').val()) {
  28 + tip.show('请输入优惠券码');
  29 + return false;
  30 + }
25 $.ajax({ 31 $.ajax({
26 method: 'POST', 32 method: 'POST',
27 url: '/cart/index/couponSearch', 33 url: '/cart/index/couponSearch',
28 - data: $(this).serialize() 34 + data: $this.serialize()
29 }).then(function(res) { 35 }).then(function(res) {
30 if (res.code === 200) { 36 if (res.code === 200) {
31 tip.show('优惠券可用'); 37 tip.show('优惠券可用');
32 orderInfo('couponCode', res.data.coupon_code); 38 orderInfo('couponCode', res.data.coupon_code);
33 orderInfo('couponValue', res.data.coupon_value); 39 orderInfo('couponValue', res.data.coupon_value);
34 - window.location.href = '/shoppingCart/orderEnsure?coupon_code=' + res.data.coupon_code; 40 + window.location.href = '/cart/index/orderEnsure';
35 } else { 41 } else {
36 - tip.show(res.message); 42 + tip.show(res.message || '网络错误');
37 } 43 }
38 }).fail(function() { 44 }).fail(function() {
39 tip.show('网络错误'); 45 tip.show('网络错误');
@@ -93,7 +93,7 @@ $addressForm.on('submit', function() { @@ -93,7 +93,7 @@ $addressForm.on('submit', function() {
93 loading.hideLoadingMask(); 93 loading.hideLoadingMask();
94 } else { 94 } else {
95 if (queryString.refer === 'shopping') { 95 if (queryString.refer === 'shopping') {
96 - window.location.href = '/shoppingCart/selectAddress'; 96 + window.location.href = '/cart/index/selectAddress';
97 } else { 97 } else {
98 window.location.href = '/home/address'; 98 window.location.href = '/home/address';
99 } 99 }
@@ -43,6 +43,7 @@ optHammer.on('tap', function(e) { @@ -43,6 +43,7 @@ optHammer.on('tap', function(e) {
43 $('#dialog-wrapper').hide(); 43 $('#dialog-wrapper').hide();
44 if (!res) { 44 if (!res) {
45 tip.show('网络错误'); 45 tip.show('网络错误');
  46 + return;
46 } 47 }
47 if (res.code === 200) { 48 if (res.code === 200) {
48 tip.show('删除成功'); 49 tip.show('删除成功');
@@ -74,6 +75,7 @@ optHammer.on('tap', function(e) { @@ -74,6 +75,7 @@ optHammer.on('tap', function(e) {
74 $('#dialog-wrapper').hide(); 75 $('#dialog-wrapper').hide();
75 if (!res) { 76 if (!res) {
76 tip.show('网络错误'); 77 tip.show('网络错误');
  78 + return;
77 } 79 }
78 if (res.code === 200) { 80 if (res.code === 200) {
79 tip.show('取消成功'); 81 tip.show('取消成功');
@@ -18,4 +18,10 @@ require('./back/mobile'); @@ -18,4 +18,10 @@ require('./back/mobile');
18 require('./back/code'); 18 require('./back/code');
19 require('./back/email'); 19 require('./back/email');
20 require('./back/email-success'); 20 require('./back/email-success');
21 -require('./back/new-password');  
  21 +require('./back/new-password');
  22 +
  23 +//绑定手机
  24 +require('./bind/bind');
  25 +require('./bind/code');
  26 +require('./bind/password');
  27 +
@@ -78,8 +78,14 @@ $.ajax({ @@ -78,8 +78,14 @@ $.ajax({
78 type: 'GET', 78 type: 'GET',
79 url: '/cart/index/count', 79 url: '/cart/index/count',
80 success: function(data) { 80 success: function(data) {
  81 + var count;
  82 +
81 if (data.code === 200) { 83 if (data.code === 200) {
82 - $cart.find('.num-tag').html(data.data.cart_goods_count).removeClass('hide'); 84 + count = data.data.cart_goods_count || 0;
  85 + if (count > 99) {
  86 + count = '99+';
  87 + }
  88 + $cart.find('.num-tag').html(count).removeClass('hide');
83 } 89 }
84 } 90 }
85 }); 91 });
1 .order-failure { 1 .order-failure {
2 background-image: image-url('lazy-failure/order-good.jpg'); 2 background-image: image-url('lazy-failure/order-good.jpg');
3 background-size: 100%; 3 background-size: 100%;
4 -}  
  4 +}
  5 +
  6 +.good-failure {
  7 + background-image: image-url('lazy-failure/order-good.jpg');
  8 + background-size: 132rem / $pxConvertRem !important;
  9 + background-position-x: 40%;
  10 +}
  11 +
@@ -75,6 +75,20 @@ @@ -75,6 +75,20 @@
75 75
76 .goods { 76 .goods {
77 margin-right: -20rem / $pxConvertRem; 77 margin-right: -20rem / $pxConvertRem;
  78 +
  79 + .price-wrap {
  80 + position: static;
  81 + text-align: left;
  82 +
  83 + .price {
  84 + color: #444;
  85 + }
  86 +
  87 + .count {
  88 + display: inline;
  89 + margin-left: 20rem / $pxConvertRem;
  90 + }
  91 + }
78 } 92 }
79 93
80 .sale-invoice { 94 .sale-invoice {
@@ -148,21 +162,27 @@ @@ -148,21 +162,27 @@
148 } 162 }
149 } 163 }
150 164
  165 + .block input {
  166 + box-sizing: border-box;
  167 + margin: pxToRem(20px) 0;
  168 + padding: 0 pxToRem(12px);
  169 + width: 100%;
  170 + height: pxToRem(60px);
  171 + color: #444;
  172 + background: #efefef;
  173 + font-size: pxToRem(16px);
  174 + line-height: 1;
  175 + outline: 0;
  176 + border: 0;
  177 + @include border-radius(4px);
  178 + }
  179 +
151 #invoice { 180 #invoice {
152 - input {  
153 - width: 100%;  
154 - height: pxToRem(90px);  
155 - outline: 0;  
156 - border: 0;  
157 - border-top: 1px solid #f7f7f7;  
158 - border-bottom: 1px solid #f7f7f7;  
159 - } 181 + border-top: 1px solid #f7f7f7;
160 182
161 label { 183 label {
162 - position: relative;  
163 - width: 100%;  
164 - height: pxToRem(90px);  
165 - border-bottom: 1px solid #f7f7f7; 184 + display: block;
  185 + border-top: 1px solid #f7f7f7;
166 } 186 }
167 187
168 select { 188 select {
@@ -178,13 +198,7 @@ @@ -178,13 +198,7 @@
178 #msg { 198 #msg {
179 padding-top: pxToRem(20px); 199 padding-top: pxToRem(20px);
180 input { 200 input {
181 - padding: pxToRem(10px);  
182 - width: pxToRem(580px);  
183 - height: pxToRem(50px);  
184 - outline: 0;  
185 - border: 0;  
186 - border: 1px solid #f7f7f7;  
187 - border-radius: pxToRem(4px); 201 + margin: 0;
188 } 202 }
189 203
190 } 204 }
@@ -480,16 +480,19 @@ $basicBtnC:#eb0313; @@ -480,16 +480,19 @@ $basicBtnC:#eb0313;
480 } 480 }
481 } 481 }
482 .num-tag { 482 .num-tag {
483 - position: absolute;  
484 - left: pxToRem(66px);  
485 - height: pxToRem(20px);  
486 display: block; 483 display: block;
487 - width: pxToRem(36px);  
488 - height: pxToRem(36px);  
489 - background-color: $basicBtnC;  
490 - border-radius: 50%; 484 + position: absolute;
  485 + top: 0;
  486 + left: pxToRem(48px);
  487 + width: pxToRem(72px);
  488 + height: pxToRem(72px);
  489 + font-size: pxToRem(40px);
  490 + line-height: pxToRem(72px);
491 color: #fff; 491 color: #fff;
492 - font-size: pxToRem(24px); 492 + background: $basicBtnC;
  493 + text-align: center;
  494 + border-radius: 50%;
  495 + @include transform(scale(0.5));
493 &.hide{ 496 &.hide{
494 display: none; 497 display: none;
495 } 498 }
@@ -41,10 +41,10 @@ @@ -41,10 +41,10 @@
41 41
42 <section class="block"> 42 <section class="block">
43 <ul class="sale-invoice"> 43 <ul class="sale-invoice">
44 - {{# coupon}}  
45 - <li class="coupon">  
46 - <a href="/cart/index/selectCoupon">  
47 - <span class="title">优惠券</span> 44 + <li class="coupon">
  45 + <a href="/cart/index/selectCoupon">
  46 + <span class="title">优惠券</span>
  47 + {{# coupon}}
48 {{#if count}} 48 {{#if count}}
49 <span class="coupon-count"> 49 <span class="coupon-count">
50 {{count}}张可用 50 {{count}}张可用
@@ -62,13 +62,12 @@ @@ -62,13 +62,12 @@
62 <i class="iconfont">&#xe614;</i> 62 <i class="iconfont">&#xe614;</i>
63 </span> 63 </span>
64 {{/if}} 64 {{/if}}
65 - </a>  
66 - </li>  
67 - {{/coupon}}  
68 - 65 + {{/coupon}}
  66 + </a>
  67 + </li>
69 <li class="coin" data-yoho-coin="{{yohoCoin}}"> 68 <li class="coin" data-yoho-coin="{{yohoCoin}}">
70 <span class="title">YOHO币</span> 69 <span class="title">YOHO币</span>
71 - <span class="desc">可抵¥{{yohoCoin}}</span> 70 + <span class="desc">可抵¥{{yohoCoin}}</span>
72 <span class="coin-check"> 71 <span class="coin-check">
73 <em>- ¥ {{yohoCoin}}</em> 72 <em>- ¥ {{yohoCoin}}</em>
74 <i class="iconfont checkbox icon-cb-checked"></i> 73 <i class="iconfont checkbox icon-cb-checked"></i>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 {{/if}} 10 {{/if}}
11 11
12 <div class="info"> 12 <div class="info">
13 - <img class="thumb lazy" data-original={{url}}> 13 + <img class="thumb lazy" data-original={{thumb}}>
14 {{#if isAdvanceBuy}} 14 {{#if isAdvanceBuy}}
15 <p class="few-tag plus-tag">加价购</p> 15 <p class="few-tag plus-tag">加价购</p>
16 {{^}} 16 {{^}}
@@ -51,7 +51,6 @@ @@ -51,7 +51,6 @@
51 {{/if}} 51 {{/if}}
52 52
53 53
54 -  
55 <span class="iconfont icon-del" data-count="{{count}}">&#xe621;</span> 54 <span class="iconfont icon-del" data-count="{{count}}">&#xe621;</span>
56 </p> 55 </p>
57 <p class="row"> 56 <p class="row">
@@ -466,8 +466,10 @@ class HomeController extends AbstractAction @@ -466,8 +466,10 @@ class HomeController extends AbstractAction
466 */ 466 */
467 public function onlineServiceDetailAction() 467 public function onlineServiceDetailAction()
468 { 468 {
469 - $cateId = $this->get('cateId', 0);  
470 - $cateName = $this->get('cateName', ''); 469 + $cateInfo = $this->get('cateInfo', '');
  470 + $cate = explode("_", $cateInfo);
  471 + $cateId = intval($cate[0]);
  472 + $cateName = $cate[1];
471 if ($cateId > 0) { 473 if ($cateId > 0) {
472 $service = Home\OnlineModel::getOnlineServiceDetail($cateId); 474 $service = Home\OnlineModel::getOnlineServiceDetail($cateId);
473 } 475 }
@@ -831,7 +833,7 @@ class HomeController extends AbstractAction @@ -831,7 +833,7 @@ class HomeController extends AbstractAction
831 /** 833 /**
832 * 订单详情页 834 * 订单详情页
833 */ 835 */
834 - public function orderDetailAction() 836 + public function orderdetailAction()
835 { 837 {
836 // 审判跳转登录页 838 // 审判跳转登录页
837 $this->auditJumpLogin(); 839 $this->auditJumpLogin();
@@ -23,12 +23,14 @@ class IndexController extends AbstractAction @@ -23,12 +23,14 @@ class IndexController extends AbstractAction
23 // 设置浏览器缓存5分钟 23 // 设置浏览器缓存5分钟
24 $this->setExpires(300); 24 $this->setExpires(300);
25 } 25 }
  26 +
26 $result = Index\HomeModel::getChannel(); 27 $result = Index\HomeModel::getChannel();
27 $result['background'] = Index\HomeModel::getBgImage(); 28 $result['background'] = Index\HomeModel::getBgImage();
28 $result['channelPage'] = true; 29 $result['channelPage'] = true;
29 $result['showDownloadApp'] = true; 30 $result['showDownloadApp'] = true;
30 $result['searchUrl'] = Helpers::url('', null, 'search'); 31 $result['searchUrl'] = Helpers::url('', null, 'search');
31 $result['pageFooter'] = true; 32 $result['pageFooter'] = true;
  33 +
32 // 渲染模板 34 // 渲染模板
33 $this->_view->display('index', $result); 35 $this->_view->display('index', $result);
34 } 36 }
@@ -39,7 +39,7 @@ class OnlineModel @@ -39,7 +39,7 @@ class OnlineModel
39 if ($sub) { 39 if ($sub) {
40 foreach ($sub as $sk => $sv) { 40 foreach ($sub as $sk => $sv) {
41 $qTmp[$sk]['title'] = $sv['category_name']; 41 $qTmp[$sk]['title'] = $sv['category_name'];
42 - $qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateId' => $sv['id'], 'cateName' => $sv['category_name'])); 42 + $qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateInfo' => $sv['id'].'_'.$sv['category_name']));
43 } 43 }
44 } 44 }
45 $question[$key]['list'] = $qTmp; 45 $question[$key]['list'] = $qTmp;
@@ -80,7 +80,7 @@ class OrderModel @@ -80,7 +80,7 @@ class OrderModel
80 $result[$key]['sumCost'] = $vo['amount']; 80 $result[$key]['sumCost'] = $vo['amount'];
81 //类内调用格式化订单商品数据方法 81 //类内调用格式化订单商品数据方法
82 $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count); 82 $result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count);
83 - $result[$key]['detailUrl'] = Helpers::url('/home/orderDetail', array('order_code' => $vo['order_code'])); 83 + $result[$key]['detailUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $vo['order_code']));
84 $result[$key]['count'] = $count; 84 $result[$key]['count'] = $count;
85 } 85 }
86 } 86 }
@@ -52,7 +52,7 @@ class CartModel @@ -52,7 +52,7 @@ class CartModel
52 */ 52 */
53 public static function getCartData($uid, $shoppingKey, $cartType = 'all', $onlyGift = false, $onlyAdvanceBuy = false) 53 public static function getCartData($uid, $shoppingKey, $cartType = 'all', $onlyGift = false, $onlyAdvanceBuy = false)
54 { 54 {
55 - $result = array(); 55 + $result = array('cartNav' => true, 'commonGoodsCount' => '0', 'presellGoodsCount' => '0');
56 56
57 // 用户是否登录 57 // 用户是否登录
58 if (empty($uid)) { 58 if (empty($uid)) {
@@ -79,21 +79,21 @@ class CartModel @@ -79,21 +79,21 @@ class CartModel
79 break; 79 break;
80 } 80 }
81 81
82 - $ordinaryCount = intval($cart['ordinary_cart_data']['shopping_cart_data']['goods_count']);  
83 - $advanceCount = intval($cart['advance_cart_data']['shopping_cart_data']['goods_count']); 82 + $ordinaryCount = strval($cart['ordinary_cart_data']['shopping_cart_data']['goods_count']);
  83 + $advanceCount = strval($cart['advance_cart_data']['shopping_cart_data']['goods_count']);
84 // 普通购物车和预售购物车都为空 84 // 普通购物车和预售购物车都为空
85 - if ($ordinaryCount === 0 && $advanceCount === 0) { 85 + if ($ordinaryCount === '0' && $advanceCount === '0') {
86 $result['isEmptyCart'] = true; 86 $result['isEmptyCart'] = true;
87 break; 87 break;
88 } 88 }
89 - 89 +
90 /* 普通购物车 */ 90 /* 普通购物车 */
91 $result['commonGoodsCount'] = $ordinaryCount; 91 $result['commonGoodsCount'] = $ordinaryCount;
92 $result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy); 92 $result['commonCart'] = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
93 /* 预售购物车 */ 93 /* 预售购物车 */
94 $result['presellGoodsCount'] = $advanceCount; 94 $result['presellGoodsCount'] = $advanceCount;
95 $result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy); 95 $result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
96 - }while(0); 96 + } while(false);
97 97
98 return $result; 98 return $result;
99 } 99 }
@@ -188,8 +188,8 @@ class CartModel @@ -188,8 +188,8 @@ class CartModel
188 188
189 if (empty($uid)) { 189 if (empty($uid)) {
190 $result['code'] = 300; 190 $result['code'] = 300;
191 - $reult['message'] = '请先登录';  
192 - $result['data'] = '/signin.html'; 191 + $result['message'] = '请先登录';
  192 + $result['data'] = Helpers::url('/signin.html');
193 193
194 return $result; 194 return $result;
195 } 195 }
@@ -20,6 +20,7 @@ use Configs\CacheConfig; @@ -20,6 +20,7 @@ use Configs\CacheConfig;
20 class HomeModel 20 class HomeModel
21 { 21 {
22 /* 频道选择页取背景图片的位置码 */ 22 /* 频道选择页取背景图片的位置码 */
  23 +
23 const CODE_BG = '7ba9118028f9b22090b57341487567eb'; 24 const CODE_BG = '7ba9118028f9b22090b57341487567eb';
24 25
25 /* 男生楼层资源的位置码 */ 26 /* 男生楼层资源的位置码 */
@@ -70,7 +71,8 @@ class HomeModel @@ -70,7 +71,8 @@ class HomeModel
70 71
71 /** 72 /**
72 * 设置选择的频道保存到浏览器COOKIE 73 * 设置选择的频道保存到浏览器COOKIE
73 - * 74 + * (已废弃,改成JS设置)
  75 + *
74 * @param string $cookie 76 * @param string $cookie
75 * @return void 77 * @return void
76 */ 78 */
@@ -99,10 +101,10 @@ class HomeModel @@ -99,10 +101,10 @@ class HomeModel
99 // 调用接口获取数据 101 // 调用接口获取数据
100 $banner = IndexData::getBannerStart(self::CODE_BG); 102 $banner = IndexData::getBannerStart(self::CODE_BG);
101 if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) { 103 if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) {
102 - $imgArr = $banner['data'][0]['data'];  
103 - if (isset($banner['data'][0]['data']['list'])) {  
104 - $imgArr = $banner['data'][0]['data']['list'];  
105 - } 104 + $imgArr = $banner['data'][0]['data'];
  105 + if (isset($banner['data'][0]['data']['list'])) {
  106 + $imgArr = $banner['data'][0]['data']['list'];
  107 + }
106 $result = Helpers::getImageUrl($imgArr[0]['src'], 640, 800, 2); 108 $result = Helpers::getImageUrl($imgArr[0]['src'], 640, 800, 2);
107 } 109 }
108 110
@@ -128,7 +130,7 @@ class HomeModel @@ -128,7 +130,7 @@ class HomeModel
128 public static function getBottomBanner($channel) 130 public static function getBottomBanner($channel)
129 { 131 {
130 $result = false; 132 $result = false;
131 - if($channel == 2) { 133 + if ($channel == 2) {
132 $resource = self::CODE_NAME_GIRLS_BOTTOM_BANNER; 134 $resource = self::CODE_NAME_GIRLS_BOTTOM_BANNER;
133 $cache = CacheConfig::KEY_ACTION_GRILS_BOTTOM_BANNER; 135 $cache = CacheConfig::KEY_ACTION_GRILS_BOTTOM_BANNER;
134 } else { 136 } else {
@@ -324,45 +326,65 @@ class HomeModel @@ -324,45 +326,65 @@ class HomeModel
324 * 326 *
325 * @return array 327 * @return array
326 */ 328 */
327 - public static function getChannel(){ 329 + public static function getChannel()
  330 + {
328 $result = array(); 331 $result = array();
329 - $result['showYohood'] = false;  
330 332
331 - $data = IndexData::channelData(); 333 + if (USE_CACHE) {
  334 + $key = CacheConfig::KEY_ACTION_INDEX_CONFIG;
  335 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  336 + $result = Cache::get($key, 'master');
  337 + if (!empty($result)) {
  338 + return $result;
  339 + }
  340 + }
332 341
333 - $channelList = array();  
334 - if(isset($data['data']['list'])){  
335 - foreach($data['data']['list'] as $key => $value){  
336 - switch ($value['channel_id']) {  
337 - case 5:  
338 - $result['showYohood'] = true;  
339 - $result['yohoodHref'] = '/yohood';  
340 - break; 342 + $data = IndexData::channelData();
  343 + if (!empty($data['data']['list'])) {
  344 + $build = array();
  345 + foreach ($data['data']['list'] as $value) {
  346 + $build = array();
  347 + switch (intval($value['channel_id'])) {
341 case 1: 348 case 1:
342 - $channelList[$key]['href'] = '/boys';  
343 - $channelList[$key]['title'] = '男生';  
344 - $channelList[$key]['entitle'] = 'BOYS'; 349 + $build['href'] = '/boys';
  350 + $build['title'] = '男生';
  351 + $build['entitle'] = 'BOYS';
345 break; 352 break;
346 case 2: 353 case 2:
347 - $channelList[$key]['href'] = '/girls';  
348 - $channelList[$key]['title'] = '女生';  
349 - $channelList[$key]['entitle'] = 'GIRLS'; 354 + $build['href'] = '/girls';
  355 + $build['title'] = '女生';
  356 + $build['entitle'] = 'GIRLS';
350 break; 357 break;
351 case 3: 358 case 3:
352 - $channelList[$key]['href'] = '/kids';  
353 - $channelList[$key]['title'] = '潮童';  
354 - $channelList[$key]['entitle'] = 'KIDS'; 359 + $build['href'] = '/kids';
  360 + $build['title'] = '潮童';
  361 + $build['entitle'] = 'KIDS';
355 break; 362 break;
356 case 4: 363 case 4:
357 - $channelList[$key]['href'] = '/lifestyle';  
358 - $channelList[$key]['title'] = '创意生活';  
359 - $channelList[$key]['entitle'] = 'LIFESTYLE'; 364 + $build['href'] = '/lifestyle';
  365 + $build['title'] = '创意生活';
  366 + $build['entitle'] = 'LIFESTYLE';
360 break; 367 break;
361 - default: 368 + case 5:
  369 + $result['showYohood'] = true;
  370 + $result['yohoodHref'] = 'http://yohood.cn';
362 break; 371 break;
  372 + default:
  373 + continue;
363 } 374 }
  375 + $result['channelList'][] = $build;
  376 + }
  377 + }
  378 +
  379 + if (USE_CACHE) {
  380 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  381 + if (empty($result)) {
  382 + $result = Cache::get($key, 'slave');
  383 + }
  384 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  385 + else {
  386 + Cache::set($key, $result);
364 } 387 }
365 - $result['channelList'] = $channelList;  
366 } 388 }
367 389
368 return $result; 390 return $result;
@@ -100,20 +100,23 @@ class UserModel @@ -100,20 +100,23 @@ class UserModel
100 /** 100 /**
101 * 处理个人中心页面优选新品数据 101 * 处理个人中心页面优选新品数据
102 * 102 *
103 - * @param int $yh_channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活 103 + * @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
104 * @return array|mixed 处理之后的个人中心页面优选新品数据 104 * @return array|mixed 处理之后的个人中心页面优选新品数据
105 */ 105 */
106 - public static function getPreferenceData($yh_channel) 106 + public static function getPreferenceData($channel)
107 { 107 {
108 $result = array(); 108 $result = array();
109 109
110 // 调用接口获取个人中心页面优选新品数据 110 // 调用接口获取个人中心页面优选新品数据
111 - $preferenceData = UserData::preference($yh_channel); 111 + $preferenceData = UserData::preference($channel);
112 112
113 // 处理个人中心页面优选新品数据 113 // 处理个人中心页面优选新品数据
114 - if (isset($preferenceData['data']) && !empty($preferenceData['data'])) {  
115 - foreach ($preferenceData['data'] as $val) {  
116 - $result['recommendList'][] = Helpers::formatProduct($val, false, true, true, 299, 388, false, false); 114 + if (!empty($preferenceData['data'])) {
  115 + foreach ($preferenceData['data'] as $value) {
  116 + $value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
  117 + if (false !== $value) {
  118 + $result['recommendList'][] = $value;
  119 + }
117 } 120 }
118 } 121 }
119 122
@@ -33,12 +33,6 @@ class DetailModel @@ -33,12 +33,6 @@ class DetailModel
33 // 调用服务 33 // 调用服务
34 $baseInfo = DetailData::baseInfo($productId, $uid); 34 $baseInfo = DetailData::baseInfo($productId, $uid);
35 35
36 -// // 因PC目前是不判断的,先保持一致,以后有需要,可以去掉  
37 -// // 判断商品是否在架  
38 -// if (empty($baseInfo['status'])) {  
39 -// return $result;  
40 -// }  
41 -  
42 // 商品名称 36 // 商品名称
43 if (isset($baseInfo['productName'])) { 37 if (isset($baseInfo['productName'])) {
44 $result['goodsName'] = $baseInfo['productName']; 38 $result['goodsName'] = $baseInfo['productName'];
@@ -241,7 +235,7 @@ class DetailModel @@ -241,7 +235,7 @@ class DetailModel
241 'numInCart' => 0, 235 'numInCart' => 0,
242 'goodsInstore' => $baseInfo['storage'], // 库存量 236 'goodsInstore' => $baseInfo['storage'], // 库存量
243 ); 237 );
244 - $soldOut = ($baseInfo['storage'] == 0) || ($totalStorageNum === 0); 238 + $soldOut = ($baseInfo['storage'] == 0) || ($baseInfo['status'] == 0);
245 $notForSale = $baseInfo['attribute'] == 2; 239 $notForSale = $baseInfo['attribute'] == 2;
246 // 显示加入购物车链接 240 // 显示加入购物车链接
247 if (!$soldOut && !$notForSale) { 241 if (!$soldOut && !$notForSale) {
@@ -556,7 +550,10 @@ class DetailModel @@ -556,7 +550,10 @@ class DetailModel
556 $preference = DetailData::preference($productSkn, $channel, $brandId); 550 $preference = DetailData::preference($productSkn, $channel, $brandId);
557 if (!empty($preference)) { 551 if (!empty($preference)) {
558 foreach ($preference as $value) { 552 foreach ($preference as $value) {
559 - $result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false); 553 + $value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
  554 + if (false !== $value) {
  555 + $result['recommendList'][] = $value;
  556 + }
560 } 557 }
561 } 558 }
562 } 559 }
@@ -338,7 +338,12 @@ class IndexController extends AbstractAction @@ -338,7 +338,12 @@ class IndexController extends AbstractAction
338 $result = CartModel::getCouponList($uid); 338 $result = CartModel::getCouponList($uid);
339 } 339 }
340 340
341 - $this->echoJson($result); 341 + if (empty($result)) {
  342 + // 这儿需要返回空数组,勿改!!!
  343 + echo '[]';
  344 + } else {
  345 + $this->echoJson($result);
  346 + }
342 } 347 }
343 348
344 /** 349 /**
@@ -108,7 +108,7 @@ routes.girls.type = "rewrite" @@ -108,7 +108,7 @@ routes.girls.type = "rewrite"
108 routes.girls.match = "/girl$" 108 routes.girls.match = "/girl$"
109 routes.girls.route.module = Index 109 routes.girls.route.module = Index
110 routes.girls.route.controller = Girls 110 routes.girls.route.controller = Girls
111 -routes.girls.route.action = index 111 +routes.girls.route.action = Index
112 112
113 ; 商品筛选 113 ; 商品筛选
114 routes.goodsfilter.type = "rewrite" 114 routes.goodsfilter.type = "rewrite"
@@ -147,3 +147,9 @@ routes.productintro.route.controller = Detail @@ -147,3 +147,9 @@ routes.productintro.route.controller = Detail
147 routes.productintro.route.action = Intro 147 routes.productintro.route.action = Intro
148 routes.productintro.map.1 = productSkn 148 routes.productintro.map.1 = productSkn
149 149
  150 +; 订单相关
  151 +routes.cart.type = "rewrite"
  152 +routes.cart.match = "/home/order/detail$"
  153 +routes.cart.route.module = Index
  154 +routes.cart.route.controller = Home
  155 +routes.cart.route.action = Homedetail