Authored by 郝肖肖

'友情链接数据'

... ... @@ -16,9 +16,7 @@ const yohobuy = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
req.ctx(headerModel).requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('yohobuy', responseData);
res.render('yohobuy', Object.assign({}, responseData, result));
}).catch(next);
};
... ... @@ -29,9 +27,7 @@ const newpower = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
req.ctx(headerModel).requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('newpower', responseData);
res.render('newpower', Object.assign({}, responseData, result));
}).catch(next);
};
... ... @@ -42,9 +38,7 @@ const contact = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
req.ctx(headerModel).requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('contact', responseData);
res.render('contact', Object.assign({}, responseData, result));
}).catch(next);
};
... ... @@ -55,9 +49,7 @@ const privacy = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
req.ctx(headerModel).requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('privacy', responseData);
res.render('privacy', Object.assign({}, responseData, result));
}).catch(next);
};
... ... @@ -71,9 +63,7 @@ const link = (req, res, next) => {
req.ctx(headerModel).requestHeaderData(channel),
req.ctx(aboutModel).link(),
]).then(result => {
responseData.headerData = _.get(result, '[0].headerData');
res.render('link', Object.assign(_.get(result, '[1]', {}), responseData));
res.render('link', Object.assign(_.get(result, '[1]', {}), responseData, result[0]));
}).catch(next);
};
... ...
... ... @@ -42,7 +42,8 @@ function getCouponData(channel, params) {
const coupon = requestData[0];
result.headerData = requestData[1].headerData;
// 页面头部和底部友情链接
Object.assign(result, requestData[1]);
do { // eslint-disable-line
if (!coupon.data || !Array.isArray(coupon.data) || coupon.data.length === 0) {
... ...
... ... @@ -155,9 +155,9 @@ module.exports = {
zookeeperServer: '127.0.0.1:2181',
redis: {
connect: {
host: '127.0.0.1',
// host: '127.0.0.1',
// host: '192.168.102.49',
host: '192.168.102.49',
port: '6379',
enable_offline_queue: false,
retry_strategy(options) {
... ...
... ... @@ -15,6 +15,7 @@ const path = require('path');
const headerHtml = require('fs').readFileSync(path.resolve(__dirname, '../views/partial/headerNew.hbs')).toString();
const template = Handlebars.compile(headerHtml);
const logger = global.yoho.logger;
const redis = global.yoho.redis;
/**
* 获取菜单
... ... @@ -305,7 +306,14 @@ module.exports = class extends global.yoho.BaseModel {
_html = cacheData[0];
}
return Promise.resolve({headerData: _html});
let redisLinks = await redis.all([
['get', 'friend:footer:links']
])
let footerLinks = _.sortBy(JSON.parse(redisLinks[0] || '[]'), o => {
return -o.sort;
});
return Promise.resolve({headerData: _html, footerLinks});
}
getSubNavGroupData(type) {
... ...
... ... @@ -213,27 +213,20 @@
</div>
</div>
<div class="footer-link-container">
<div class="center-content clearfix">
<div class="link-info left">友情链接:</div>
<div class="link-section left">
<ul class="clearfix">
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">淘宝网</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">京东商城</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">国美在线</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">苏宁易购</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">蘑菇街</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">唯品会</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">淘宝网</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">京东商城</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">国美在线</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">苏宁易购</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">蘑菇街</a></li>
<li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">唯品会</a></li>
</ul>
{{#if footerLinks}}
<div class="footer-link-container">
<div class="center-content clearfix">
<div class="link-info left">友情链接:</div>
<div class="link-section left">
<ul class="clearfix">
{{# footerLinks}}
<li><a href="{{link}}" target="_blank" rel="nofollow">{{name}}</a></li>
{{/ footerLinks}}
</ul>
</div>
</div>
</div>
</div><!--/footer-link-container-->
</div><!--/footer-link-container-->
{{/if}}
</div>
<div class="right-floating-layer hide">
<div class="qrcode-hover-box">
... ...