mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-06-20 20:05:42 +02:00
[EpicGamesFree] Fixes: url not set, other promos shown (#4575)
* URI was not set because of the typo * Filter out other promos
This commit is contained in:
parent
976217111c
commit
b8064d9dfe
1 changed files with 9 additions and 4 deletions
|
@ -27,7 +27,7 @@ class EpicGamesFreeBridge extends BridgeAbstract
|
|||
'Türkçe' => 'tr',
|
||||
'简体中文' => 'zh-CN',
|
||||
'繁體中文' => 'zh-Hant',
|
||||
],
|
||||
],
|
||||
'title' => 'Language for game information',
|
||||
'defaultValue' => 'en-US',
|
||||
],
|
||||
|
@ -51,16 +51,21 @@ class EpicGamesFreeBridge extends BridgeAbstract
|
|||
|
||||
$data = $json['data']['Catalog']['searchStore']['elements'];
|
||||
foreach ($data as $element) {
|
||||
if (!isset($element['promotions']['promotionalOffers'][0])) {
|
||||
$promo = $element['promotions']['promotionalOffers'][0]['promotionalOffers'][0] ?? false;
|
||||
if (
|
||||
!$promo ||
|
||||
$promo['discountSetting']['discountType'] !== 'PERCENTAGE' ||
|
||||
$promo['discountSetting']['discountPercentage'] !== 0
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$item = [
|
||||
'author' => $element['seller']['name'],
|
||||
'content' => $element['description'],
|
||||
'enclosures' => array_map(fn($item) => $item['url'], $element['keyImages']),
|
||||
'timestamp' => strtotime($element['promotions']['promotionalOffers'][0]['promotionalOffers'][0]['startDate']),
|
||||
'timestamp' => strtotime($promo['startDate']),
|
||||
'title' => $element['title'],
|
||||
'url' => parent::getURI() . $this->getInput('locale') . '/p/' . $element['urlSlug'],
|
||||
'uri' => parent::getURI() . $this->getInput('locale') . '/p/' . $element['productSlug'],
|
||||
];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue