Skip to content

Commit

Permalink
fix(route): keep运动日记路由错误 (DIYgod#7257)
Browse files Browse the repository at this point in the history
Co-authored-by: hibert <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
  • Loading branch information
3 people authored May 25, 2021
1 parent 3f06caa commit 1b287aa
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions lib/routes/keep/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,30 @@ module.exports = async (ctx) => {
title: `${data[0].author.username} 的 Keep 动态`,
link: `https://show.gotokeep.com/users/${id}`,
language: 'zh-cn',
item: data.map((item) => {
let images = [];
if (item.images) {
images = item.meta.picture ? item.images.concat(item.meta.picture) : item.images;
} else if (item.meta.picture) {
images = [item.meta.picture];
}
let imagesTpl = '';
images.forEach((item) => {
imagesTpl += `<img src="${item}">`;
});
item: data
.filter((item) => 'title' in item.meta)
.map((item) => {
let images = [];
if (item.images) {
images = item.meta.picture ? item.images.concat(item.meta.picture) : item.images;
} else if (item.meta.picture) {
images = [item.meta.picture];
}
let imagesTpl = '';
images.forEach((item) => {
imagesTpl += `<img src="${item}">`;
});

const minute = Math.floor(item.meta.secondDuration / 60);
const second = item.meta.secondDuration - minute * 60;
return {
title: item.meta.title.trim(),
pubDate: item.created,
link: `https://show.gotokeep.com/entries/${item.id}`,
description: `项目:${item.meta.name === item.meta.workoutName ? item.meta.name : `${item.meta.name} - ${item.meta.workoutName}`}<br>时长:${minute}${second}${item.content ? `<br>备注:${item.content}` : ''}${
imagesTpl ? `<br>${imagesTpl}` : ''
}`,
};
}),
const minute = Math.floor(item.meta.secondDuration / 60);
const second = item.meta.secondDuration - minute * 60;
return {
title: item.meta.title.trim(),
pubDate: item.created,
link: `https://show.gotokeep.com/entries/${item.id}`,
description: `项目:${item.meta.name === item.meta.workoutName ? item.meta.name : `${item.meta.name} - ${item.meta.workoutName}`}<br>时长:${minute}${second}${item.content ? `<br>备注:${item.content}` : ''}${
imagesTpl ? `<br>${imagesTpl}` : ''
}`,
};
}),
};
};

0 comments on commit 1b287aa

Please sign in to comment.