Showing
5 changed files
with
23 additions
and
31 deletions
@@ -16,9 +16,7 @@ const yohobuy = (req, res, next) => { | @@ -16,9 +16,7 @@ const yohobuy = (req, res, next) => { | ||
16 | let channel = req.yoho.channel || 'boys'; | 16 | let channel = req.yoho.channel || 'boys'; |
17 | 17 | ||
18 | req.ctx(headerModel).requestHeaderData(channel).then(result => { | 18 | req.ctx(headerModel).requestHeaderData(channel).then(result => { |
19 | - responseData.headerData = result.headerData; | ||
20 | - | ||
21 | - res.render('yohobuy', responseData); | 19 | + res.render('yohobuy', Object.assign({}, responseData, result)); |
22 | }).catch(next); | 20 | }).catch(next); |
23 | }; | 21 | }; |
24 | 22 | ||
@@ -29,9 +27,7 @@ const newpower = (req, res, next) => { | @@ -29,9 +27,7 @@ const newpower = (req, res, next) => { | ||
29 | let channel = req.yoho.channel || 'boys'; | 27 | let channel = req.yoho.channel || 'boys'; |
30 | 28 | ||
31 | req.ctx(headerModel).requestHeaderData(channel).then(result => { | 29 | req.ctx(headerModel).requestHeaderData(channel).then(result => { |
32 | - responseData.headerData = result.headerData; | ||
33 | - | ||
34 | - res.render('newpower', responseData); | 30 | + res.render('newpower', Object.assign({}, responseData, result)); |
35 | }).catch(next); | 31 | }).catch(next); |
36 | }; | 32 | }; |
37 | 33 | ||
@@ -42,9 +38,7 @@ const contact = (req, res, next) => { | @@ -42,9 +38,7 @@ const contact = (req, res, next) => { | ||
42 | let channel = req.yoho.channel || 'boys'; | 38 | let channel = req.yoho.channel || 'boys'; |
43 | 39 | ||
44 | req.ctx(headerModel).requestHeaderData(channel).then(result => { | 40 | req.ctx(headerModel).requestHeaderData(channel).then(result => { |
45 | - responseData.headerData = result.headerData; | ||
46 | - | ||
47 | - res.render('contact', responseData); | 41 | + res.render('contact', Object.assign({}, responseData, result)); |
48 | }).catch(next); | 42 | }).catch(next); |
49 | }; | 43 | }; |
50 | 44 | ||
@@ -55,9 +49,7 @@ const privacy = (req, res, next) => { | @@ -55,9 +49,7 @@ const privacy = (req, res, next) => { | ||
55 | let channel = req.yoho.channel || 'boys'; | 49 | let channel = req.yoho.channel || 'boys'; |
56 | 50 | ||
57 | req.ctx(headerModel).requestHeaderData(channel).then(result => { | 51 | req.ctx(headerModel).requestHeaderData(channel).then(result => { |
58 | - responseData.headerData = result.headerData; | ||
59 | - | ||
60 | - res.render('privacy', responseData); | 52 | + res.render('privacy', Object.assign({}, responseData, result)); |
61 | }).catch(next); | 53 | }).catch(next); |
62 | }; | 54 | }; |
63 | 55 | ||
@@ -71,9 +63,7 @@ const link = (req, res, next) => { | @@ -71,9 +63,7 @@ const link = (req, res, next) => { | ||
71 | req.ctx(headerModel).requestHeaderData(channel), | 63 | req.ctx(headerModel).requestHeaderData(channel), |
72 | req.ctx(aboutModel).link(), | 64 | req.ctx(aboutModel).link(), |
73 | ]).then(result => { | 65 | ]).then(result => { |
74 | - responseData.headerData = _.get(result, '[0].headerData'); | ||
75 | - | ||
76 | - res.render('link', Object.assign(_.get(result, '[1]', {}), responseData)); | 66 | + res.render('link', Object.assign(_.get(result, '[1]', {}), responseData, result[0])); |
77 | }).catch(next); | 67 | }).catch(next); |
78 | }; | 68 | }; |
79 | 69 |
@@ -42,7 +42,8 @@ function getCouponData(channel, params) { | @@ -42,7 +42,8 @@ function getCouponData(channel, params) { | ||
42 | 42 | ||
43 | const coupon = requestData[0]; | 43 | const coupon = requestData[0]; |
44 | 44 | ||
45 | - result.headerData = requestData[1].headerData; | 45 | + // 页面头部和底部友情链接 |
46 | + Object.assign(result, requestData[1]); | ||
46 | 47 | ||
47 | do { // eslint-disable-line | 48 | do { // eslint-disable-line |
48 | if (!coupon.data || !Array.isArray(coupon.data) || coupon.data.length === 0) { | 49 | if (!coupon.data || !Array.isArray(coupon.data) || coupon.data.length === 0) { |
@@ -155,9 +155,9 @@ module.exports = { | @@ -155,9 +155,9 @@ module.exports = { | ||
155 | zookeeperServer: '127.0.0.1:2181', | 155 | zookeeperServer: '127.0.0.1:2181', |
156 | redis: { | 156 | redis: { |
157 | connect: { | 157 | connect: { |
158 | - host: '127.0.0.1', | 158 | + // host: '127.0.0.1', |
159 | 159 | ||
160 | - // host: '192.168.102.49', | 160 | + host: '192.168.102.49', |
161 | port: '6379', | 161 | port: '6379', |
162 | enable_offline_queue: false, | 162 | enable_offline_queue: false, |
163 | retry_strategy(options) { | 163 | retry_strategy(options) { |
@@ -15,6 +15,7 @@ const path = require('path'); | @@ -15,6 +15,7 @@ const path = require('path'); | ||
15 | const headerHtml = require('fs').readFileSync(path.resolve(__dirname, '../views/partial/headerNew.hbs')).toString(); | 15 | const headerHtml = require('fs').readFileSync(path.resolve(__dirname, '../views/partial/headerNew.hbs')).toString(); |
16 | const template = Handlebars.compile(headerHtml); | 16 | const template = Handlebars.compile(headerHtml); |
17 | const logger = global.yoho.logger; | 17 | const logger = global.yoho.logger; |
18 | +const redis = global.yoho.redis; | ||
18 | 19 | ||
19 | /** | 20 | /** |
20 | * 获取菜单 | 21 | * 获取菜单 |
@@ -305,7 +306,14 @@ module.exports = class extends global.yoho.BaseModel { | @@ -305,7 +306,14 @@ module.exports = class extends global.yoho.BaseModel { | ||
305 | _html = cacheData[0]; | 306 | _html = cacheData[0]; |
306 | } | 307 | } |
307 | 308 | ||
308 | - return Promise.resolve({headerData: _html}); | 309 | + let redisLinks = await redis.all([ |
310 | + ['get', 'friend:footer:links'] | ||
311 | + ]) | ||
312 | + let footerLinks = _.sortBy(JSON.parse(redisLinks[0] || '[]'), o => { | ||
313 | + return -o.sort; | ||
314 | + }); | ||
315 | + | ||
316 | + return Promise.resolve({headerData: _html, footerLinks}); | ||
309 | } | 317 | } |
310 | 318 | ||
311 | getSubNavGroupData(type) { | 319 | getSubNavGroupData(type) { |
@@ -213,27 +213,20 @@ | @@ -213,27 +213,20 @@ | ||
213 | </div> | 213 | </div> |
214 | </div> | 214 | </div> |
215 | 215 | ||
216 | + {{#if footerLinks}} | ||
216 | <div class="footer-link-container"> | 217 | <div class="footer-link-container"> |
217 | <div class="center-content clearfix"> | 218 | <div class="center-content clearfix"> |
218 | <div class="link-info left">友情链接:</div> | 219 | <div class="link-info left">友情链接:</div> |
219 | <div class="link-section left"> | 220 | <div class="link-section left"> |
220 | <ul class="clearfix"> | 221 | <ul class="clearfix"> |
221 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">淘宝网</a></li> | ||
222 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">京东商城</a></li> | ||
223 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">国美在线</a></li> | ||
224 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">苏宁易购</a></li> | ||
225 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">蘑菇街</a></li> | ||
226 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">唯品会</a></li> | ||
227 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">淘宝网</a></li> | ||
228 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">京东商城</a></li> | ||
229 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">国美在线</a></li> | ||
230 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">苏宁易购</a></li> | ||
231 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">蘑菇街</a></li> | ||
232 | - <li><a href="//www.yohobuy.com/help/detail?id=228" target="_blank" rel="nofollow">唯品会</a></li> | 222 | + {{# footerLinks}} |
223 | + <li><a href="{{link}}" target="_blank" rel="nofollow">{{name}}</a></li> | ||
224 | + {{/ footerLinks}} | ||
233 | </ul> | 225 | </ul> |
234 | </div> | 226 | </div> |
235 | </div> | 227 | </div> |
236 | </div><!--/footer-link-container--> | 228 | </div><!--/footer-link-container--> |
229 | + {{/if}} | ||
237 | </div> | 230 | </div> |
238 | <div class="right-floating-layer hide"> | 231 | <div class="right-floating-layer hide"> |
239 | <div class="qrcode-hover-box"> | 232 | <div class="qrcode-hover-box"> |
-
Please register or login to post a comment