Update 'run.php'

This commit is contained in:
Illya Marchenko 2023-01-06 10:06:09 +02:00
parent c974b82d78
commit 5a40446a96

14
run.php

@ -58,7 +58,19 @@ foreach ($elements as $el) {
'promo_end_date' => $promotion['endDate'],
];
$game_url = "https://www.epicgames.com/store/en-US/p/{$el['productSlug']}";
// Get page slug
$page_slug = $el['productSlug'];
if (empty($page_slug)) {
foreach ($el['catalogNs']['mappings'] as $row) {
if (isset($row['pageSlug'])) {
$page_slug = $row['pageSlug'];
break;
}
}
}
// Build page url
$game_url = "https://www.epicgames.com/store/en-US/p/{$page_slug}";
// Send telegram notification
$tg_msg_arr = [];