Authored by 郭成尧

performance-better

... ... @@ -168,7 +168,17 @@ const index = (req, res, next) => {
isShare = isWeixin || isqq || isWeibo ? true : false;
co(function* () {
let ret = yield tdk('article', id, req);
let [ret, detail, commentsTotal, praise, wxFooter] = yield Promise.all([
tdk('article', id, req),
req.ctx(DetailModel).packageData(id, isApp, isWeixin, channel, isShare),
req.ctx(DetailModel).commentsTotal({ article_id: id, udid: udid }),
req.ctx(DetailModel).getArticlePraiseAndFavor({
uid: uid,
id: id,
udid: udid
}),
req.ctx(aboutModel).about(req.yoho.isApp)
]);
if (ret[0]) {
req.tdk = {
... ... @@ -177,13 +187,7 @@ const index = (req, res, next) => {
description: ret[3]
};
}
let detail = yield req.ctx(DetailModel).packageData(id, isApp, isWeixin, channel, isShare);
let commentsTotal = yield req.ctx(DetailModel).commentsTotal({article_id: id, udid: udid});
let praise = yield req.ctx(DetailModel).getArticlePraiseAndFavor({
uid: uid,
id: id,
udid: udid
});
let data = {
guangDetail: true,
guang: {}
... ... @@ -275,9 +279,7 @@ const index = (req, res, next) => {
// 标识有微信分享
data.hasWxShare = true;
let resu = yield req.ctx(aboutModel).about(req.yoho.isApp);
data.guang.wxFooter = resu;
data.guang.wxFooter = wxFooter;
res.render('info/index', Object.assign({
page: 'info-index',
gender: gender,
... ...
... ... @@ -2,7 +2,6 @@
* @Author: Targaryen
* @Date: 2016-05-18 11:42:11
* @Last Modified by: Targaryen
* @Last Modified time: 2017-02-24 15:18:50
*/
'use strict';
... ... @@ -24,7 +23,7 @@ module.exports = (data) => {
limit: data.limit || '20',
shopId: data.shopId,
yh_channel: yhchannelMap[data.yhChannel]
}).then(result => {
}, {cache: true}).then(result => {
let goodsContainer = $.load(result)('#goods-container');
let goodThumb = goodsContainer.find('.good-thumb');
... ...