Authored by hf

do fixes bug to home order bugs

Showing 33 changed files with 325 additions and 187 deletions
... ... @@ -33,6 +33,7 @@ class AbstractAction extends Controller_Abstract
*/
protected $_uid = 0;
protected $_uname = '';
protected $_vip;
/**
* 存放模板数据
... ... @@ -298,6 +299,7 @@ class AbstractAction extends Controller_Abstract
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$this->_uid = $cookieList[1];
$this->_uname = $cookieList[0];
$this->_vip = $cookieList[2];
}
}
}
... ...
... ... @@ -22,9 +22,15 @@ class CacheConfig
const KEY_ACTION_BOYS_BOTTOM_BANNER = 'key_action_boys_bottom_banner'; // 男生首页底部banner
const KEY_ACTION_GRILS_BOTTOM_BANNER = 'key_action_girls_bottom_banner';// 女生首页底部banner
const KEY_ACTION_PRODUCT_NEWSALE_INDEX = 'key_action_product_newsale_index'; // 新品到着
const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT = 'key_action_product_newsale_discount'; // 热卖排行
const KEY_ACTION_PRODUCT_NEWSALE_INDEX_BOYS = 'key_action_product_newsale_index_boys'; // 男生新品到着
const KEY_ACTION_PRODUCT_NEWSALE_INDEX_GIRLS = 'key_action_product_newsale_index_girls'; // 女生新品到着
const KEY_ACTION_PRODUCT_NEWSALE_INDEX_KIDS = 'key_action_product_newsale_index_kids'; // 潮童新品到着
const KEY_ACTION_PRODUCT_NEWSALE_INDEX_LIFESTYLE = 'key_action_product_newsale_index_lifestyle'; // 创意生活新品到着
const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_BOYS = 'key_action_product_newsale_discount_boys'; // 男生热卖排行
const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_GIRLS = 'key_action_product_newsale_discount_girls'; // 女生热卖排行
const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_KIDS = 'key_action_product_newsale_discount_kids'; // 潮童热卖排行
const KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_LIFESTYLE = 'key_action_product_newsale_discount_lifestyle'; // 创意生活热卖排行
const KEY_ACTION_PRODUCT_INDEX = 'key_action_product_index'; // 品类商品列表
const KEY_ACTION_PRODUCT_BRAND = 'key_action_product_brand'; // 品类商品列表
const KEY_ACTION_PRODUCT_BRAND_DOMAINS = 'key_action_product_brand_domains'; // 所有品牌域名列表
... ...
... ... @@ -165,7 +165,7 @@ class RegData
$param['password'] = $password;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -99,6 +99,7 @@ class NewsaleData
$param['method'] = 'app.search.newProduct';
} else {
$param['method'] = 'app.search.sales';
$param['p_d'] = '0.1,0.9';
}
$param['page'] = $page;
$param['limit'] = $limit;
... ...
... ... @@ -269,7 +269,9 @@ class FloorProcess
foreach ($data as $key => &$value) {
if ($key == 'title') {
$value['more_url'] = Helpers::url('', array('id' => 4, 'gender' => self::$channel[$type]), 'guang');
$urlParam = array('id' => 4);
isset(self::$channel[$type]) && $urlParam['gender'] = self::$channel[$type];
$value['more_url'] = Helpers::url('', $urlParam, 'guang');
}
if ($key == 'list') {
foreach ($value as &$one) {
... ...
... ... @@ -508,8 +508,39 @@ class Helpers
} elseif ($vo['goods_type'] == 'price_gift') {
$arr[$key]['advanceBuy'] = true;
}
if (!empty($vo['expect_arrival_time'])) {
$arr[$key]['appearDate'] = $vo['expect_arrival_time'];
}
}
return $arr;
}
/**
* 获取会员的级别
*
* @param string $vipInfo
* @return int
*/
public static function getVipLevel($vipInfo)
{
$vipLevel = 0;
switch ($vipInfo) {
case '普通会员':
$vipLevel = 0;
break;
case '银卡会员':
$vipLevel = 1;
break;
case '金卡会员':
$vipLevel = 2;
break;
case '白金会员':
$vipLevel = 3;
break;
}
return $vipLevel;
}
}
... ...
... ... @@ -11,8 +11,9 @@ var $ = require('jquery'),
var swiper,
$fixTitleBar,
$brandList = $('.brand-list');
var $icon = $('.search-icon');
$brandList = $('.brand-list'),
$icon = $('.search-icon'),
hotBrandsSwiper;
var searchH = $('.newbrand-search').outerHeight(),
headerH = $('.yoho-header').outerHeight(),
... ... @@ -23,6 +24,14 @@ var brandsData,
$keyword,
clearTextHammer;
//热门品牌滑动
hotBrandsSwiper = new Swiper('.brands-swiper', {
grabCursor: true,
slidesPerView: 'auto',
wrapperClass: 'brands-list',
slideElement: 'li'
});
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
... ... @@ -37,12 +46,16 @@ $('.yoho-header').css({
top: 0
});
if ($('.banner-top').length > 0) {
$('.hot-brands').css('padding-top', '0');
}
$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
$fixTitleBar.css({
position: 'fixed',
top: brandSwipe
}).hide();
minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() + $('.banner-top').outerHeight();
minBrandListTop = brandSwipe + $('.hot-brands').outerHeight() + $('.banner-top').outerHeight();
$brandList.last().append($fixTitleBar);
function scrollHandler() {
... ...
... ... @@ -138,7 +138,7 @@ $('.maybe-like p').on('touchstart', function(e) {
});
function scrollHandler() {
if ($(window).scrollTop() + winH >= $(document).height() - 50) {
if ($(window).scrollTop() + winH >= $(document).height() - 200) {
search();
}
}
... ...
... ... @@ -83,12 +83,20 @@ $loginBtn.on('touchstart', function() {
password: pwd
},
success: function(data) {
var res;
if (data.code === 200) {
res = data.data;
showErrTip('登录成功');
$.ajax({
url: res.session,
dataType: 'jsonp'
});
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
location.href = res.href;
}, 1000);
} else {
showErrTip(data.message);
... ...
... ... @@ -86,12 +86,21 @@ $loginBtn.on('touchstart', function() {
password: pwd
},
success: function(data) {
var res;
if (data.code === 200) {
res = data.data;
showErrTip('登录成功');
$.ajax({
url: res.session,
dataType: 'jsonp'
});
//1s后跳转页面
setTimeout(function() {
location.href = data.data;
location.href = res.href;
}, 1000);
} else {
showErrTip(data.message);
... ...
... ... @@ -46,12 +46,20 @@ $btnSure.on('touchstart', function() {
token: $('#token').val()
},
success: function(data) {
var res;
if (data.code === 200) {
res = data.data;
showErrTip('注册成功');
$.ajax({
url: res.session,
dataType: 'jsonp'
});
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
location.href = res.href;
}, 1000);
} else {
showErrTip(data.message);
... ...
... ... @@ -5,12 +5,14 @@
*/
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var goodsSwiper,
$discountFolder = $('.goodsDiscount .discount-folder'),
$discountArrow = $('.goodsDiscount .first-item span');
var goodsDiscountHammer = new Hammer(document.getElementById('goodsDiscount'));
require('./desc');
require('./comments-consults');
... ... @@ -38,7 +40,7 @@ if (0 === $('.goodsDiscount .discount-folder').children().length) {
}
//goods-discount下拉按钮点击事件
$('.goodsDiscount .dropdown').on('touchend', function(e) {
goodsDiscountHammer.on('tap', function(e) {
if ($discountFolder.is(':hidden')) {
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
$discountFolder.slideDown();
... ... @@ -46,7 +48,7 @@ $('.goodsDiscount .dropdown').on('touchend', function(e) {
$discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
$discountFolder.slideUp();
}
return false;
});
require('./like');
... ...
... ... @@ -425,6 +425,13 @@ if ($brandHeader.length > 0) {
success: function(data) {
if (data.code === 200) {
$this.toggleClass('coled');
//提示
if (opt === 'ok') {
tip.show('添加收藏成功');
} else {
tip.show('取消收藏成功');
}
} else if (data.code === 400) {
location.href = data.data;//未登录跳转登录页
} else {
... ...
... ... @@ -12,8 +12,46 @@ var page = 1,
notab = 0,
sort = '',
id = '',
hotrankNav,
noResult = '<p class="no-result">未找到相关搜索结果</p>';
// var renderRank = {
// errMsg: '<p class="no-result">未找到相关搜索结果</p>',
// navSelector: '.goods-nav',
// rankSelector: '#hotRank',
// navHTML: null,
// data: null,
// inited: 0,
// setData: function(data) {
// this.data = data;
// },
// showDataEmptyMsg: function() {
// $(this.rankSelector).append(this.errMsg);
// },
// isDataEmpty: function() {
// if (this.data.indexOf('>') === -1) {
// return true;
// } else {
// return false;
// }
// },
// appendData: function() {
// if (!this.inited) {
// this.inited = 1;
// }
// $(this.rankSelector).append(this.data);
// },
// render: function(data) {
// this.setData(data);
// if (!this.isDataEmpty()) {
// this.appendData();
// } else {
// this.showDataEmptyMsg();
// }
// }
// };
function hotrank(page, sort, tabId, notab) {
loading.showLoadingMask();
$.ajax({
... ... @@ -26,15 +64,47 @@ function hotrank(page, sort, tabId, notab) {
notab: notab
},
success: function(data) {
console.log(data);
if (page === 1) {
$('.rank-main').remove();
}
if (data === ' ' && $('.rank-main ul li').length < 1) {
$('#hotRank').html(noResult);
// if (page === 1) {
// $('.no-result').remove();
// $('.rank-main').remove();
// }
// if (notab === 1) {
// if (data === ' ' && $('.rank-main').length < 1) {
// var hotrankNav = $('.goods-nav').prop("outerHTML");
// $('#hotRank').html(hotrankNav + noResult);
// } else {
// $('#hotRank').append(data);
// }
// } else {
// if (data === ' ') {
// $('#hotRank').html(noResult);
// } else {
// $('#hotRank').append(data);
// }
// }
if (data === ' ') {
if ($('.rank-main').length < 1 && $('.goods-nav').length < 1) {
$('#hotRank').html(noResult);
} else {
if (page === 1) {
hotrankNav = $('.goods-nav').prop('outerHTML');
$('#hotRank').html(hotrankNav + noResult);
}
}
} else {
$('.no-result').remove();
$('.rank-main').remove();
$('#hotRank').append(data);
}
// renderRank.render(data);
lazyLoad($('img.lazy'));
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
winH = $(window).height();
... ... @@ -83,7 +153,11 @@ hotnav.on('tap', function(e) {
id = target.getAttribute('data-id') ? target.getAttribute('data-id') : '';
sort = target.getAttribute('data-sort') ? target.getAttribute('data-sort') : '';
page = 1;
// notab = renderRank.inited;
notab = 1;
hotrank(page, sort, id, notab);
}
});
... ...
... ... @@ -75,6 +75,10 @@
background-color:#f8f8f8;
}
.hot-brands {
padding-top: 178rem / $pxConvertRem;
}
.hot-brand {
margin: (30rem / $pxConvertRem) 0 0;
... ...
... ... @@ -13,6 +13,7 @@
right: 0;
bottom: 22rem / $pxConvertRem;
text-align: center;
z-index: 0;
.pagination-inner {
display: inline-block;
... ...
... ... @@ -204,6 +204,7 @@
position: absolute;
top: 20rem / $pxConvertRem;
right: 30rem / $pxConvertRem;
text-align: right;
}
.price {
... ... @@ -216,4 +217,8 @@
text-align: right;
line-height: 45rem / $pxConvertRem;
}
.appear-date {
color: #f00;
}
}
\ No newline at end of file
... ...
... ... @@ -31,6 +31,8 @@ $basicBtnC:#eb0313;
margin-bottom: pxToRem(20px);
font-size: pxToRem(24px);
line-height: pxToRem(36px);
display: flex;
flex-wrap: wrap;
&.table {
width: 100%;
.column {
... ... @@ -42,6 +44,8 @@ $basicBtnC:#eb0313;
font-size: pxToRem(24px);
background-color: $tableCellC;
float: left;
display: flex;
align-items: center;
}
}
}
... ... @@ -135,10 +139,13 @@ $basicBtnC:#eb0313;
// overflow: hidden;
}
.banner-top-single{
width: pxToRem(448px);
margin:pxToRem(30px) pxToRem(72px);
margin:0 auto;
overflow: hidden;
img{
width: pxToRem(448px);
margin-top:pxToRem(30px);
margin-bottom:pxToRem(30px);
}
}
.banner-top {
// width: 100%;
... ...
... ... @@ -9,25 +9,17 @@
</div>
</div>
{{# bannerTop}}
{{> home/banner_top}}
{{/ bannerTop}}
{{# topData}}
{{! 头部banner}}
{{# bannerTop}}
{{> home/banner_top}}
{{/ bannerTop}}
{{# hotBrand}}
<div class="hot-brand">
<ul class="hot-brand-list clearfix">
{{# list}}
<li>
<a href="{{url}}">
<div class="img-box">
<img class="lazy" data-original="{{img}}" alt="">
</div>
</a>
</li>
{{/ list}}
</ul>
</div>
{{/ hotBrand}}
{{! 热门品牌可滑动}}
{{# hotBrandsScroll}}
{{> home/hot_brands_swipe}}
{{/ hotBrandsScroll}}
{{/ topData}}
{{# brandList}}
<div class="brand-list bar-{{@index}}">
... ...
... ... @@ -64,7 +64,7 @@
{{/vipLevel}}
{{# goodsDiscount}}
<div class="goodsDiscount">
<div class="goodsDiscount" id="goodsDiscount">
{{# list}}
{{#if @first}}
{{#if text}}
... ...
<div class="order-good" data-id={{id}}>
<div class="order-good" data-id="{{id}}">
<div class="thumb-wrap">
<img class="thumb lazy" data-original={{thumb}}>
<img class="thumb lazy" data-original="{{thumb}}">
<p class="tag{{#if gift}} gift-tag{{/if}}{{#if advanceBuy}} advance-buy-tag{{/if}}"></p>
</div>
<div class="deps">
... ... @@ -25,6 +25,9 @@
<span class="count">
×{{count}}
</span>
{{#if appearDate}}
<span class="appear-date">上市期:{{appearDate}}</span>
{{/if}}
</p>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -50,7 +50,7 @@
{{/ consults}}
</div>
<div class="consult-content-footer">
<a href="/product/detail/consults">
<a href="{{link}}">
查看更多
<span class="iconfont">&#xe604;</span></a>
</div>
... ...
... ... @@ -462,12 +462,18 @@ class HomeController extends AbstractAction
*/
public function onlineServiceDetailAction()
{
$service = array();
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
}
$service = array(
'header' => array('title' => '在线客服'),
'service' => $service
);
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
$this->_view->display('online-service-detail', $service);
... ... @@ -596,9 +602,8 @@ class HomeController extends AbstractAction
//显示网站导航头部信息
$this->setNavHeader('会员等级');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$data = GradeModel::getGrade($gender, $channel, $this->_uid);
$data = GradeModel::getGrade($channel, $this->_uid);
$data['pageFooter'] = true;
$this->_view->display('vip-grade', $data);
... ...
... ... @@ -3,6 +3,7 @@
namespace Category;
use LibModels\Wap\Category\BrandData;
use Plugin\DataProcess\FloorProcess;
use Plugin\Helpers;
/**
... ... @@ -60,55 +61,8 @@ class BrandModel
// 搜索链接地址
$result['searchUrl'] = Helpers::url('/brands/search', null);
/* 顶部的轮翻广告或热门品牌列表(当没有轮翻广告的情况下会是这个样子的! 此处是根据接口改造成的逻辑) */
if (!empty($brand['brandTop'][0]['data']['list'])) {
$build = array();
foreach ($brand['brandTop'][0]['data']['list'] as $value) {
if (isset($value['url'])) {
$build['url'] = Helpers::getFilterUrl($value['url']);
}
$build['img'] = Helpers::getImageUrl($value['src'], 144, 144);
$build['name'] = $value['name'];
$result['hotBrand']['list'][] = $build;
}
}
// 顶部的轮翻广告列表
elseif (!empty($brand['brandTop'][0]['data'])) {
$build = array();
foreach ($brand['brandTop'][0]['data'] as $value) {
if (isset($value['url'])) {
$build['url'] = Helpers::getFilterUrl($value['url']);
}
$build['img'] = Helpers::getImageUrl($value['src'], 640, 310);
$build['title'] = $value['title'];
$result['bannerTop']['list'][] = $build;
}
}
// 顶部的轮翻广告列表
elseif (!empty($brand['brandTop']['list'][0]['data'])) {
$build = array();
foreach ($brand['brandTop']['list'][0]['data'] as $value) {
if (isset($value['url'])) {
$build['url'] = Helpers::getFilterUrl($value['url']);
}
$build['img'] = Helpers::getImageUrl($value['src'], 640, 310);
$build['title'] = $value['title'];
$result['bannerTop']['list'][] = $build;
}
}
/* 顶部的热门品牌列表 (备注: 当没有轮翻广告的时候,此处内部的foreach不会被执行) */
if (!empty($brand['brandTop'][1]['data']['list'])) {
$build = array();
foreach ($brand['brandTop'][1]['data']['list'] as $value) {
if (isset($value['url'])) {
$build['url'] = Helpers::getFilterUrl($value['url']);
}
$build['img'] = Helpers::getImageUrl($value['src'], 144, 144);
$build['name'] = $value['name'];
$result['hotBrand']['list'][] = $build;
}
}
// 资源位处理
$result['topData'] = FloorProcess::getContent(array('list' => $brand['brandTop']), $channel);
/* 按字母'A-Z'分组的品牌列表 */
if (!empty($brand['brandList']['brands'])) {
... ...
... ... @@ -70,21 +70,17 @@ class OnlineModel
return $result;
}
$res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
$questionInfo = $res['data'];
if ($questionInfo) {
if (isset($res['code']) && $res['code'] === 200) {
$questionInfo = $res['data'];
$list = array();
if ($questionInfo) {
foreach ($questionInfo as $qk => $qv) {
$list[$qk]['q'] = $qv['title'];
$list[$qk]['a'] = $qv['content'];
}
foreach ($questionInfo as $qk => $qv) {
$list[$qk]['q'] = $qv['title'];
$list[$qk]['a'] = $qv['content'];
}
//处理返回信息
$result = array(
'header' => array('title' => '在线客服'),
'list' => $list
);
!empty($list) && $result['list'] = $list;
}
return $result;
}
... ...
... ... @@ -23,7 +23,7 @@ class OrderModel
{
$result = array();
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
... ... @@ -38,6 +38,7 @@ class OrderModel
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods']);
$result[$key]['detailUrl'] = Helpers::url('/home/orders/detail', array('order_code' => $vo['order_code'], 't' => time()));
//根据订单status判断订单处于什么状态。
do {
//订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
... ... @@ -51,7 +52,7 @@ class OrderModel
//支付方式为非货到付款时,计算订单状态。
if ($vo['payment_type'] != 2) {
switch ($vo['status']) {
case 0:
case 0: // 备货中
$result[$key]['unpaid'] = true;
break;
//未发货&未收货 状态,统一合并到待收货状态。
... ... @@ -78,7 +79,8 @@ class OrderModel
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0:
case 0:
break;
case 1:
case 2:
case 3:
... ...
... ... @@ -27,7 +27,7 @@ class HomeModel
/* 女生楼层资源的位置码 */
const CODE_FLOOR_GIRLS = '189b6686065dbd6755dd6906cf03c002';
/* 潮童楼层资源的位置码 */
const CODE_FLOOR_KIDS = 'b8c1bff53d4ea60f978926d538620636'; // '66cad79d93e055ad6fc5c8744086066d';
const CODE_FLOOR_KIDS = '66cad79d93e055ad6fc5c8744086066d'; // '66cad79d93e055ad6fc5c8744086066d';
/* 创意生活楼层资源的位置码 */
const CODE_FLOOR_LIFESTYLE = '61cd852c6afcf60660196154f66a3a62';
... ... @@ -98,8 +98,8 @@ class HomeModel
// 调用接口获取数据
$banner = IndexData::getBannerStart(self::CODE_BG);
if (isset($banner['code']) && $banner['code'] == 200 && $banner['data']['total'] > 0) {
$result = Helpers::getImageUrl($banner['data']['list'][0]['data']['list'][0]['src'], 640, 800, 2);
if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) {
$result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 2);
}
if (USE_CACHE) {
... ... @@ -142,10 +142,10 @@ class HomeModel
// 调用接口获取数据
$banner = IndexData::getBannerStart($resource);
if (isset($banner['code']) && $banner['code'] == 200 && $banner['data']['total'] > 0) {
if (isset($banner['code']) && $banner['code'] == 200 && !empty($banner['data'])) {
$result = array();
// 处理数据
foreach ($banner['data']['list'] as $val) {
foreach ($banner['data'] as $val) {
foreach ($val['data'] as $single) {
$result['url'] = ($channel === 2) ? Helpers::url('/boys') : Helpers::url('/girls');
$result['img'] = Helpers::getImageUrl($single['src'], 640, 200);
... ...
... ... @@ -178,7 +178,7 @@ class UserModel
foreach ($favProduct['data']['product_list'] as $val) {
$product = array();
$product['fav_id'] = $val['product_id'];
$product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_id'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$product['imgUrl'] = Helpers::getImageUrl($val['image'], 447, 596);
;
$product['title'] = $val['product_name'];
... ... @@ -231,13 +231,13 @@ class UserModel
$brand['brandName'] = $val['brand_name'];
$brand['update'] = $val['new_product_num'];
$brand['discount'] = $val['product_discount_num'];
$brand['link'] = Helpers::url('', array('query' => $val['brand_name']), 'search');
$brand['link'] = Helpers::url('', array(), $val['brand_domain']);
// 处理品牌产品
$product = array();
foreach ($val['new_product'] as $one) {
$product = array();
$product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$product['link'] = isset($val['goodsList'][0]) ? Helpers::url('/product/pro_' . $val['product_id'] . '_' . $val['goodsList'][0]['id'] . '/' . $val['cnAlphabet'] . '.html') : '';
$product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
$product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] : 0;
$product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] : 0;
... ...
... ... @@ -25,7 +25,7 @@ class DetailModel
* @param int $uid 当前登录用户ID, 未登录为0
* @return array
*/
public static function getBaseInfo($productId, $goodsId, $uid)
public static function getBaseInfo($productId, $goodsId, $uid, $vipLevel)
{
$result = array();
... ... @@ -42,6 +42,11 @@ class DetailModel
if (isset($baseInfo['productName'])) {
$result['goodsName'] = $baseInfo['productName'];
}
// 商品促销短语
if (!empty($baseInfo['salesPhrase'])) {
$result['goodsSubtitle'] = $baseInfo['salesPhrase'];
}
// 商品标签
if (!empty($baseInfo['productTagBoList'])) {
... ... @@ -83,7 +88,7 @@ class DetailModel
foreach ($baseInfo['productPriceBo']['vipPrices'] as $value) {
$build['level'] = $value['vipLevel'];
$build['text'] = $value['vipPrice'];
$build['currentLevel'] = false;
$build['currentLevel'] = ($value['vipLevel'] == $vipLevel) ? true : false;
$result['vipLevel']['list'][] = $build;
}
}
... ... @@ -381,7 +386,6 @@ class DetailModel
'desc' => strtr($productIntro, array(
'\r\n\t' => '',
'</p>' => '',
'<br />' => "\r\n",
'<img src=' => "<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=",
)),
);
... ...
... ... @@ -23,16 +23,16 @@ class NewsaleModel
/* 男生频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637';
const CODE_TOP_SALE_BOYS = 'e9c9be32d72e2906d404a72ee24cb523';
/* 女生频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_GIRLS = '1cf7f9f10e2a2670e73d05c568793ad9';
const CODE_TOP_SALE_GIRLS = '0b2d133419a0f7c381306fd3522365e1';
const CODE_TOP_SALE_GIRLS = '785c0e6aab746949073c4ffb9d5106ac';
/* 潮童频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_KIDS = '57457adececa6c748b29c90cad0ae940';
const CODE_TOP_SALE_KIDS = 'de23648d28ee1e8a3f087a9dbac506f8';
const CODE_TOP_SALE_KIDS = 'ad1bb67a6007819c86f737d74172fd2e';
/* 创意生活频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_LIFESTYLE = '04953a61cbf1db426a681e55d496d2fe';
const CODE_TOP_SALE_LIFESTYLE = '01269e498ff5b07756e0733ec0e88c75';
const CODE_TOP_SALE_LIFESTYLE = '8132c7db3adbeb7b0d0002de9691c753';
/**
* 获取新品到着的焦点图资源数据
... ... @@ -46,16 +46,16 @@ class NewsaleModel
/* 根据频道调用接口 */
switch (intval($channel)) {
case 1: // 男生
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, self::CODE_TOP_NEW_BOYS);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_BOYS, self::CODE_TOP_NEW_BOYS);
break;
case 2: // 女生
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, self::CODE_TOP_NEW_GIRLS);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_GIRLS, self::CODE_TOP_NEW_GIRLS);
break;
case 3: // 潮童
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, self::CODE_TOP_NEW_KIDS);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_KIDS, self::CODE_TOP_NEW_KIDS);
break;
case 4: // 创意生活
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX, self::CODE_TOP_NEW_LIFESTYLE);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_LIFESTYLE, self::CODE_TOP_NEW_LIFESTYLE);
break;
}
... ... @@ -74,16 +74,16 @@ class NewsaleModel
/* 根据频道调用接口 */
switch (intval($channel)) {
case 1: // 男生
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, self::CODE_TOP_SALE_BOYS);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_BOYS, self::CODE_TOP_SALE_BOYS);
break;
case 2: // 女生
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, self::CODE_TOP_SALE_GIRLS);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_GIRLS, self::CODE_TOP_SALE_GIRLS);
break;
case 3: // 潮童
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, self::CODE_TOP_SALE_KIDS);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_KIDS, self::CODE_TOP_SALE_KIDS);
break;
case 4: // 创意生活
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT, self::CODE_TOP_SALE_LIFESTYLE);
$result = self::cacheControl(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_DISCOUNT_LIFESTYLE, self::CODE_TOP_SALE_LIFESTYLE);
break;
}
... ... @@ -183,11 +183,11 @@ class NewsaleModel
$newsale = NewsaleData::getNewsaleFocus($codeKey);
// 调用接口获取数据并封装
if (isset($newsale['code']) && !empty($newsale['data']['list'])) {
if(count($newsale['data']['list'][0]['data']) === 1) {
$result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240);
if (isset($newsale['code']) && !empty($newsale['data'])) {
if(count($newsale['data'][0]['data']) === 1) {
$result = Helpers::formatBanner($newsale['data'][0]['data'][0], 640, 240);
} else {
foreach ($newsale['data']['list'][0]['data'] as $one) {
foreach ($newsale['data'][0]['data'] as $one) {
$result['list'][] = Helpers::formatBanner($one, 640, 240);
}
}
... ...
... ... @@ -47,6 +47,9 @@ class LoginController extends AbstractAction
{
$this->setTitle('国际账号登录');
$refer = $this->get('refer', SITE_MAIN . '/?go=1');
$this->setCookie('refer', $refer);
$data = array();
$data['loginInternational'] = true; // 模板中使用JS的标识
$data['backUrl'] = '/'; // 返回的URL链接
... ... @@ -54,7 +57,6 @@ class LoginController extends AbstractAction
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
// 渲染模板
$this->_view->display('international', $data);
}
... ... @@ -115,11 +117,10 @@ class LoginController extends AbstractAction
$refer = SITE_MAIN . '/?go=1';
}
$data['data'] = array(
// 调用老系统的SESSION会话
'session' => 'http://m1.yohobuy.com/Passport/session/index?uid=' . $data['data']['uid'] . '&sign=' . md5($data['data']['uid'] . 'Js8Yn0!EwPM45-ws'),
// 为了异步调用老系统的SESSION会话
'session' => 'http://m1.yohobuy.com/Passport/session/index?callback=call&uid=' . $data['data']['uid'] . '&sign=' . md5($data['data']['uid'] . 'Js8Yn0!EwPM45-ws'),
'href' => rawurldecode($refer),
);
} while (false);
$this->echoJson($data);
... ...
... ... @@ -9,21 +9,22 @@ use Plugin\Helpers;
*/
class RegController extends AbstractAction
{
/**
* 注册页
*/
public function indexAction()
{
$this->setTitle('注册');
$data = array();
$data = array();
$data['regIndex'] = true; // 模板中使用JS的标识
$data['backUrl'] = '/'; // 返回的URL链接
$data['headerText'] = '注册'; // 头部信息
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认的区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
$refer = $this->get('refer', SITE_MAIN . '/?go=1');
$this->setCookie('refer', $refer);
... ... @@ -45,14 +46,14 @@ class RegController extends AbstractAction
$token = $this->get('token');
$mobile = $this->get('phoneNum');
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !Helpers::verifyToken($mobile, $token)) {
$this->error();
}
$this->setTitle('注册-验证码');
$data = array(
'regCode' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -61,8 +62,8 @@ class RegController extends AbstractAction
'areaCode' => '+' . $area, // 地区编号
'phoneNum' => $mobile, // 手机号
'token' => $token, // 访问令牌
);
);
$this->_view->display('code', $data);
}
... ... @@ -78,15 +79,14 @@ class RegController extends AbstractAction
$token = $this->get('token');
$mobile = $this->get('phoneNum');
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area)
|| !Helpers::verifyToken($mobile, $token)) {
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !Helpers::verifyToken($mobile, $token)) {
$this->error();
}
$this->setTitle('注册-设置密码');
$data = array(
'regPwd' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -99,7 +99,7 @@ class RegController extends AbstractAction
$this->_view->display('password', $data);
}
/**
* 验证注册的手机号
*
... ... @@ -110,37 +110,36 @@ class RegController extends AbstractAction
public function verifymobileAction()
{
$data = array('code' => 400, 'message' => '手机号已存在', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode', '86');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
break;
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile);
if (!isset($data['code'])) {
break;
}
/* 返回跳转到验证页面的链接*/
/* 返回跳转到验证页面的链接 */
if ($data['code'] == 200) {
$token = Helpers::makeToken($mobile);
$data['data'] = '/passport/reg/code?token='.$token.'&phoneNum='.$mobile.'&areaCode='.$area;
$data['data'] = '/passport/reg/code?token=' . $token . '&phoneNum=' . $mobile . '&areaCode=' . $area;
}
} while (false);
$this->echoJson($data);
}
/**
* 验证注册的识别码
*
... ... @@ -153,13 +152,13 @@ class RegController extends AbstractAction
public function verifycodeAction()
{
$data = array('code' => 400, 'message' => '验证码错误', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode');
$code = $this->post('code');
... ... @@ -167,26 +166,25 @@ class RegController extends AbstractAction
if (!is_numeric($mobile) || !is_numeric($area) || !isset($code)) {
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::validMobileCode($area, $mobile, $code);
if (!isset($data['code'])) {
break;
}
/* 返回跳转到设置密码的链接*/
/* 返回跳转到设置密码的链接 */
if ($data['code'] == 200) {
$token = Helpers::makeToken($mobile);
$data['data'] = '/passport/reg/password?token='.$token.'&phoneNum='.$mobile.'&areaCode='.$area;
$data['data'] = '/passport/reg/password?token=' . $token . '&phoneNum=' . $mobile . '&areaCode=' . $area;
} else if ($data['code'] == 404) {
$data['message'] = '验证码错误'; //统一验证提示
}
} while (false);
$this->echoJson($data);
}
/**
* 发送验证码
*
... ... @@ -197,31 +195,30 @@ class RegController extends AbstractAction
public function sendcodeAction()
{
$data = array('code' => 400, 'message' => '发送验证码失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode', '86');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
break;
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile);
if (!isset($data['code'])) {
break;
}
} while (false);
$this->echoJson($data);
}
/**
* 设置密码
*
... ... @@ -234,13 +231,13 @@ class RegController extends AbstractAction
public function setpasswordAction()
{
$data = array('code' => 400, 'message' => '密码格式不正确', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$token = $this->post('token');
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode');
... ... @@ -249,7 +246,7 @@ class RegController extends AbstractAction
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !isset($password)) {
break;
}
/* 判断是否允许访问 */
if (!Helpers::verifyToken($mobile, $token)) {
break;
... ... @@ -259,26 +256,29 @@ class RegController extends AbstractAction
if (!Helpers::verifyPassword($password)) {
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::regMobile($area, $mobile, $password);
var_dump($data);
if (!isset($data['code'])) {
break;
}
/* 返回跳转到来源页面 */
if ($data['code'] == 200) {
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
$data['data'] = rawurldecode($refer);
$data['data'] = array(
// 为了异步调用老系统的SESSION会话
'session' => 'http://m1.yohobuy.com/Passport/session/index?uid=' . $data['data']['uid'] . '&sign=' . md5($data['data']['uid'] . 'Js8Yn0!EwPM45-ws'),
'href' => rawurldecode($refer),
);
}
} while (false);
$this->echoJson($data);
}
}
\ No newline at end of file
}
... ...
D:\workspace\yohobuy.git.dev.yoho.cn\yohobuy\m.yohobuy.com\application\modules\Product\controllers\Detail.php
\ No newline at end of file
... ...