feat: 添加货币格式化功能,更新多个控制器以支持金额和余额的格式化显示,增强 API 响应的可读性
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\JackpotPool;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Support\CurrencyFormatter;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
/**
|
||||
@@ -25,10 +26,13 @@ final class JackpotSummaryController extends Controller
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
$amountMinor = $pool !== null ? (int) $pool->current_amount : 0;
|
||||
|
||||
return ApiResponse::success([
|
||||
'currency_code' => $currency,
|
||||
'enabled' => $pool !== null,
|
||||
'current_amount_minor' => $pool !== null ? (int) $pool->current_amount : 0,
|
||||
'current_amount_minor' => $amountMinor,
|
||||
'current_amount_formatted' => CurrencyFormatter::fromMinor($amountMinor),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user