Authored by 郭成尧

fav-count

... ... @@ -389,17 +389,21 @@ const shop = {
let shopId = req.query.shop_id || 792; // test3
let channel = req.yoho.channel || 'boys';
let gender = req.query.gender;
let uid = req.user.uid || 0;
let udid = req.sessionID || 'yoho';
co(function* () {
let bannerData = yield redsShopModel.getBanner(shopId);
let shopData = yield redsShopModel.getIntro(shopId);
let favCountData = yield redsShopModel.favCount(shopId, uid, channel, udid);
let decoratorsData = yield redsShopModel.getShopsdecorator(shopId);
let categoryData = yield redsShopModel.getShopCategory(shopId, channel, gender);
let banner = _.get(bannerData, 'data.banner');
let shopInfo = redShopPrcs.shopIntro(_.get(shopData, 'data', {}));
let favCount = _.get(favCountData, 'data[0].approximateCount', '2.1w');
let decorators = redShopPrcs.floor(_.get(decoratorsData, 'data.modules', []));
let category = redShopPrcs.category(categoryData, shopId);
let category = redShopPrcs.category(_.get(categoryData, 'data', []), shopId);
res.render('newshop/shop-reds', {
pageHeader: headerModel.setNav({
... ... @@ -410,7 +414,7 @@ const shop = {
module: 'product',
page: 'reds-shop',
shopId,
banner, shopInfo, decorators, category
banner, shopInfo, favCount, decorators, category
});
})().catch(next);
},
... ...
... ... @@ -4,6 +4,7 @@
'use strict';
const api = global.yoho.API;
const singleAPI = global.yoho.SingleAPI;
/**
* 频道
... ... @@ -70,7 +71,19 @@ exports.getShopCategory = (shopId, channel, gender) => {
yh_channel: yhChannel[channel],
gender: gender || '1,3',
shop_id: shopId
}, {code: 200, cache: true}).then(result => {
return result && result.data;
});
};
/**
* 店铺收藏数量
*/
exports.favCount = (shopId, uid, channel, udid) => {
return singleAPI.get('favorite', {
method: 'app.favorite.queryFavoriteCountByShopIds',
favIds: shopId,
type: 'shop',
udid: udid,
uid: uid,
physical_channel: yhChannel[channel],
});
};
... ...
... ... @@ -160,7 +160,7 @@ router.get('/index/baseShopFav', newShop.baseShopFav);
router.get('/index/brandFav', newShop.brandFav);
router.get('/new/shop/hotlist', newShop.shopHotList);
router.get('/red_shop', newShop.redShop); // TODO,TODO,TODO,TODO
router.get('/red-shop', newShop.redShop);
// end- 店铺重构
... ...
... ... @@ -12,7 +12,7 @@
{{/if}}
<p class="store-name">{{shopInfo.shop_name}}</p>
<div class="fav-box clearfix">
<div class="favs pull-left">粉丝数: 534 </div>
<div class="favs pull-left">粉丝数: {{favCount}} </div>
<div class="not-collect pull-left" id="collect" data-bp-id="shop_branner_collect_1"></div>
</div>
</div>
... ...