- 在 `ReportJobStoreRequest` 中新增 `draw_id`、`draw_no` 和 `normalized_number` 参数的验证规则。 - 更新 `AdminReportJobService` 以支持动态生成输出路径后缀,确保导出文件名包含相关信息。 - 在 `AdminReportQueryService` 中新增多个报表类型的处理逻辑,包括 `draw_profit_summary` 和 `sold_out_number_report`。 - 添加相应的测试用例,确保新功能的正确性和稳定性。
58 lines
2.4 KiB
PHP
58 lines
2.4 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'],
|
|
'parameters.player_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
|
'parameters.play_code' => ['sometimes', 'nullable', 'string', 'max:32'],
|
|
'parameters.operator_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
|
'parameters.draw_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
|
'parameters.draw_no' => ['sometimes', 'nullable', 'string', 'max:64'],
|
|
'parameters.normalized_number' => ['sometimes', 'nullable', 'regex:/^[0-9]{4}$/'],
|
|
'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'],
|
|
'filter_json.draw_id' => ['sometimes', 'nullable', 'integer', 'min:1'],
|
|
'filter_json.draw_no' => ['sometimes', 'nullable', 'string', 'max:64'],
|
|
'filter_json.normalized_number' => ['sometimes', 'nullable', 'regex:/^[0-9]{4}$/'],
|
|
];
|
|
}
|
|
|
|
/** @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',
|
|
];
|
|
}
|
|
}
|