feat: 增强环境配置与开发服务,支持局域网访问及币种管理

This commit is contained in:
2026-05-21 16:24:41 +08:00
parent 699d43fbd4
commit 7a6048de10
60 changed files with 1321 additions and 443 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Api\V1\Admin\Currency;
use App\Models\Currency;
use App\Support\ApiResponse;
use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
final class AdminCurrencyIndexController extends Controller
{
public function __invoke(): JsonResponse
{
$items = Currency::query()
->orderByDesc('is_enabled')
->orderByDesc('is_bettable')
->orderBy('code')
->get()
->map(fn (Currency $currency): array => $this->serializeCurrency($currency))
->all();
return ApiResponse::success(['items' => $items]);
}
/** @return array<string, mixed> */
private function serializeCurrency(Currency $currency): array
{
return [
'id' => (int) $currency->id,
'code' => $currency->code,
'name' => $currency->name,
'decimal_places' => (int) $currency->decimal_places,
'is_enabled' => (bool) $currency->is_enabled,
'is_bettable' => (bool) $currency->is_bettable,
'created_at' => $currency->created_at?->toIso8601String(),
'updated_at' => $currency->updated_at?->toIso8601String(),
];
}
}