...
|
...
|
@@ -10,6 +10,8 @@ const resourcesProcess = require(`${utils}/resources-process`); |
|
|
const ServiceAPI = require(`${library}/api`).ServiceAPI;
|
|
|
const sign = require(`${library}/sign`);
|
|
|
const logger = require(`${library}/logger`);
|
|
|
const camelCase = require(`${library}/camel-case`);
|
|
|
const _ = require('lodash');
|
|
|
const serviceAPI = new ServiceAPI();
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -36,6 +38,27 @@ const getResources = (page) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 星搭配文章列表数据处理
|
|
|
*/
|
|
|
const processCollocationData = (list) => {
|
|
|
const formatData = [];
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
_.forEach(list, (data) => {
|
|
|
if (data.isFavor === 'N') {
|
|
|
data.isCollected = false;
|
|
|
} else {
|
|
|
data.isCollected = true;
|
|
|
}
|
|
|
formatData.push(data);
|
|
|
});
|
|
|
|
|
|
return formatData;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 星潮首页
|
|
|
*/
|
|
|
exports.getIndexData = () => {
|
...
|
...
|
@@ -59,12 +82,10 @@ exports.getCollocationListData = (params, uid) => { |
|
|
uid: uid
|
|
|
}, params))).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result;
|
|
|
return processCollocationData(result.data.list.artList);
|
|
|
} else {
|
|
|
logger.error('获取星搭配文章列表返回 code 不是 200');
|
|
|
return [];
|
|
|
}
|
|
|
});
|
|
|
}; |
|
|
|
|
|
// guang/api/v5/article/getStarClassroomArticleList |
...
|
...
|
|