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,34 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
final class AdminCurrencyStoreRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'code' => ['required', 'string', 'max:16', 'regex:/^[A-Z0-9]{1,16}$/', Rule::unique('currencies', 'code')],
'name' => ['required', 'string', 'max:64'],
'decimal_places' => ['sometimes', 'integer', 'min:0', 'max:12'],
'is_enabled' => ['sometimes', 'boolean'],
'is_bettable' => ['sometimes', 'boolean'],
];
}
protected function prepareForValidation(): void
{
if ($this->has('code')) {
$this->merge([
'code' => strtoupper(substr(trim((string) $this->input('code')), 0, 16)),
]);
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
final class AdminCurrencyUpdateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => ['sometimes', 'string', 'max:64'],
'decimal_places' => ['sometimes', 'integer', 'min:0', 'max:12'],
'is_enabled' => ['sometimes', 'boolean'],
'is_bettable' => ['sometimes', 'boolean'],
];
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Http\Requests\Admin;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
/**
@@ -23,8 +24,18 @@ final class AdminPlayerStoreRequest extends FormRequest
'site_player_id' => ['required', 'string', 'max:128'],
'username' => ['nullable', 'string', 'max:128'],
'nickname' => ['nullable', 'string', 'max:128'],
'default_currency' => ['sometimes', 'string', 'max:16'],
'default_currency' => ['sometimes', 'string', 'max:16', Rule::exists('currencies', 'code')],
'status' => ['sometimes', 'integer', 'in:0,1,2'],
];
}
protected function prepareForValidation(): void
{
if (! $this->has('default_currency')) {
return;
}
$code = strtoupper(substr(trim((string) $this->input('default_currency')), 0, 16));
$this->merge(['default_currency' => $code]);
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
/**
* 玩家更新请求。
@@ -22,7 +22,18 @@ final class AdminPlayerUpdateRequest extends FormRequest
return [
'username' => ['sometimes', 'string', 'max:128'],
'nickname' => ['sometimes', 'nullable', 'string', 'max:128'],
'default_currency' => ['sometimes', 'string', 'max:16', Rule::exists('currencies', 'code')],
'status' => ['sometimes', 'integer', Rule::in([0, 1, 2])],
];
}
protected function prepareForValidation(): void
{
if (! $this->has('default_currency')) {
return;
}
$code = strtoupper(substr(trim((string) $this->input('default_currency')), 0, 16));
$this->merge(['default_currency' => $code]);
}
}

View File

@@ -1,56 +0,0 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
/**
* 报表任务创建请求。
*
* @see ReportJobStoreController
*/
final class ReportJobStoreRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, array<int, mixed>>
*/
public function rules(): array
{
return [
'report_type' => ['required', 'string', Rule::in(self::reportTypes())],
'export_format' => ['sometimes', 'string', Rule::in(['csv', 'xlsx'])],
'parameters' => ['sometimes', 'array'],
'parameters.date_from' => ['sometimes', 'nullable', 'date_format:Y-m-d'],
'parameters.date_to' => ['sometimes', 'nullable', 'date_format:Y-m-d', 'after_or_equal:parameters.date_from'],
'filter_json' => ['sometimes', 'array'],
'filter_json.date_from' => ['sometimes', 'nullable', 'date_format:Y-m-d'],
'filter_json.date_to' => ['sometimes', 'nullable', 'date_format:Y-m-d', 'after_or_equal:filter_json.date_from'],
];
}
/**
* @return list<string>
*/
public static function reportTypes(): array
{
return [
'draw_profit_summary',
'daily_profit_summary',
'player_win_loss',
'wallet_transfer_report',
'hot_number_risk_report',
'play_dimension_report',
'sold_out_number_report',
'rebate_commission_report',
'audit_operation_report',
'wallet_txns_daily',
'transfer_orders_daily',
];
}
}