Authored by 郝肖肖

Merge branch 'release/5.2' of git.yoho.cn:fe/yohobuywap-node into release/5.2

... ... @@ -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);
};
... ...
... ... @@ -17,19 +17,19 @@ const getPageInfo = (pageInfo) => {
dest.activityID = pageInfo.id;
dest.title = pageInfo.data.h5Title;
dest.activityDesc = pageInfo.data.activityDesc;
dest.formatActivityDesc = pageInfo.data.formatActivityDesc;
dest.couponPic = pageInfo.data.couponPic;
dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic;
dest.mobile = pageInfo.data.mobile;
dest.wechatShare = true;
dest.secondScreenPic = pageInfo.data.secondScreenPic;
// 强制活动开始,活动上线产品要求这样设置
pageInfo.data.flag = 1;
if (pageInfo.data.flag === 1) {
dest.bgImg = pageInfo.data.activityNormalPic;
} else {
if (pageInfo.data.flag === 3 || pageInfo.data.flag === 4) {
// flag为3 表示活动结束 , 4 表示未开始
dest.bgImg = pageInfo.data.activityEndPic;
dest.ended = true;
} else {
dest.bgImg = pageInfo.data.activityNormalPic;
}
dest.message = pageInfo.data.returnMsg;
}
... ... @@ -115,4 +115,4 @@ exports.registerAndSendCoupon = (data) => {
return api.get('', verifyData).then(result => {
return getUserStatus(result);
}); // 所有数据返回一个 Promise,方便 Promise.all 调用
};
\ 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);
... ...
... ... @@ -60,6 +60,7 @@
</div>
<div class="tip-wrap hidden">
<img src="{{image bgImg 640 1136}}">
<div class="tip fail">
<div class="header">
</div>
... ... @@ -81,7 +82,12 @@
<div class="mask hidden"></div>
<div class="dialog hidden" id="message">
<span class="close"></span>
{{{activityDesc}}}
<div class="activity-message">
<h3>活动说明</h3>
<div class="message">
{{{formatActivityDesc}}}
</div>
</div>
</div>
... ...
... ... @@ -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-->
... ...
... ... @@ -490,6 +490,9 @@ const userCoupon = (req, res, next) => {
let isApp = req.body.app_version || req.body.appVersion || false;
let data = {};
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([]);
... ...
{
"name": "m-yohobuy-node",
"version": "5.1.9",
"version": "5.1.10",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -182,18 +182,8 @@ $mask.on('click', function() {
});
// 埋点
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.floor-focus').find('li').on('click', function() {
// event.preventDefault();
... ...
... ... @@ -19,8 +19,7 @@ var $mobileWrap = $('.mobile-wrap'),
swiperClass,
isen = true;
var getChannel,
C_ID;
var C_ID;
require('../common');
fastclick.attach(document.body);
... ... @@ -257,7 +256,7 @@ var checkShop = function() {
for (var i = 0, elem;
(elem = result.data[i]) != null; i++) {
var a = $('.recom-shop[shopId = ' + elem.id + ']');
a.find('.faved-num').text(elem.collectionNum + "人已收藏");
a.find('.faved-num').text(elem.collectionNum + '人已收藏');
if (elem.favorite) {
a.find('.fav-no').hide();
a.find('.fav-yes').show();
... ... @@ -265,7 +264,7 @@ var checkShop = function() {
}
}
});
}
};
checkShop();
// 店铺收藏 || 取消收藏
... ... @@ -353,26 +352,16 @@ var saleTime = function(elem, offsetTime) {
}
}
}
};
let endTime = $('.sale-floor-time').attr('data-time'),
// ~~两次取反位运算就是取整
limit = ~~((endTime*1000 - Date.now()) / 1000);
limit = ~~((endTime * 1000 - Date.now()) / 1000);
saleTime('.sale-floor-time', limit);
require('./maybe-like')();
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.search-btn').click(function() {
if (window._yas && window._yas.sendCustomInfo) {
... ...
... ... @@ -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();
// 滚动翻页
... ...
... ... @@ -109,7 +109,12 @@ function search() {
// 视频埋点
$('video').on('play', function() {
var _channel = cookie('_Channel');
var cid = _channel ? _channel : 'boys';
var cid = {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[(_channel ? _channel : 'boys')];
var pid = $('#productId').val();
window._yas.sendCustomInfo({
... ...
... ... @@ -14,21 +14,9 @@ var productId = $('#productId').val();
var skn = $('#productSkn').val(),
productCode = $('#limitProductCode').val();
var getChannel,
C_ID,
var C_ID = window._ChannelVary[window.cookie('_Channel')],
PRD_ID;
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
$('#likeBtn').on('touchstart', function() {
var opt,
favorite;
... ... @@ -36,7 +24,6 @@ $('#likeBtn').on('touchstart', function() {
var $this = $(this);
PRD_ID = productId;
C_ID = getChannel();
if ($this.hasClass('liked')) {
opt = 'cancel';
... ...
... ... @@ -17,20 +17,9 @@ var $recommendForYou = $('.recommend-for-you'),
var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
'_' + Math.floor(Math.random() * 1000000 + 1000000));
var getChannel, C_ID, uuidVal, goodid, goodIds = [], prdLoad;
var C_ID, goodid, goodIds = [], prdLoad;
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
C_ID = window._ChannelVary[window.cookie('_Channel')];
function yasRequest(PRD_ID, PRD_NUM, ACTION_ID) {
if (window._yas && window._yas.sendCustomInfo) {
... ...
... ... @@ -33,7 +33,7 @@ var now = new Date(),
month = now.getMonth() + 1,
date = now.getDate();
var getChannel, C_ID, argument;
var C_ID, argument;
require('../../common/footer');
... ... @@ -79,18 +79,7 @@ if ($('.swiper-container .swiper-slide').length > 1) {
});
}
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
C_ID = window._ChannelVary[window.cookie('_Channel')];
/**
* 筛选注册的回调,筛选子项点击后逻辑
... ... @@ -273,7 +262,7 @@ function search(opt) {
op: 'YB_NEW_GOODS_LIST_L',
param: JSON.stringify(Object.assign(yasparm, {
RES_QTY: $container.find('.total').data('id'),
PRD_LIST: goodIds
PRD_LIST: JSON.stringify(goodIds).replace(/\[|\]/g, '')
}))
}, true);
}
... ... @@ -301,7 +290,7 @@ function search(opt) {
op: 'YB_NEW_GOODS_LIST_L',
param: JSON.stringify(Object.assign(yasparm, {
RES_QTY: $container.find('.total').data('id'),
PRD_LIST: goodIds
PRD_LIST: JSON.stringify(goodIds).replace(/\[|\]/g, '')
}))
}, true);
}
... ...
... ... @@ -31,7 +31,7 @@ var historyval = writeSearch.getHistoryval();
var chHammer, cHammer;
var getChannel, C_ID, POS_ID, FLR_INDEX;
var C_ID, POS_ID, FLR_INDEX;
require('../../common');
... ... @@ -125,18 +125,7 @@ function inputAction() {
});
}
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
C_ID = window._ChannelVary[window.cookie('_Channel')];
// 热门搜索、最近搜索事件
$('.search-items .search-group').on('click', 'li', function(event) {
... ...
... ... @@ -84,7 +84,7 @@ var $listNav = $('#list-nav'),
introHammer,
brandColHammer;
var getChannel, C_ID, RES_QTY, argument, optype;
var C_ID, RES_QTY, argument, optype;
var category = $('#category-point').val();
... ... @@ -233,18 +233,7 @@ specialoffer = getQueryString('specialoffer');
specialsale_id = getQueryString('specialsale_id');
promotion = getQueryString('promotion');
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
C_ID = window._ChannelVary[window.cookie('_Channel')];
/**
* 筛选注册的回调,筛选子项点击后逻辑
... ... @@ -552,12 +541,14 @@ function search(opt) {
FILTER_VALUE: FILTER_VALUE
});
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: optype,
param: JSON.stringify(yasparm)
}, true);
}
setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: optype,
param: JSON.stringify(yasparm)
}, true);
}
}, 200);
} else {
num = $container.find('.good-info').length;
$container.append(data);
... ... @@ -585,12 +576,14 @@ function search(opt) {
FILTER_VALUE: FILTER_VALUE
});
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: optype,
param: JSON.stringify(yasparm)
}, true);
}
setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: optype,
param: JSON.stringify(yasparm)
}, true);
}
}, 200);
// lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
... ...
... ... @@ -277,17 +277,20 @@
.tip-wrap {
width: 100%;
height: 100%;
background: #9d1a15;
position: fixed;
top: 0;
left: 0;
z-index: 3;
img {
width: 100%;
height: 100%;
}
}
.tip {
width: 100%;
height: 100%;
background: #9d1a15;
position: absolute;
top: 0;
left: 0;
... ...
... ... @@ -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;
... ...