Authored by zhangxiaoru

shop

... ... @@ -9,12 +9,13 @@ const crypto = global.yoho.crypto;
const shopIndex = (req, res) => {
let isApp = req.query.app_version || req.query.appVersion || false;
let uid = req.user.uid || req.query.uid;
let contentCode = req.query.content_code || 'ec9eb72eae121fcd6c1b7d1de75caff1';
let parameter = {};
if (!isApp) {
parameter = {
pageHeader: headerModel.setNav({
navTitle: '店铺收藏'
navTitle: req.query.title || '店铺收藏'
})
};
} else {
... ... @@ -32,12 +33,12 @@ const shopIndex = (req, res) => {
}
}
shopModel.banner().then((result) => {
shopModel.banner(contentCode).then((result) => {
res.render('shop-collect/index', Object.assign({
module: 'activity',
page: 'shop-collect',
wechatShare: true,
title: '店铺收藏',
title: req.query.title || '店铺收藏',
width750: true,
shopCollect: {
bannerTop: result
... ... @@ -47,8 +48,9 @@ const shopIndex = (req, res) => {
};
const shopNav = (req, res, next) => {
let channelId = req.query.channel_id;
shopModel.shopNav().then((result) => {
shopModel.shopNav(channelId).then((result) => {
res.json(result);
}).catch(next);
};
... ... @@ -57,8 +59,9 @@ const shopNav = (req, res, next) => {
const shopList = (req, res, next) => {
let uid = _.trim(crypto.decrypt('', req.query.uid)) || req.user.uid;
let tabName = req.query.tabName;
let channelId = req.query.channel_id;
shopModel.shopList(uid, tabName).then((result) => {
shopModel.shopList(uid, tabName, channelId).then((result) => {
res.json(result);
}).catch(next);
};
... ...
... ... @@ -9,11 +9,12 @@ const _ = require('lodash');
const logger = global.yoho.logger;
const service = global.yoho.ServiceAPI;
const shopList = (uid, tabName) => {
const shopList = (uid, tabName, channelId) => {
return api.get('', {
method: 'app.shops.promote',
uid: uid,
tab_name: tabName
tab_name: tabName,
channel_id: channelId
}, {
code: 200
}).then((result) => {
... ... @@ -38,9 +39,10 @@ const shopList = (uid, tabName) => {
});
};
const shopNav = () => {
const shopNav = (channelId) => {
return api.get('', {
method: 'app.shops.promoteTabNameList'
method: 'app.shops.promoteTabNameList',
channel_id: channelId
}, {
cache: true,
code: 200
... ... @@ -55,9 +57,9 @@ const shopNav = () => {
});
};
const banner = () => {
const banner = (contentCode) => {
return service.get('operations/api/v5/resource/get', {
content_code: 'ec9eb72eae121fcd6c1b7d1de75caff1',
content_code: contentCode,
platform: 'iphone'
}, {
cache: true,
... ...
... ... @@ -117,12 +117,4 @@ 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('/coin/sendCoin', coin.sendCoin);
router.get('/shopCollect', shopCollect.shopIndex);// 店铺收藏
router.get('/shopList', shopCollect.shopList);// 店铺收藏列表
router.get('/shopNav', shopCollect.shopNav);// 店铺收藏导航
router.get('/shopfavStatus', shopCollect.shopFav);// 店铺收藏状态
router.get('/share', share.getShareContent);
module.exports = router;
... ...