...
|
...
|
@@ -14,7 +14,7 @@ const helpers = global.yoho.helpers; |
|
|
/**
|
|
|
* 店铺 - 基础模板
|
|
|
*/
|
|
|
const _baseShop = (req, res, shopInfo) => {
|
|
|
const _baseShop = (req, res, shopInfo, shopId) => {
|
|
|
|
|
|
listModel.getBaseShopData(req.query, shopInfo).then(result => {
|
|
|
|
...
|
...
|
@@ -29,13 +29,31 @@ const _baseShop = (req, res, shopInfo) => { |
|
|
pageFooter: true,
|
|
|
title: shopInfo.shopName + '|' + shopInfo.shopName + '潮流服装服饰-Yoho!Buy有货',
|
|
|
keywords: shopInfo.shopName + ',' + shopInfo.shopName + '服装服饰,' + shopInfo.shopName + '潮流服装服饰',
|
|
|
description: shopInfo.shopName + '|Yoho!Buy有货' + shopInfo.shopName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。'
|
|
|
description: shopInfo.shopName + '|Yoho!Buy有货' + shopInfo.shopName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
|
|
|
shopId: shopId,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 基础模板收藏
|
|
|
*/
|
|
|
const baseShopFav = (req, res) => {
|
|
|
let isApp = req.query.app_version || req.query.appVersion || false;
|
|
|
let uid = isApp ? req.query.uid : req.user.uid;
|
|
|
let shopId = req.query.shopId;
|
|
|
|
|
|
listModel.getShopData(req, shopId, uid, isApp).then(result => {
|
|
|
res.json({
|
|
|
code: 200,
|
|
|
collect: result.goBrand && result.goBrand.isFavorite === 'Y' ? true : false,
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 店铺首页
|
|
|
* @return int
|
|
|
*/
|
...
|
...
|
@@ -44,6 +62,7 @@ const _shop = (req, res, shopId) => { |
|
|
let pageHeader = {};
|
|
|
let uid = 0;
|
|
|
|
|
|
// pagecache前端判断
|
|
|
if (!isApp) {
|
|
|
pageHeader = {
|
|
|
pageHeader: _.assign({
|
...
|
...
|
@@ -57,21 +76,23 @@ const _shop = (req, res, shopId) => { |
|
|
navTitle: false
|
|
|
}))
|
|
|
};
|
|
|
uid = req.user.uid;
|
|
|
} else {
|
|
|
uid = req.query.uid;
|
|
|
req.session.appUid = uid;
|
|
|
res.cookie('appUid', uid, {
|
|
|
domain: 'yohobuy.com',
|
|
|
expires: new Date(Date.now() + 2592000000) // 有效期一年
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// uid = req.user.uid;
|
|
|
// } else {
|
|
|
// uid = req.query.uid;
|
|
|
// req.session.appUid = uid;
|
|
|
// res.cookie('appUid', uid, {
|
|
|
// domain: 'yohobuy.com',
|
|
|
// expires: new Date(Date.now() + 2592000000) // 有效期一年
|
|
|
// });
|
|
|
// }
|
|
|
|
|
|
listModel.getShopData(req, shopId, uid, isApp).then(result => {
|
|
|
if (result.goBrand) {
|
|
|
|
|
|
/* 若店铺使用基础模板跳转基础模板 */
|
|
|
_baseShop(req, res, result.goBrand);
|
|
|
_baseShop(req, res, result.goBrand, shopId);
|
|
|
} else {
|
|
|
result = _.assign(result, pageHeader);
|
|
|
|
...
|
...
|
@@ -87,12 +108,46 @@ const _shop = (req, res, shopId) => { |
|
|
}),
|
|
|
title: result.storeName + '|' + result.storeName + '潮流服装服饰-Yoho!Buy有货',
|
|
|
keywords: result.storeName + ',' + result.storeName + '服装服饰,' + result.storeName + '潮流服装服饰',
|
|
|
description: result.storeName + '|Yoho!Buy有货' + result.storeName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。'
|
|
|
description: result.storeName + '|Yoho!Buy有货' + result.storeName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
|
|
|
shopId: shopId,
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* app设置cookie
|
|
|
*/
|
|
|
const shopAppCookie = (req, res) => {
|
|
|
let uid = req.query.uid;
|
|
|
|
|
|
req.session.appUid = uid;
|
|
|
res.cookie('appUid', uid, {
|
|
|
domain: 'yohobuy.com',
|
|
|
expires: new Date(Date.now() + 2592000000) // 有效期一年
|
|
|
});
|
|
|
res.json({
|
|
|
code: 200,
|
|
|
msg: 'app cookie set',
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 前端请求判断shop是否收藏
|
|
|
*/
|
|
|
const shopFav = (req, res) => {
|
|
|
let isApp = req.query.app_version || req.query.appVersion || false;
|
|
|
let uid = isApp ? req.query.uid : req.user.uid;
|
|
|
let shopId = req.query.shopId;
|
|
|
|
|
|
listModel.getShopData(req, shopId, uid, isApp).then(result => {
|
|
|
res.json({
|
|
|
code: 200,
|
|
|
collect: result.collect,
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 品类落地页
|
|
|
const category = (req, res) => {
|
|
|
let params = Object.assign({}, req.query);
|
...
|
...
|
@@ -188,13 +243,27 @@ const brand = (req, res, next) => { |
|
|
pageFooter: true,
|
|
|
title: title + '|' + title + '潮流服装服饰-Yoho!Buy有货',
|
|
|
keywords: title + ',' + title + '服装服饰,' + title + '潮流服装服饰',
|
|
|
description: title + '|Yoho!Buy有货' + title + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。'
|
|
|
description: title + '|Yoho!Buy有货' + title + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
|
|
|
domain: req.query.domain,
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
const brandFav = (req, res) => {
|
|
|
let domain = req.query.domain;
|
|
|
let uid = req.user.uid;
|
|
|
let brandId = 0;
|
|
|
|
|
|
listModel.getBrandLogoByDomain(domain).then((result) => {
|
|
|
brandId = result.id;
|
|
|
listModel.getBrandIntro(brandId, uid).then(result2 => {
|
|
|
res.json(result2);
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 店铺简介
|
|
|
* @param req
|
...
|
...
|
@@ -281,5 +350,11 @@ module.exports = { |
|
|
category,
|
|
|
brand,
|
|
|
favoriteBrand,
|
|
|
shopIntro
|
|
|
shopIntro,
|
|
|
|
|
|
// pagecache新增
|
|
|
brandFav,
|
|
|
shopAppCookie,
|
|
|
shopFav,
|
|
|
baseShopFav,
|
|
|
}; |
...
|
...
|
|