Authored by zhangxiaoru

资讯

... ... @@ -15,7 +15,7 @@ const _processIndexData = (list, type) => {
_.forEach(list, (data, index) => {
data.url = `//127.0.0.1:6003/editorial?type=${data.id}`;
if (index === parseInt(type)) {
if (index === parseInt(type, 0)) {
data.isActive = true;
} else {
data.isActive = false;
... ... @@ -24,12 +24,12 @@ const _processIndexData = (list, type) => {
formatData.push(data);
});
if (list.list) {
_.forEach(list, (data) => {
publishTime: helpers.dateFormat('MM/DD hh:mm', data.publishTime),
formatData.push(data);
});
}
// if (list.list) {
// _.forEach(list, (data) => {
// publishTime: helpers.dateFormat('MM/DD hh:mm', data.publishTime),
// formatData.push(data);
// });
// }
return formatData;
};
... ... @@ -45,19 +45,21 @@ const getIndexData = (type) => {
});
};
const getListData = () => {
return serviceAPI.get('guang/api/*/article/getList', {}).then((result) => {
if (result && result.code === 200) {
return _processIndexData(result.data);
} else {
logger.error('资讯列表数据返回 code 不是 200');
return {};
}
});
};
// const getListData = () => {
// return serviceAPI.get('guang/api/*/article/getList', {}).then((result) => {
// if (result && result.code === 200) {
// return _processIndexData(result.data);
// } else {
// logger.error('资讯列表数据返回 code 不是 200');
// return {};
// }
// });
// };
module.exports = {
getIndexData,
getListData
getIndexData
// getListData
};
... ...