feat: switch crypto quotes to usd
This commit is contained in:
@@ -9,8 +9,8 @@ use think\facade\Log;
|
||||
|
||||
class CryptoMarketService
|
||||
{
|
||||
private const CACHE_KEY = 'crypto_market_snapshot';
|
||||
private const STALE_CACHE_KEY = 'crypto_market_snapshot_stale';
|
||||
private const CACHE_KEY = 'crypto_market_snapshot_usd';
|
||||
private const STALE_CACHE_KEY = 'crypto_market_snapshot_usd_stale';
|
||||
|
||||
public static function snapshot(): array
|
||||
{
|
||||
@@ -60,7 +60,7 @@ class CryptoMarketService
|
||||
), '/');
|
||||
$ids = array_column($coinConfig, 'id');
|
||||
$marketUrl = $apiBase . '/coins/markets?' . http_build_query([
|
||||
'vs_currency' => 'cny',
|
||||
'vs_currency' => 'usd',
|
||||
'ids' => implode(',', $ids),
|
||||
'order' => 'market_cap_desc',
|
||||
'per_page' => max(1, count($ids)),
|
||||
@@ -109,7 +109,7 @@ class CryptoMarketService
|
||||
'stale' => false,
|
||||
'overview' => [
|
||||
'btc_market_cap_percentage' => round((float) ($globalData['market_cap_percentage']['btc'] ?? 0), 1),
|
||||
'total_volume_cny' => (float) ($globalData['total_volume']['cny'] ?? 0),
|
||||
'total_volume_usd' => (float) ($globalData['total_volume']['usd'] ?? 0),
|
||||
],
|
||||
'coins' => $coins,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user