Authored by 郭成尧

fav-coupon

... ... @@ -365,15 +365,7 @@ const favoriteBrand = (req, res, next) => {
let opt = req.query.opt || 'ok';
let type = req.query.type || 'product';
let appVersion = req.query.appVersion || false;
let refer = req.headers.origin;
if (req.headers.referer) {
let refererSplit = _.split(req.headers.referer, '?');
if (id) {
refer = refererSplit[0] + '?shop_id=' + id;
}
}
let refer = req.get('referer');
let url = helpers.urlFormat('/signin.html') + '?refer=' + refer;
... ... @@ -385,6 +377,7 @@ const favoriteBrand = (req, res, next) => {
}
url = `${refer}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"${refer}","param":{}},"requesturl":{"param":{"method":"app.favorite.add","id":"${id}","fav_id":"${id}","type":"shop"},"url":"${_.get(global, 'yoho.API.ApiUrl', '')}"},"priority":"Y"}}`; // eslint-disable-line
}
if (!id) {
... ... @@ -476,23 +469,7 @@ const userCoupon = (req, res, next) => {
return;
}).catch(next);
} else {
let refer = req.headers.origin;
if (req.headers.referer) {
let refererSplit = _.split(req.headers.referer, '?');
let shopIdSplit = _.split(refererSplit[1], '&');
let shopId = '';
_.forEach(shopIdSplit, value => {
if (_.startsWith(value, 'shop_id')) {
shopId = value;
return;
}
});
refer = refererSplit[0] + '?' + shopId;
}
let refer = req.get('referer');
if (req.yoho.isApp !== 'false') {
let toUrl = refer + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' +
... ...
... ... @@ -365,6 +365,16 @@ const _formShopData = (data, shopId, isApp) => {
title: '全部商品'
};
let moreUrl = helpers.urlFormat('', {
shop_id: shopId,
order: 's_n_d',
title: '人气单品'
}, 'search'); // 人气单品的链接
if (isApp) {
moreUrl = 'openby:yohobuy={"action":"go.list","params":{"shop_id":"'+ shopId +'","title":"人气单品"}}';
}
formatData = _.assign({
shopIntro: _.get(data, 'shopInfo.shop_intro', ''),
logoImg: _.get(data, 'shopInfo.shop_logo', ''),
... ... @@ -375,11 +385,7 @@ const _formShopData = (data, shopId, isApp) => {
url: helpers.urlFormat('', {
shop_id: shopId
}, 'search'), // 搜索链接
more_url: helpers.urlFormat('', {
shop_id: shopId,
order: 's_n_d',
title: '人气单品'
}, 'search') // 人气单品的链接
more_url: moreUrl
}, formatData);
if (single) { // 单品点
... ...