57 lines
1.7 KiB
PHP
57 lines
1.7 KiB
PHP
<?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',
|
|
];
|
|
}
|
|
}
|