Authored by 郭成尧

Merge remote-tracking branch 'remotes/origin/master' into feature/unionpromotion

... ... @@ -7,6 +7,7 @@
'use strict';
const indexModel = require('../models/market');
const _ = require('lodash');
exports.index = (req, res, next) => {
... ... @@ -21,3 +22,26 @@ exports.index = (req, res, next) => {
}).catch(next);
};
/**
* 市场推广活动升级版,自定义下载渠道
* @param req
* @param res
* @param next
*/
exports.v2 = (req, res, next) => {
indexModel.index({
}).then((result) => {
if (_.has(result, 'download[0].url') && req.query.union_type) {
result.download[0].url = result.download[0].url.split('?')[0] +
'?union_type=' + req.query.union_type;
}
res.render('market/market', Object.assign(result, {
title: 'Yoho!Buy 有货'
}));
}).catch(next);
};
... ...
... ... @@ -12,3 +12,27 @@ exports.wechatShare = (req, res, next) => {
res.jsonp(result);
}).catch(next);
};
/**
* 活动页<http://feature.yoho.cn/1101/1101ITEMBOY/index.html?title=%E7%94%B7%E7%94%9F%E5%88%86%E4%BC%9A%E5%9C%BA&share_id=814&mkt_code=1011111#a_01>
* <xiaoxiao.hao@yoho.cn>
* 2016/07/13
*/
// 活动页保存相应cookie的值
exports.feature = (req, res) => {
let mktCode = req.query.mkt_code || false;
// 下载浮层,下载按钮会用到该参数
if (mktCode) {
res.cookie('mkt_code', mktCode, {
domain: '.yohobuy.com',
path: '/'
});
res.cookie('unionTypeYas', mktCode, {
path: '/'
});
}
res.json({mktCode: mktCode});
};
\ No newline at end of file
... ...
... ... @@ -71,6 +71,7 @@ router.get('/invite', invite.checkType, invite.index);
router.get('/invite/index', invite.checkType, invite.index);
router.get('/market', market.index); // 市场推广活动
router.get('/market/v2', market.v2); // 市场推广活动升级版,自定义下载渠道
router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share);
... ... @@ -116,4 +117,7 @@ router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck)
router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin);
router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStudent);
// 获取活动页传来的参数
router.get('/wechat/1111', wechat.feature);
module.exports = router;
... ...
... ... @@ -60,13 +60,14 @@ exports.ensure = (req, res, next) => {
let view;
if (paymentInfo.code !== 200) {
if (paymentInfo.message) {
view = {
orderEnsure: false,
message: paymentInfo.message
};
} else {
return Promise.reject(paymentInfo);
view = {
orderEnsure: false,
message: paymentInfo.message
};
// hotfix: nginx 接口限流, code:9999991时没message 信息
if (!view.message) {
view.message = '挤爆啦,系统繁忙';
}
} else {
// 渲染
... ...
... ... @@ -12,10 +12,6 @@
{{/if}}
<!--/tab-nav-->
{{#if isApp}}
<div class='empty-height'></div>
{{/if}}
<div class="plusstar-resources">
<!--资源位数据模板-->
</div><!--/plusstar-resources-->
... ...
... ... @@ -136,7 +136,7 @@ const _shop = (req, res, shopId) => {
_.forEach(result.hotList, (value, key) => {
result.hotList[key].tags = {};
result.hotList[key].is_soon_sold_out = false;
result.hotList[key].tags.isHot = true;
result.hotList[key].tags.is_hot = true;
});
// 有领券功能,不缓存
... ... @@ -495,6 +495,9 @@ const userCoupon = (req, res, next) => {
}
}
cryptCouponId = parseInt(cryptCouponId, 10);
uid = parseInt(uid, 10);
if (uid) {
listModel.receiveCoupon(
uid,
... ...
... ... @@ -25,106 +25,109 @@ const list = (req, res, next) => {
let isQuerySecondClass = false; // 标识用户搜的是不是二级品类
let domain = null;
if (params.query) {
let activity = _.get(searchModel.searchKeyActivity(params.query), 'data.urlobj.appUrl', '');
if (activity) {
res.redirect(activity);
}
}
if (params.shop_id) {
params.shopId = params.shop_id;
}
/* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */
Promise.all([
searchModel.getAllBrandNames(),
searchModel.getClassNames()
]).then(result => {
if (query) {
query = query.toLowerCase();
_.forEach(result[0], obj => {
if (query === obj.brandDomain) { // 精确查品牌域名
domain = query;
return false;
}
if (query === obj.brandName || query === obj.brandName || query === obj.brandName) { // 精确查品牌名称
domain = obj.brandDomain;
return false;
}
// if (obj.brandDomain.indexOf(query) > 0) { // 模糊查品牌域名
// domain = obj.brandDomain;
// return false;
// }
});
// 跳转到品牌商品列表页
if (domain !== null && !params.shop_id) {
let url = helpers.urlFormat('', {
from: 'search',
query: query
}, domain);
return res.redirect(url);
}
// 品类名称为空时跳出
if (!result[1]) {
return;
}
_.forEach(result[1].first, (obj) => {
// 精确查一级品类
if (obj === query) {
isQueryFirstClass = true;
return false;
}
});
_.forEach(result[1].second, (obj) => {
// 精确查二级品类
if (obj === query) {
isQuerySecondClass = true;
return false;
}
});
} else {
params.query = '';
}
// 搜索是一级品类
if (isQueryFirstClass) {
title = '全部' + query;
} else if (isQuerySecondClass) { // 搜索是二级品类
title = query;
} else { // 搜索其它内容
if (query || params.form) {
params.search = {
default: query === '' ? false : query,
url: helpers.urlFormat('', null, 'search')
};
if (params.query) {
return searchModel.searchKeyActivity(params.query).then(activityResult => {
let activity = _.get(activityResult, 'urlobj.appUrl', '');
if (activity) {
return res.redirect(activity);
} else {
/* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */
return Promise.all([
searchModel.getAllBrandNames(),
searchModel.getClassNames()
]).then(result => {
if (query) {
query = query.toLowerCase();
_.forEach(result[0], obj => {
if (query === obj.brandDomain) { // 精确查品牌域名
domain = query;
return false;
}
if (query === obj.brandName || query === obj.brandName || query === obj.brandName) { // 精确查品牌名称
domain = obj.brandDomain;
return false;
}
// if (obj.brandDomain.indexOf(query) > 0) { // 模糊查品牌域名
// domain = obj.brandDomain;
// return false;
// }
});
// 跳转到品牌商品列表页
if (domain !== null && !params.shop_id) {
let url = helpers.urlFormat('', {
from: 'search',
query: query
}, domain);
return res.redirect(url);
}
// 品类名称为空时跳出
if (!result[1]) {
return;
}
_.forEach(result[1].first, (obj) => {
// 精确查一级品类
if (obj === query) {
isQueryFirstClass = true;
return false;
}
});
_.forEach(result[1].second, (obj) => {
// 精确查二级品类
if (obj === query) {
isQuerySecondClass = true;
return false;
}
});
} else {
params.query = '';
}
// 搜索是一级品类
if (isQueryFirstClass) {
title = '全部' + query;
} else if (isQuerySecondClass) { // 搜索是二级品类
title = query;
} else { // 搜索其它内容
if (query || params.form) {
params.search = {
default: query === '' ? false : query,
url: helpers.urlFormat('', null, 'search')
};
}
title = '搜索';
}
title = params.title ? params.title : title;
res.render('search/list', {
module: 'product',
page: 'search-list',
pageHeader: headerModel.setNav({
navTitle: title
}),
title: title,
goodList: params,
pageFooter: true
});
}).catch(next);
}
title = '搜索';
}
title = params.title ? params.title : title;
res.render('search/list', {
module: 'product',
page: 'search-list',
pageHeader: headerModel.setNav({
navTitle: title
}),
title: title,
goodList: params,
pageFooter: true
});
}).catch(next);
}
};
/**
... ... @@ -132,6 +135,7 @@ const list = (req, res, next) => {
*/
const index = (req, res, next) => {
let title = '搜索';
((render) => {
if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) {
render([]);
... ... @@ -140,7 +144,7 @@ const index = (req, res, next) => {
render(result);
}).catch(next);
}
})((result) => {
res.render('search/index', {
module: 'product',
... ... @@ -156,8 +160,8 @@ const index = (req, res, next) => {
}
});
})
});
};
/**
... ...
'use strict';
const SECOND = 1;
... ... @@ -43,6 +42,7 @@ const cachePage = {
// 秒杀列表
'/product/seckill': 30 * SECOND,
'/product/seckill/list': 30 * SECOND,
// 秒杀详情
'/product/^\\/seckill\\/pro_([\\d]+)_([\\d]+)/': 30 * MINUTE,
... ... @@ -64,10 +64,17 @@ const cachePage = {
'/brands': 5 * MINUTE,
'/brands/search': 1 * MINUTE,
//活动
// 直播活动
'/activity/live': 1 * MINUTE,
// 单品日
'/activity/single-day': 1 * MINUTE,
'/activity/single-day/getSingleData': 30 * SECOND,
'/activity/single-day/getProductData': 30 * SECOND,
// 店铺收藏
'/activity/shopCollect': 1 * MINUTE,
'/activity/live': 1 * MINUTE
'/activity/shopNav': 30 * SECOND
};
... ...
{
"name": "m-yohobuy-node",
"version": "5.1.7",
"version": "5.1.10",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -127,6 +127,8 @@ var singleDay = {
$swiperTab.on('click', function() {
var index = $(this).index();
$('body').scrollTop(0);
$swiperTab.removeClass('active').eq(index).addClass('active');
if (self.$productTab.eq(index).find('li').length > 0) {
... ...
... ... @@ -398,6 +398,8 @@ function givePoint(parameter) {
}
break;
}
} else {
header.removeClass('girls', 'life-style', 'kids').addClass('boys');
}
}());
... ...
... ... @@ -4,8 +4,7 @@ var $ = require('yoho-jquery'),
loading = require('../plugin/loading'),
debounce = require('lodash/debounce');
var plusstar = {},
$footer = $('#yoho-footer');
var plusstar = {};
var windowHeight = $(window).height();
var scrollFn,
... ... @@ -186,6 +185,9 @@ plusstar = {
return true;
}
// 固定底部去除
window.rePosFooter();
// 记录切换tab位置
$(document).scrollTop(window.cookie(code) || 0);
... ... @@ -303,23 +305,17 @@ $(function() {
apt: window.queryString.client_type || '',
sid: window.queryString.session_id || '',
};
}
// 男:1,女:2,潮童:3,创意生活:4
speckParamApp.CID = window.queryString.yh_channel || window._ChannelVary[window.cookie('_Channel')] || 1;
if (!isApp) {
$('.plusstar-resources').css({'margin-top': $('.tab-nav').height()});
} else {
$('.tab-nav').css({
position: 'relative'
});
$footer.css({
'max-width': '650px'
}).before(
'<div style="height: ' + parseInt($footer.css('height'), 0) + 'px"></div>'
);
}
// 男:1,女:2,潮童:3,创意生活:4
speckParamApp.CID = window.queryString.yh_channel || window._ChannelVary[window.cookie('_Channel')] || 1;
plusstar.init();
// 滚动翻页
... ...
... ... @@ -14,6 +14,8 @@ var tip = require('../../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
require('../../common');
api.bindEyesEvt({
status: 'open' // 默认眼睛打开
});
... ... @@ -49,6 +51,16 @@ $btnSure.on('touchstart', function() {
var res = data.data;
if (data.code === 200) {
// 统计代码:用于统计从哪个渠道注册成功的
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_REGISTER_SUCCESS_L',
param: JSON.stringify({
C_ID: window._ChannelVary[window.cookie('_Channel')] || 1,
UNION_TYPE: window.queryString.union_type || window.cookie('unionTypeYas') || false
})
}, true);
}
showErrTip('注册成功');
location.href = res.href;
... ...
... ... @@ -127,7 +127,7 @@ function render(data) {
$('#limitProductCode').val(data.cartInfo.limitProductCode).removeClass(dbClass);
}
}
if (data.isCollect) {
if (data.isCollect === true) {
$('#likeBtn').addClass('liked');
}
if (data.tickets) {
... ...
... ... @@ -242,6 +242,7 @@ seckillObj = {
data = $.extend(data, {isApp: yoho.isApp});
$('.product-list').html(self.listTemplate(data));
lazyload('img.lazy');
window.scrollTo(0, 0);
window.rePosFooter();
},
error: function(data) {
... ...
... ... @@ -199,7 +199,7 @@ function getPageGoods(info) {
url: info.url,
data: info.data,
success: function(data) {
if (data === ' ') {
if (data === '') {
nav.end = true;
}
... ... @@ -325,6 +325,7 @@ var theY;
*/
function reNav1Pos() {
var sTop = theY ? theY : 0;
if (sTop < imgH + main1oH + nav1H) {
if ($nav1.hasClass('hide')) {
$nav1.removeClass('hide');
... ... @@ -385,6 +386,7 @@ function scrollHandler() {
if (sTop + winH * 2 > scH) {
scrollCall = function() {
var translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
$nav1.css({
transform: translate,
'-moz-transform': translate,
... ... @@ -681,7 +683,7 @@ function search(opt) {
break;
}
if (data === ' ') {
if (data === '') {
nav.end = true;
if (nav.reload) {
... ... @@ -929,6 +931,7 @@ $nav2.on('touchstart', 'li', function(e) {
$('.shop-foot-wrapper .buriedpoint').click(function() {
var subGroup = $(this).find('.sub-group');
if (subGroup.hasClass('hide')) {
subGroup.removeClass('hide');
} else {
... ...
... ... @@ -18,12 +18,13 @@
position: fixed;
z-index: 10;
background-color: #fff;
top: 0;
li {
display: block;
float: left;
height: 100%;
width: 33.33%;
width: 50%;
line-height: 60px;
color: #999;
white-space: nowrap;
... ...