Showing
1 changed file
with
17 additions
and
8 deletions
@@ -12,7 +12,7 @@ const urlHelper = require('./url-helper'); | @@ -12,7 +12,7 @@ const urlHelper = require('./url-helper'); | ||
12 | const videoPlayerTpl = require('../helpers/video-player-tpl'); | 12 | const videoPlayerTpl = require('../helpers/video-player-tpl'); |
13 | 13 | ||
14 | const helpers = global.yoho.helpers; | 14 | const helpers = global.yoho.helpers; |
15 | - | 15 | +const redis = global.yoho.redis; |
16 | const URL_OPERATIONS_RESOURCE_GET = 'operations/api/v5/resource/get'; | 16 | const URL_OPERATIONS_RESOURCE_GET = 'operations/api/v5/resource/get'; |
17 | 17 | ||
18 | // guang banner code | 18 | // guang banner code |
@@ -835,14 +835,23 @@ module.exports = class extends global.yoho.BaseModel { | @@ -835,14 +835,23 @@ module.exports = class extends global.yoho.BaseModel { | ||
835 | article_id: aid | 835 | article_id: aid |
836 | }; | 836 | }; |
837 | 837 | ||
838 | - return this.get({ | ||
839 | - url: 'guang/service/v2/article/getArticleContent', | ||
840 | - data: data, | ||
841 | - param: { | ||
842 | - cache: true | ||
843 | - }, | ||
844 | - api: global.yoho.ServiceAPI | 838 | + return redis.all([ |
839 | + ['get', `global:yoho:guang:detail:${aid}`] | ||
840 | + ]).then(redisData => { | ||
841 | + redisData = JSON.parse(redisData[0] || '{}'); | ||
842 | + | ||
843 | + if (!redisData.data) { | ||
844 | + return this.get({ | ||
845 | + url: 'guang/service/v2/article/getArticleContent', | ||
846 | + data: data, | ||
847 | + param: { | ||
848 | + cache: true | ||
849 | + }, | ||
850 | + api: global.yoho.ServiceAPI | ||
851 | + }); | ||
852 | + } | ||
845 | 853 | ||
854 | + return redisData; | ||
846 | }).then(res => { // 内容内推荐的商品 | 855 | }).then(res => { // 内容内推荐的商品 |
847 | 856 | ||
848 | let gpromises = [], ggpromises = []; | 857 | let gpromises = [], ggpromises = []; |
-
Please register or login to post a comment