...
|
...
|
@@ -78,7 +78,7 @@ const _processIndexData = (list) => { |
|
|
_.forEach(data.ext.tags, (tags) => {
|
|
|
avatar.tags.push({
|
|
|
avatarUrl: `/guang/star/detail?tag=${tags.tagName}&openby:yohobuy={"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${tags.tagName}"}}}`, // eslint-disable-line
|
|
|
cover: tags.cover ? (tags.cover + '?imageView2/2/w/104/h/104') : tags.cover,
|
|
|
cover: tags.cover ? (tags.cover + '?imageView2/2/w/104/h/104/q/80') : tags.cover,
|
|
|
tagName: tags.tagName
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -103,7 +103,7 @@ const _processIndexData = (list) => { |
|
|
|
|
|
formatData.starAvatar.push({
|
|
|
url: url,
|
|
|
cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180') : data.cover
|
|
|
cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180/q/80') : data.cover
|
|
|
});
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -111,41 +111,24 @@ const _processIndexData = (list) => { |
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 明星专题列表数据处理
|
|
|
* 明星专题列表及星搭配数据处理
|
|
|
* @param {[array]} list
|
|
|
* @param {[boolean]} flag 明星专题列表需要转换下日期格式
|
|
|
* @return {[array]}
|
|
|
*/
|
|
|
const _processDetailData = (list) => {
|
|
|
const _processGuangData = (list, flag) => {
|
|
|
const formatData = [];
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
_.forEach(list, (data, key) => {
|
|
|
data.publishTime = helpers.dateFormat('MM月DD日 hh:mm', data.publishTime);
|
|
|
|
|
|
if (key < 4) {
|
|
|
data.islazy = true;
|
|
|
if (flag) {
|
|
|
data.publishTime = helpers.dateFormat('MM月DD日 hh:mm', data.publishTime);
|
|
|
}
|
|
|
|
|
|
formatData.push(data);
|
|
|
});
|
|
|
|
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 星搭配文章列表数据处理
|
|
|
*/
|
|
|
const _processCollocationData = (list) => {
|
|
|
const formatData = [];
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
_.forEach(list, (data, key) => {
|
|
|
if (data.isFavor === 'N') {
|
|
|
data.isCollected = false;
|
|
|
} else {
|
...
|
...
|
@@ -155,8 +138,10 @@ const _processCollocationData = (list) => { |
|
|
if (key < 4) {
|
|
|
data.islazy = true;
|
|
|
}
|
|
|
|
|
|
formatData.push(data);
|
|
|
});
|
|
|
|
|
|
return formatData;
|
|
|
};
|
|
|
|
...
|
...
|
@@ -181,19 +166,20 @@ const getIndexData = () => { |
|
|
/**
|
|
|
* 明星专题
|
|
|
*/
|
|
|
const getDetailData = (params) => {
|
|
|
const getDetailData = (params, uid) => {
|
|
|
return api.get('', sign.apiSign({
|
|
|
method: 'app.starClass.lastTagArticle',
|
|
|
tag: params.tag,
|
|
|
page: params.page || 1,
|
|
|
size: 10,
|
|
|
uid: uid,
|
|
|
client_type: 'iphone'
|
|
|
})).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
if (params.page > result.data.totalPage) {
|
|
|
return '';
|
|
|
} else {
|
|
|
return _processDetailData(result.data.list);
|
|
|
return _processGuangData(result.data.list, true);
|
|
|
}
|
|
|
} else {
|
|
|
logger.error('明星专题文章数据返回 code 不是 200');
|
...
|
...
|
@@ -236,7 +222,7 @@ const getCollocationListData = (params, uid) => { |
|
|
uid: uid
|
|
|
}, params))).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processCollocationData(result.data.list.artList);
|
|
|
return _processGuangData(result.data.list.artList);
|
|
|
} else {
|
|
|
logger.error('获取星搭配文章列表返回 code 不是 200');
|
|
|
return [];
|
...
|
...
|
@@ -252,18 +238,18 @@ const setFavorite = (params, uid) => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
return api.get('', sign.apiSign({
|
|
|
method: params.type === 'del' ? 'app.sns.cancelFavorBackCount' : 'app.sns.setFavorBackCount',
|
|
|
client_type: 'h5',
|
|
|
let url = params.type === 'del' ? '/guang/api/*/favorite/cancelFavorite' : '/guang/api/*/favorite/setFavorite';
|
|
|
|
|
|
return serviceAPI.get(url, sign.apiSign({
|
|
|
article_id: params.articleId,
|
|
|
uid: uid
|
|
|
}));
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
getIndexData: getIndexData,
|
|
|
getSpecialData: getSpecialData,
|
|
|
getCollocationListData: getCollocationListData,
|
|
|
setFavorite: setFavorite,
|
|
|
getDetailData: getDetailData
|
|
|
getIndexData,
|
|
|
getSpecialData,
|
|
|
getCollocationListData,
|
|
|
setFavorite,
|
|
|
getDetailData
|
|
|
}; |
...
|
...
|
|