fix(route): Epic Games Store - item added bundles link (#9826)

* fix(route): Epic Games Store

* fix(route): Epic Games Store - item added bundles link
This commit is contained in:
KotaHv
2022-05-27 00:21:24 +08:00
committed by GitHub
parent a60663ee91
commit 597e00054c
+19 -12
View File
@@ -27,18 +27,25 @@ module.exports = async (ctx) => {
dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate) <= now &&
dayjs(item.promotions.promotionalOffers[0].promotionalOffers[0].endDate) > now
)
.map((item) => ({
title: item.title,
author: item.seller.name,
link: `${rootUrl}/${locale}/p/${
item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug
}`,
description: art(path.join(__dirname, 'templates/description.art'), {
description: item.description,
image: item.keyImages[0].url,
}),
pubDate: parseDate(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate),
}));
.map((item) => {
let link = `${rootUrl}/${locale}/p/`;
item.categories.forEach((category) => {
if (category.path === 'bundles') {
link = `${rootUrl}/${locale}/bundles/`;
}
});
link += item.catalogNs.mappings.length > 0 ? item.catalogNs.mappings[0].pageSlug : item.offerMappings.length > 0 ? item.offerMappings[0].pageSlug : item.productSlug ? item.productSlug : item.urlSlug;
return {
title: item.title,
author: item.seller.name,
link,
description: art(path.join(__dirname, 'templates/description.art'), {
description: item.description,
image: item.keyImages[0].url,
}),
pubDate: parseDate(item.promotions.promotionalOffers[0].promotionalOffers[0].startDate),
};
});
ctx.state.data = {
title: 'Epic Games Store - Free Games',