added ons
This commit is contained in:
@@ -33,6 +33,10 @@ class PriceBroadcastService
|
||||
$lastPayload = $cache->get() ?? $cache->buildFromDatabase();
|
||||
}
|
||||
|
||||
if (is_array($lastPayload) && $lastPayload !== []) {
|
||||
$lastPayload = app(ZaarboxPriceService::class)->attachGoldOunceToPayload($lastPayload);
|
||||
}
|
||||
|
||||
if ($force) {
|
||||
if (is_array($lastPayload) && $lastPayload !== []) {
|
||||
$stream->publish('last', $lastPayload);
|
||||
@@ -63,6 +67,8 @@ class PriceBroadcastService
|
||||
*/
|
||||
public static function lastPriceIdentity(array $payload): array
|
||||
{
|
||||
$goldOunce = is_array($payload['gold_ounce'] ?? null) ? $payload['gold_ounce'] : null;
|
||||
|
||||
return [
|
||||
'sell' => (int) ($payload['sell'] ?? 0),
|
||||
'buy' => (int) ($payload['buy'] ?? 0),
|
||||
@@ -72,6 +78,7 @@ class PriceBroadcastService
|
||||
'main_product' => (int) ($payload['main_product'] ?? 0),
|
||||
'montzar' => (int) ($payload['montzar'] ?? 0),
|
||||
'zaarbox' => (int) ($payload['zaarbox'] ?? 0),
|
||||
'gold_ounce_price' => round((float) ($goldOunce['price'] ?? 0), 2),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -86,6 +93,8 @@ class PriceBroadcastService
|
||||
return;
|
||||
}
|
||||
|
||||
$lastPayload = app(ZaarboxPriceService::class)->attachGoldOunceToPayload($lastPayload);
|
||||
|
||||
if (! $this->rememberHashIfChanged(self::LAST_HASH_KEY, self::lastPriceIdentity($lastPayload))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user