Authored by 郭成尧

mg-master

... ... @@ -108,6 +108,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
let callArtGoodGroup = (ii, len2) => {
if (ii < len2) {
let goods = art.goodsGroup.data[ii];
if (goods) {
let good = {
thumb: goods.cover ? helpers.image(goods.cover.cover, 235, 314) : '',
... ... @@ -344,6 +345,7 @@ const index = (req, res, next) => {
// 分享参数
if (detail.getArticle.cover_image) {
let shareInfo = _shareInfo(id, detail.getArticle);
Object.assign(guang, shareInfo);
data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
data.title_more = true;
... ...
... ... @@ -18,6 +18,7 @@ const helpers = global.yoho.helpers;
const index = (req, res, next) => {
let gender = req.query.gender || '1,2,3',
items = [];
return rssModel.getRssArticle(gender).then((result) => {
if (!result) {
return next();
... ... @@ -30,10 +31,11 @@ const index = (req, res, next) => {
link: 'http://yohobuy.com',
copyright: '2015 yoho.inc',
generator: 'http://m.yohobuy.com',
updated: new Date(),
})
updated: new Date(),
});
_.forEach(result, item => {
item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://'+item.url
item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://' + item.url;
feed.addItem({
title: item.title,
link: `${item.url}&ref=rss`,
... ... @@ -41,26 +43,27 @@ const index = (req, res, next) => {
author: [{
name: (item.author && item.author.name) || ' '
}],
date: new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, "MM月DD日 HH:mm"))
date: new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, 'MM月DD日 HH:mm'))
});
});
if (req.params[0] && req.params[0] === '/atom') {
return res.send(feed.render('atom-1.0'));
}
return res.send(feed.render('rss-2.0'))
return res.send(feed.render('rss-2.0'));
});
};
const rss = (req, res, next, gmt) => {
let gender = req.query.gender || '1,2,3',
items = [];
res.setHeader('Content-Type', 'text/xml; charset=utf-8');
return rssModel.getRssArticle(gender).then((result) => {
if (!result) {
return next();
}
_.forEach(result, item => {
item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://'+item.url;
let time = new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, "MM月DD日 HH:mm"));
item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://' + item.url;
let time = new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, 'MM月DD日 HH:mm'));
let format = gmt ? 'ddd, MM MMM YYYY hh:mm:ss +0800' : 'YYYY-MM-DD hh:mm:ss +0800';
item.publishTime = moment(time).format(format);
... ... @@ -75,4 +78,4 @@ const rss = (req, res, next, gmt) => {
module.exports = {
index,
rss
};
\ No newline at end of file
};
... ...
... ... @@ -45,7 +45,7 @@ const getRssArticle = (gender) => {
if (typeof value.id !== 'undefined') {
build = guangProcess.formatArticle(value, false, false, true);
build.author = build.author || {};
build.author.name = (build.author && build.author.name) || ''
build.author.name = (build.author && build.author.name) || '';
return _genIntro(value.id).then((intro) => {
build.intro = intro;
result.push(build);
... ... @@ -56,6 +56,7 @@ const getRssArticle = (gender) => {
resolve(result);
}
};
return new Promise((resolve) => {
artListFunc(0, article.data.list.artList.length, resolve);
});
... ... @@ -96,4 +97,4 @@ const _genIntro = (id) => {
module.exports = {
getRssArticle
};
\ No newline at end of file
};
... ...
... ... @@ -15,6 +15,7 @@ const suggestData = (req, res, next) => {
let udid = req.sessionID || 'yoho';
let page = req.query.page || 1;
let limit = 10;
suggestModel.suggestData(uid, udid, page, limit).then((result) => {
res.render('suggest', {
... ...
... ... @@ -9,7 +9,7 @@ exports.getQr = (params) => {
try {
uid = crypto.decrypt(PASSWORD, decodeURIComponent(params.token));
uid = parseInt(uid, 10)
uid = parseInt(uid, 10);
} catch (e) {
uid = params.token;
}
... ...
... ... @@ -34,6 +34,7 @@ exports.cart = (req, res, next) => {
uid = req.user.uid || 0,
yhChannel = req.query.yh_channel || '1',
limit = 30;
if (_.get(req, 'app.locals.wap.cart.removePrefer', false)) {
return res.send('');
}
... ...
... ... @@ -422,6 +422,7 @@ const _cartCount = (uid, shoppingKey) => {
}).then((result) => {
if (result.code === 200) {
var count = result.data.cart_goods_count || 0;
if (count > 99) {
count = '99+';
}
... ...
... ... @@ -1512,6 +1512,7 @@ let getProductAsyncData = (data) => {
return Promise.all([_getPromotionInfo(result.product_skn), _getFavorite(result.product_id, data.uid)]).then((res) => {
result.promotionBoList = res[0];
var isFavorite = res[1];
finalResult = _detailDataPkgAsync(result, data.uid, data.vipLevel, data.ua);
finalResult.isCollect = isFavorite;
if (finalResult.cartInfo) {
... ... @@ -1777,6 +1778,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
// 限购商品有关的展示状态
let showStatus = 1;
origin.showStatus && (showStatus = parseInt(result.data.showStatus, 10));
// 处理限购商品有关的按钮状态
... ...
... ... @@ -36,10 +36,10 @@ module.exports = {
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
api: 'http://dev-api.yohops.com:9999/',
service: 'http://dev-service.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/'
api: 'http://dev-api.yohops.com:9999/',
service: 'http://dev-service.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -59,6 +59,7 @@ function getCouponStatus() {
cates.forEach(function(obj) {
var e = document.getElementById(obj.couponID);
if (!e) {
return;
}
... ...
... ... @@ -492,6 +492,7 @@ $('#float-layer-close').on('touchend', function() {
if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
var floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
var unionType = window.queryString.union_type || 367;
floatLayerBtnHammer.on('tap', function(e) {
window.downLoadApp(unionType);
... ...
... ... @@ -175,6 +175,7 @@ var page = {
}, 1000);
}
};
defaultTracking();
// 签到埋点
... ...
... ... @@ -339,7 +339,8 @@ $reaMask.on('touchend', function(event) {
event.stopPropagation();
});
$('.nav-tap').on('click', function(e){
$('.nav-tap').on('click', function(e) {
var $cur = $(e.target);
location.replace($cur.data('url'));
})
\ No newline at end of file
});
... ...
... ... @@ -35,7 +35,7 @@ $pwd.bind('input', function() {
});
$btnSure.toggleClass('disable', !bool);
})
});
qs = window.queryString;
... ... @@ -137,4 +137,4 @@ $('.agreement-detail').on('click', function() {
// 如果有值, 立刻校验
if ($pwd.val()) {
$pwd.triggerHandler('input');
}
\ No newline at end of file
}
... ...
... ... @@ -75,6 +75,7 @@ if (navtabHammer) {
if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
var link = $(gotoConsultEle).find('a').attr('href');
link += (link.indexOf('?') >= 0 ? '&' : '?') + 'from=' + encodeURIComponent(location.href);
location.href = link;
});
... ...
... ... @@ -32,11 +32,12 @@ $content.on('focus', function() {
$content.val('请输入咨询内容');
}
});
var getUrlParam = function (paramName) {
var reg = "[\\?|\\&]+" + paramName + "=([^&]*)[^&]?";
var exp = (window.location.href + "").match(reg);
return exp ? exp[1] : "";
}
var getUrlParam = function(paramName) {
var reg = '[\\?|\\&]+' + paramName + '=([^&]*)[^&]?';
var exp = (window.location.href + '').match(reg);
return exp ? exp[1] : '';
};
// 提交表单请求
$consultForm.on('submit', function() {
... ... @@ -74,6 +75,7 @@ $consultForm.on('submit', function() {
tip.show('提交成功~');
setTimeout(function() {
var from = getUrlParam('from');
if (from) {
window.location = decodeURIComponent(from);
} else {
... ...
... ... @@ -8,6 +8,7 @@ module.exports = function(callback) {
var productId = $('#productId').val();
var goodsId = $('#goodsId').val();
var productSkn = $('#productSkn').val();
if (productId && (goodsId || productSkn)) {
$.ajax({
type: 'POST',
... ... @@ -69,9 +70,11 @@ function render(data) {
$('.student-value').text(data.studentPrice);
} else if (data.vipLevel) {
var li = $('.vip-level>li').first().remove();
for (var i = 0; i < data.vipLevel.list.length; i++) {
var item = data.vipLevel.list[i];
var itemLi = li.clone();
if (item.currentLevel) {
itemLi.addClass('current-level');
}
... ... @@ -84,9 +87,11 @@ function render(data) {
var shortText = $('#goodsDiscount>.short-text').remove();
var liText = $('#goodsDiscount>.discount-folder>.folder-item').remove();
for (var i = 0; i < data.goodsDiscount.list.length; i++) {
var discount = data.goodsDiscount.list[i];
var itemText = i === 0 ? shortText.clone() : liText.clone();
if (discount.text) {
if (i === 0) {
itemText.text(discount.text).append('<span class="icon-down iconfont dropdown">&#xe609;</span>').prependTo('#goodsDiscount');
... ...
... ... @@ -48,7 +48,9 @@ function request() {
if (preferenceUrl) {
$.get(preferenceUrl).then(function(html) {
if (typeof html !== 'string') { return; }
if (typeof html !== 'string') {
return;
}
$recommendForYou.html(html.replace(/https?:/gi, '')).show();
lazyLoad($recommendForYou.find('img.lazy'));
... ...
... ... @@ -75,6 +75,7 @@ setTimeout(() => {
if (data.isDepositAdvance === 'Y') {
// 定金预售商品
var tip = require('../plugin/tip');
setTimeout(function() {
$('#addtoCart').text('立即购买').off('touchstart').on('touchstart', function() {
tip.show('定金预售商品只能在APP端购买');
... ...
... ... @@ -245,6 +245,7 @@ function search(opt, params, isScroll) {
/* TODO tar add 161125 sale dicount no yh_channel*/
var discount = $('#discount').val();
if (discount === 'discount') {
delete setting.yh_channel;
}
... ...
... ... @@ -409,6 +409,7 @@ function search(opt) {
} else {
if (nav.reload) {
var goodList = [];
$(data).each(function(i, goodInfo) {
if ($(goodInfo).hasClass('good-info')) {
goodList.push(goodInfo);
... ...
... ... @@ -90,7 +90,7 @@ module.exports = (list) => {
if (floor.sale1T1L4R && floor.data && floor.data.big_image) {
floor.data.banner_image = floor.data.big_image;
}
formatData.push(floor);
});
... ...