Authored by 姜枫

添加获取人气单品ajax接口

... ... @@ -11,6 +11,7 @@ const searchModel = require(`${mRoot}/search`);
const headerModel = require('../../../doraemon/models/header');
const _ = require('lodash');
const helpers = global.yoho.helpers;
const productProcess = require(`${utils}/product-process`);
const shop = {
index(req, res, next) {
... ... @@ -204,6 +205,8 @@ const shop = {
let result = listModel.formShopData(shopData, shopId, isApp);
result = _.assign(result, pageHeader);
console.log(result.hotListproductSkn);
res.render('newshop/shop-classics', {
module: 'product',
page: 'shop.classics',
... ... @@ -290,6 +293,22 @@ const shop = {
res.json(result2);
});
});
},
shopHotList(req, res, next) {
let skns = req.query.skns;
return listModel.searchProductBySkn(skns).then(hotList => {
hotList = productProcess.processProductList(hotList, {isApp: req.yoho.isApp});
_.forEach(hotList, (value, key) => {
hotList[key].tags = {};
hotList[key].is_soon_sold_out = false;
hotList[key].tags.is_hot = true;
});
res.render('newshop/shop-hotlist', {
hotList: hotList,
layout: false,
_noLazy: true
});
}).catch(next);
}
};
/**
... ...
... ... @@ -139,6 +139,8 @@ router.get('/index/getBrandCouponsList', list.getBrandCouponsList);
router.get('/new/brand', newShop.index);
router.get('/new/baseShopFav', newShop.baseShopFav);
router.get('/new/brandFav', newShop.brandFav);
router.get('/new/shop/hotlist', newShop.shopHotList);
// end- 店铺重构
// 店铺介绍
router.get('/index/intro', list.shopIntro);
... ...
... ... @@ -107,16 +107,14 @@
{{/ hotCategory}}
</div>
<div class="popularity-title">
<div class="popularity-title" data-skns="{{hotListproductSkn}}">
人气单品
<a class="more buriedpoint" href="{{more_url}}" data-bp-id="shop_popularity_{{more_url}}">
&#xe618;</a>
</div>
<div class="product-warp">
<div class="goods-container clearfix">
{{# hotList}}
{{> common/goods}}
{{/ hotList}}
</div>
</div>
</div>
... ...
{{# hotList}}
{{> common/goods}}
{{/ hotList}}
\ No newline at end of file
... ...
'use strict';
const fs = require('fs');
let devHost = '172.16.9.195';
let devHost = '127.0.0.1';
fs.readFile('.devhost', (err, buf)=> {
if (!err) {
... ...