...
|
...
|
@@ -54,6 +54,34 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return {pathNav: pathNav};
|
|
|
}
|
|
|
|
|
|
_formatArticle(rdata) {
|
|
|
let list = _.get(rdata, 'data.content', []);
|
|
|
let total = _.get(rdata, 'data.total', 0);
|
|
|
let lresult = {};
|
|
|
let width = 360;
|
|
|
let height = 240;
|
|
|
|
|
|
let result = _.map(list, (articleData) => {
|
|
|
articleData.image += '?imageView2/{mode}/w/{width}/h/{height}';
|
|
|
|
|
|
lresult = {
|
|
|
id: articleData.id,
|
|
|
classification: _.get(articleData, 'min_category_name', '') || _.get(articleData, 'category_name', ''),
|
|
|
url: helpers.urlFormat(`/news/${articleData.id}_${articleData.cid}.html`),
|
|
|
img: helpers.image(articleData.image, width, height, 1),
|
|
|
title: articleData.title,
|
|
|
pTime: articleData.update_time,
|
|
|
pView: articleData.views_num,
|
|
|
content: articleData.summary,
|
|
|
isVideo: articleData.videoUrl ? true : false
|
|
|
};
|
|
|
|
|
|
return lresult;
|
|
|
});
|
|
|
|
|
|
return {msgs: result, total: total};
|
|
|
}
|
|
|
|
|
|
getIndexList(channel, param) {
|
|
|
let params = {
|
|
|
type: 'wechat',
|
...
|
...
|
@@ -68,6 +96,9 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return Promise.all(apiMethod).then(result => {
|
|
|
let responseData = {};
|
|
|
|
|
|
// 列表数据
|
|
|
Object.assign(responseData, this._formatArticle(result[1]));
|
|
|
|
|
|
// 导航pathNav
|
|
|
Object.assign(responseData, this.getPathNav(channel));
|
|
|
|
...
|
...
|
|