first commit

This commit is contained in:
CN-JS-HuiBai
2026-04-07 16:54:24 +08:00
commit 2c6a38c80d
399 changed files with 42205 additions and 0 deletions

View File

@@ -0,0 +1,146 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class ConfigSave extends FormRequest
{
const RULES = [
// invite & commission
'invite_force' => '',
'invite_commission' => 'integer|nullable',
'invite_gen_limit' => 'integer|nullable',
'invite_never_expire' => '',
'commission_first_time_enable' => '',
'commission_auto_check_enable' => '',
'commission_withdraw_limit' => 'nullable|numeric',
'commission_withdraw_method' => 'nullable|array',
'withdraw_close_enable' => '',
'commission_distribution_enable' => '',
'commission_distribution_l1' => 'nullable|numeric',
'commission_distribution_l2' => 'nullable|numeric',
'commission_distribution_l3' => 'nullable|numeric',
// site
'logo' => 'nullable|url',
'force_https' => '',
'stop_register' => '',
'app_name' => '',
'app_description' => '',
'app_url' => 'nullable|url',
'subscribe_url' => 'nullable',
'try_out_enable' => '',
'try_out_plan_id' => 'integer',
'try_out_hour' => 'numeric',
'tos_url' => 'nullable|url',
'currency' => '',
'currency_symbol' => '',
'ticket_must_wait_reply' => '',
// subscribe
'plan_change_enable' => '',
'reset_traffic_method' => 'in:0,1,2,3,4',
'surplus_enable' => '',
'new_order_event_id' => '',
'renew_order_event_id' => '',
'change_order_event_id' => '',
'show_info_to_server_enable' => '',
'show_protocol_to_server_enable' => '',
'subscribe_path' => '',
// server
'server_token' => 'nullable|min:16',
'server_pull_interval' => 'integer',
'server_push_interval' => 'integer',
'device_limit_mode' => 'integer',
'server_ws_enable' => 'boolean',
'server_ws_url' => 'nullable|url',
// frontend
'frontend_theme' => '',
'frontend_theme_sidebar' => 'nullable|in:dark,light',
'frontend_theme_header' => 'nullable|in:dark,light',
'frontend_theme_color' => 'nullable|in:default,darkblue,black,green',
'frontend_background_url' => 'nullable|url',
// email
'email_template' => '',
'email_host' => '',
'email_port' => '',
'email_username' => '',
'email_password' => '',
'email_encryption' => '',
'email_from_address' => '',
'remind_mail_enable' => '',
// telegram
'telegram_bot_enable' => '',
'telegram_bot_token' => '',
'telegram_webhook_url' => 'nullable|url',
'telegram_discuss_id' => '',
'telegram_channel_id' => '',
'telegram_discuss_link' => 'nullable|url',
// app
'windows_version' => '',
'windows_download_url' => '',
'macos_version' => '',
'macos_download_url' => '',
'android_version' => '',
'android_download_url' => '',
// safe
'email_whitelist_enable' => 'boolean',
'email_whitelist_suffix' => 'nullable|array',
'email_gmail_limit_enable' => 'boolean',
'captcha_enable' => 'boolean',
'captcha_type' => 'in:recaptcha,turnstile,recaptcha-v3',
'recaptcha_enable' => 'boolean',
'recaptcha_key' => '',
'recaptcha_site_key' => '',
'recaptcha_v3_secret_key' => '',
'recaptcha_v3_site_key' => '',
'recaptcha_v3_score_threshold' => 'numeric|min:0|max:1',
'turnstile_secret_key' => '',
'turnstile_site_key' => '',
'email_verify' => 'bool',
'safe_mode_enable' => 'boolean',
'register_limit_by_ip_enable' => 'boolean',
'register_limit_count' => 'integer',
'register_limit_expire' => 'integer',
'secure_path' => 'min:8|regex:/^[\w-]*$/',
'password_limit_enable' => 'boolean',
'password_limit_count' => 'integer',
'password_limit_expire' => 'integer',
'default_remind_expire' => 'boolean',
'default_remind_traffic' => 'boolean',
'subscribe_template_singbox' => 'nullable',
'subscribe_template_clash' => 'nullable',
'subscribe_template_clashmeta' => 'nullable',
'subscribe_template_stash' => 'nullable',
'subscribe_template_surge' => 'nullable',
'subscribe_template_surfboard' => 'nullable'
];
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return self::RULES;
}
public function messages()
{
// illiteracy prompt
return [
'app_url.url' => '站点URL格式不正确必须携带http(s)://',
'subscribe_url.url' => '订阅URL格式不正确必须携带http(s)://',
'server_token.min' => '通讯密钥长度必须大于16位',
'tos_url.url' => '服务条款URL格式不正确必须携带http(s)://',
'telegram_webhook_url.url' => 'Telegram Webhook地址格式不正确必须携带http(s)://',
'telegram_discuss_link.url' => 'Telegram群组地址必须为URL格式必须携带http(s)://',
'logo.url' => 'LOGO URL格式不正确必须携带https(s)://',
'secure_path.min' => '后台路径长度最小为8位',
'secure_path.regex' => '后台路径只能为字母或数字',
'captcha_type.in' => '人机验证类型只能选择 recaptcha、turnstile 或 recaptcha-v3',
'recaptcha_v3_score_threshold.numeric' => 'reCAPTCHA v3 分数阈值必须为数字',
'recaptcha_v3_score_threshold.min' => 'reCAPTCHA v3 分数阈值不能小于0',
'recaptcha_v3_score_threshold.max' => 'reCAPTCHA v3 分数阈值不能大于1'
];
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class CouponGenerate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'generate_count' => 'nullable|integer|max:500',
'name' => 'required',
'type' => 'required|in:1,2',
'value' => 'required|integer',
'started_at' => 'required|integer',
'ended_at' => 'required|integer',
'limit_use' => 'nullable|integer',
'limit_use_with_user' => 'nullable|integer',
'limit_plan_ids' => 'nullable|array',
'limit_period' => 'nullable|array',
'code' => ''
];
}
public function messages()
{
return [
'generate_count.integer' => '生成数量必须为数字',
'generate_count.max' => '生成数量最大为500个',
'name.required' => '名称不能为空',
'type.required' => '类型不能为空',
'type.in' => '类型格式有误',
'value.required' => '金额或比例不能为空',
'value.integer' => '金额或比例格式有误',
'started_at.required' => '开始时间不能为空',
'started_at.integer' => '开始时间格式有误',
'ended_at.required' => '结束时间不能为空',
'ended_at.integer' => '结束时间格式有误',
'limit_use.integer' => '最大使用次数格式有误',
'limit_use_with_user.integer' => '限制用户使用次数格式有误',
'limit_plan_ids.array' => '指定订阅格式有误',
'limit_period.array' => '指定周期格式有误'
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class KnowledgeCategorySave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'language' => 'required'
];
}
public function messages()
{
return [
'name.required' => '分类名称不能为空',
'language.required' => '分类语言不能为空'
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class KnowledgeCategorySort extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'knowledge_category_ids' => 'required|array'
];
}
public function messages()
{
return [
'knowledge_category_ids.required' => '分类不能为空',
'knowledge_category_ids.array' => '分类格式有误'
];
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class KnowledgeSave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'category' => 'required',
'language' => 'required',
'title' => 'required',
'body' => 'required',
'show' => 'nullable|boolean'
];
}
public function messages()
{
return [
'title.required' => '标题不能为空',
'category.required' => '分类不能为空',
'body.required' => '内容不能为空',
'language.required' => '语言不能为空',
'show.boolean' => '显示状态必须为布尔值'
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class KnowledgeSort extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'knowledge_ids' => 'required|array'
];
}
public function messages()
{
return [
'knowledge_ids.required' => '知识ID不能为空',
'knowledge_ids.array' => '知识ID格式有误'
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class MailSend extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'type' => 'required|in:1,2,3,4',
'subject' => 'required',
'content' => 'required',
'receiver' => 'array'
];
}
public function messages()
{
return [
'type.required' => '发送类型不能为空',
'type.in' => '发送类型格式有误',
'subject.required' => '主题不能为空',
'content.required' => '内容不能为空',
'receiver.array' => '收件人格式有误'
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class NoticeSave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'title' => 'required',
'content' => 'required',
'img_url' => 'nullable|url',
'tags' => 'nullable|array'
];
}
public function messages()
{
return [
'title.required' => '标题不能为空',
'content.required' => '内容不能为空',
'img_url.url' => '图片URL格式不正确',
'tags.array' => '标签格式不正确'
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class OrderAssign extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'plan_id' => 'required',
'email' => 'required',
'total_amount' => 'required',
'period' => 'required|in:month_price,quarter_price,half_year_price,year_price,two_year_price,three_year_price,onetime_price,reset_price'
];
}
public function messages()
{
return [
'plan_id.required' => '订阅不能为空',
'email.required' => '邮箱不能为空',
'total_amount.required' => '支付金额不能为空',
'period.required' => '订阅周期不能为空',
'period.in' => '订阅周期格式有误'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class OrderFetch extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'filter.*.key' => 'required|in:email,trade_no,status,commission_status,user_id,invite_user_id,callback_no,commission_balance',
'filter.*.condition' => 'required|in:>,<,=,>=,<=,模糊,!=',
'filter.*.value' => ''
];
}
public function messages()
{
return [
'filter.*.key.required' => '过滤键不能为空',
'filter.*.key.in' => '过滤键参数有误',
'filter.*.condition.required' => '过滤条件不能为空',
'filter.*.condition.in' => '过滤条件参数有误',
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class OrderUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'status' => 'in:0,1,2,3',
'commission_status' => 'in:0,1,3'
];
}
public function messages()
{
return [
'status.in' => '销售状态格式不正确',
'commission_status.in' => '佣金状态格式不正确'
];
}
}

View File

@@ -0,0 +1,157 @@
<?php
namespace App\Http\Requests\Admin;
use App\Models\Plan;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
class PlanSave extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'id' => 'nullable|integer',
'name' => 'required|string|max:255',
'content' => 'nullable|string',
'reset_traffic_method' => 'integer|nullable',
'transfer_enable' => 'integer|required|min:1',
'prices' => 'nullable|array',
'prices.*' => 'nullable|numeric|min:0',
'group_id' => 'integer|nullable',
'speed_limit' => 'integer|nullable|min:0',
'device_limit' => 'integer|nullable|min:0',
'capacity_limit' => 'integer|nullable|min:0',
'tags' => 'array|nullable',
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
$this->validatePrices($validator);
});
}
/**
* 验证价格配置
*/
protected function validatePrices(Validator $validator): void
{
$prices = $this->input('prices', []);
if (empty($prices)) {
return;
}
// 获取所有有效的周期
$validPeriods = array_keys(Plan::getAvailablePeriods());
foreach ($prices as $period => $price) {
// 验证周期是否有效
if (!in_array($period, $validPeriods)) {
$validator->errors()->add(
"prices.{$period}",
"不支持的订阅周期: {$period}"
);
continue;
}
// 价格可以为 null、空字符串或大于 0 的数字
if ($price !== null && $price !== '') {
// 转换为数字进行验证
$numericPrice = is_numeric($price) ? (float) $price : null;
if ($numericPrice === null) {
$validator->errors()->add(
"prices.{$period}",
"价格必须是数字格式"
);
} elseif ($numericPrice < 0) {
$validator->errors()->add(
"prices.{$period}",
"价格必须大于等于 0如不需要此周期请留空"
);
}
}
}
}
/**
* 处理验证后的数据
*/
protected function passedValidation(): void
{
// 清理和格式化价格数据
$prices = $this->input('prices', []);
$cleanedPrices = [];
foreach ($prices as $period => $price) {
// 只保留有效的正数价格
if ($price !== null && $price !== '' && is_numeric($price)) {
$numericPrice = (float) $price;
if ($numericPrice > 0) {
// 转换为浮点数并保留两位小数
$cleanedPrices[$period] = round($numericPrice, 2);
}
}
}
// 更新请求中的价格数据
$this->merge(['prices' => $cleanedPrices]);
}
/**
* Get custom error messages for validator errors.
*/
public function messages(): array
{
return [
'name.required' => '套餐名称不能为空',
'name.max' => '套餐名称不能超过 255 个字符',
'transfer_enable.required' => '流量配额不能为空',
'transfer_enable.integer' => '流量配额必须是整数',
'transfer_enable.min' => '流量配额必须大于 0',
'prices.array' => '价格配置格式错误',
'prices.*.numeric' => '价格必须是数字',
'prices.*.min' => '价格不能为负数',
'group_id.integer' => '权限组ID必须是整数',
'speed_limit.integer' => '速度限制必须是整数',
'speed_limit.min' => '速度限制不能为负数',
'device_limit.integer' => '设备限制必须是整数',
'device_limit.min' => '设备限制不能为负数',
'capacity_limit.integer' => '容量限制必须是整数',
'capacity_limit.min' => '容量限制不能为负数',
'tags.array' => '标签格式必须是数组',
];
}
/**
* Handle a failed validation attempt.
*/
protected function failedValidation(Validator $validator): void
{
throw new HttpResponseException(
response()->json([
'data' => false,
'message' => $validator->errors()->first(),
'errors' => $validator->errors()->toArray()
], 422)
);
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class PlanSort extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'plan_ids' => 'required|array'
];
}
public function messages()
{
return [
'plan_ids.required' => '订阅计划ID不能为空',
'plan_ids.array' => '订阅计划ID格式有误'
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class PlanUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'show' => 'in:0,1',
'renew' => 'in:0,1'
];
}
public function messages()
{
return [
'show.in' => '销售状态格式不正确',
'renew.in' => '续费状态格式不正确'
];
}
}

View File

@@ -0,0 +1,212 @@
<?php
namespace App\Http\Requests\Admin;
use App\Models\Server;
use Illuminate\Foundation\Http\FormRequest;
class ServerSave extends FormRequest
{
private const UTLS_RULES = [
'utls.enabled' => 'nullable|boolean',
'utls.fingerprint' => 'nullable|string',
];
private const MULTIPLEX_RULES = [
'multiplex.enabled' => 'nullable|boolean',
'multiplex.protocol' => 'nullable|string',
'multiplex.max_connections' => 'nullable|integer',
'multiplex.min_streams' => 'nullable|integer',
'multiplex.max_streams' => 'nullable|integer',
'multiplex.padding' => 'nullable|boolean',
'multiplex.brutal.enabled' => 'nullable|boolean',
'multiplex.brutal.up_mbps' => 'nullable|integer',
'multiplex.brutal.down_mbps' => 'nullable|integer',
];
private const PROTOCOL_RULES = [
'shadowsocks' => [
'cipher' => 'required|string',
'obfs' => 'nullable|string',
'obfs_settings.path' => 'nullable|string',
'obfs_settings.host' => 'nullable|string',
'plugin' => 'nullable|string',
'plugin_opts' => 'nullable|string',
],
'vmess' => [
'tls' => 'required|integer',
'network' => 'required|string',
'network_settings' => 'nullable|array',
'tls_settings.server_name' => 'nullable|string',
'tls_settings.allow_insecure' => 'nullable|boolean',
],
'trojan' => [
'tls' => 'nullable|integer',
'network' => 'required|string',
'network_settings' => 'nullable|array',
'server_name' => 'nullable|string',
'allow_insecure' => 'nullable|boolean',
'reality_settings.allow_insecure' => 'nullable|boolean',
'reality_settings.server_name' => 'nullable|string',
'reality_settings.server_port' => 'nullable|integer',
'reality_settings.public_key' => 'nullable|string',
'reality_settings.private_key' => 'nullable|string',
'reality_settings.short_id' => 'nullable|string',
],
'hysteria' => [
'version' => 'required|integer',
'alpn' => 'nullable|string',
'obfs.open' => 'nullable|boolean',
'obfs.type' => 'string|nullable',
'obfs.password' => 'string|nullable',
'tls.server_name' => 'nullable|string',
'tls.allow_insecure' => 'nullable|boolean',
'bandwidth.up' => 'nullable|integer',
'bandwidth.down' => 'nullable|integer',
'hop_interval' => 'integer|nullable',
],
'vless' => [
'tls' => 'required|integer',
'network' => 'required|string',
'network_settings' => 'nullable|array',
'flow' => 'nullable|string',
'encryption' => 'nullable|array',
'encryption.enabled' => 'nullable|boolean',
'encryption.encryption' => 'nullable|string',
'encryption.decryption' => 'nullable|string',
'tls_settings.server_name' => 'nullable|string',
'tls_settings.allow_insecure' => 'nullable|boolean',
'reality_settings.allow_insecure' => 'nullable|boolean',
'reality_settings.server_name' => 'nullable|string',
'reality_settings.server_port' => 'nullable|integer',
'reality_settings.public_key' => 'nullable|string',
'reality_settings.private_key' => 'nullable|string',
'reality_settings.short_id' => 'nullable|string',
],
'socks' => [
],
'naive' => [
'tls' => 'required|integer',
'tls_settings' => 'nullable|array',
],
'http' => [
'tls' => 'required|integer',
'tls_settings' => 'nullable|array',
],
'mieru' => [
'transport' => 'required|string|in:TCP,UDP',
'traffic_pattern' => 'string'
],
'anytls' => [
'tls' => 'nullable|array',
'alpn' => 'nullable|string',
'padding_scheme' => 'nullable|array',
],
];
private function getBaseRules(): array
{
return [
'type' => 'required|in:' . implode(',', Server::VALID_TYPES),
'spectific_key' => 'nullable|string',
'code' => 'nullable|string',
'show' => '',
'name' => 'required|string',
'group_ids' => 'nullable|array',
'route_ids' => 'nullable|array',
'parent_id' => 'nullable|integer',
'host' => 'required',
'port' => 'required',
'server_port' => 'required',
'tags' => 'nullable|array',
'excludes' => 'nullable|array',
'ips' => 'nullable|array',
'rate' => 'required|numeric',
'rate_time_enable' => 'nullable|boolean',
'rate_time_ranges' => 'nullable|array',
'custom_outbounds' => 'nullable|array',
'custom_routes' => 'nullable|array',
'cert_config' => 'nullable|array',
'rate_time_ranges.*.start' => 'required_with:rate_time_ranges|string|date_format:H:i',
'rate_time_ranges.*.end' => 'required_with:rate_time_ranges|string|date_format:H:i',
'rate_time_ranges.*.rate' => 'required_with:rate_time_ranges|numeric|min:0',
'protocol_settings' => 'array',
'transfer_enable' => 'nullable|integer|min:0',
];
}
public function rules(): array
{
$type = $this->input('type');
$rules = $this->getBaseRules();
$protocolRules = self::PROTOCOL_RULES[$type] ?? [];
if (in_array($type, ['vmess', 'vless', 'trojan', 'mieru'])) {
$protocolRules = array_merge($protocolRules, self::MULTIPLEX_RULES, self::UTLS_RULES);
}
foreach ($protocolRules as $field => $rule) {
$rules['protocol_settings.' . $field] = $rule;
}
return $rules;
}
public function attributes(): array
{
return [
'protocol_settings.cipher' => '加密方式',
'protocol_settings.obfs' => '混淆类型',
'protocol_settings.network' => '传输协议',
'protocol_settings.port_range' => '端口范围',
'protocol_settings.traffic_pattern' => 'Traffic Pattern',
'protocol_settings.transport' => '传输方式',
'protocol_settings.version' => '协议版本',
'protocol_settings.password' => '密码',
'protocol_settings.handshake.server' => '握手服务器',
'protocol_settings.handshake.server_port' => '握手端口',
'protocol_settings.multiplex.enabled' => '多路复用',
'protocol_settings.multiplex.protocol' => '复用协议',
'protocol_settings.multiplex.max_connections' => '最大连接数',
'protocol_settings.multiplex.min_streams' => '最小流数',
'protocol_settings.multiplex.max_streams' => '最大流数',
'protocol_settings.multiplex.padding' => '复用填充',
'protocol_settings.multiplex.brutal.enabled' => 'Brutal加速',
'protocol_settings.multiplex.brutal.up_mbps' => 'Brutal上行速率',
'protocol_settings.multiplex.brutal.down_mbps' => 'Brutal下行速率',
'protocol_settings.utls.enabled' => 'uTLS',
'protocol_settings.utls.fingerprint' => 'uTLS指纹',
];
}
public function messages()
{
return [
'name.required' => '节点名称不能为空',
'group_ids.required' => '权限组不能为空',
'group_ids.array' => '权限组格式不正确',
'route_ids.array' => '路由组格式不正确',
'parent_id.integer' => '父ID格式不正确',
'host.required' => '节点地址不能为空',
'port.required' => '连接端口不能为空',
'server_port.required' => '后端服务端口不能为空',
'tls.required' => 'TLS不能为空',
'tags.array' => '标签格式不正确',
'rate.required' => '倍率不能为空',
'rate.numeric' => '倍率格式不正确',
'network.required' => '传输协议不能为空',
'network.in' => '传输协议格式不正确',
'networkSettings.array' => '传输协议配置有误',
'ruleSettings.array' => '规则配置有误',
'tlsSettings.array' => 'tls配置有误',
'dnsSettings.array' => 'dns配置有误',
'protocol_settings.*.required' => ':attribute 不能为空',
'protocol_settings.*.string' => ':attribute 必须是字符串',
'protocol_settings.*.integer' => ':attribute 必须是整数',
'protocol_settings.*.in' => ':attribute 的值不合法',
'transfer_enable.integer' => '流量上限必须是整数',
'transfer_enable.min' => '流量上限不能小于0',
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class UserFetch extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'filter.*.key' => 'required|in:id,email,transfer_enable,d,expired_at,uuid,token,invite_by_email,invite_user_id,plan_id,banned,remarks,is_admin',
'filter.*.condition' => 'required|in:>,<,=,>=,<=,模糊,!=',
'filter.*.value' => 'required'
];
}
public function messages()
{
return [
'filter.*.key.required' => '过滤键不能为空',
'filter.*.key.in' => '过滤键参数有误',
'filter.*.condition.required' => '过滤条件不能为空',
'filter.*.condition.in' => '过滤条件参数有误',
'filter.*.value.required' => '过滤值不能为空'
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class UserGenerate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'generate_count' => 'nullable|integer|max:500',
'expired_at' => 'nullable|integer',
'plan_id' => 'nullable|integer',
'email_prefix' => 'nullable',
'email_suffix' => 'required',
'password' => 'nullable'
];
}
public function messages()
{
return [
'generate_count.integer' => '生成数量必须为数字',
'generate_count.max' => '生成数量最大为500个'
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class UserSendMail extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'subject' => 'required',
'content' => 'required',
];
}
public function messages()
{
return [
'subject.required' => '主题不能为空',
'content.required' => '发送内容不能为空'
];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class UserUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'id' => 'required|integer',
'email' => 'email:strict',
'password' => 'nullable|min:8',
'transfer_enable' => 'numeric',
'expired_at' => 'nullable|integer',
'banned' => 'bool',
'plan_id' => 'nullable|integer',
'commission_rate' => 'nullable|integer|min:0|max:100',
'discount' => 'nullable|integer|min:0|max:100',
'is_admin' => 'boolean',
'is_staff' => 'boolean',
'u' => 'integer',
'd' => 'integer',
'balance' => 'numeric',
'commission_type' => 'integer',
'commission_balance' => 'numeric',
'remarks' => 'nullable',
'speed_limit' => 'nullable|integer',
'device_limit' => 'nullable|integer'
];
}
public function messages()
{
return [
'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确',
'transfer_enable.numeric' => '流量格式不正确',
'expired_at.integer' => '到期时间格式不正确',
'banned.in' => '是否封禁格式不正确',
'is_admin.required' => '是否管理员不能为空',
'is_admin.in' => '是否管理员格式不正确',
'is_staff.required' => '是否员工不能为空',
'is_staff.in' => '是否员工格式不正确',
'plan_id.integer' => '订阅计划格式不正确',
'commission_rate.integer' => '推荐返利比例格式不正确',
'commission_rate.nullable' => '推荐返利比例格式不正确',
'commission_rate.min' => '推荐返利比例最小为0',
'commission_rate.max' => '推荐返利比例最大为100',
'discount.integer' => '专属折扣比例格式不正确',
'discount.nullable' => '专属折扣比例格式不正确',
'discount.min' => '专属折扣比例最小为0',
'discount.max' => '专属折扣比例最大为100',
'u.integer' => '上行流量格式不正确',
'd.integer' => '下行流量格式不正确',
'balance.integer' => '余额格式不正确',
'commission_balance.integer' => '佣金格式不正确',
'password.min' => '密码长度最小8位',
'speed_limit.integer' => '限速格式不正确',
'device_limit.integer' => '设备数量格式不正确'
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Passport;
use Illuminate\Foundation\Http\FormRequest;
class AuthForget extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email:strict',
'password' => 'required|min:8',
'email_code' => 'required'
];
}
public function messages()
{
return [
'email.required' => __('Email can not be empty'),
'email.email' => __('Email format is incorrect'),
'password.required' => __('Password can not be empty'),
'password.min' => __('Password must be greater than 8 digits'),
'email_code.required' => __('Email verification code cannot be empty')
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Passport;
use Illuminate\Foundation\Http\FormRequest;
class AuthLogin extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email:strict',
'password' => 'required|min:8'
];
}
public function messages()
{
return [
'email.required' => __('Email can not be empty'),
'email.email' => __('Email format is incorrect'),
'password.required' => __('Password can not be empty'),
'password.min' => __('Password must be greater than 8 digits')
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Passport;
use Illuminate\Foundation\Http\FormRequest;
class AuthRegister extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email:strict',
'password' => 'required|min:8'
];
}
public function messages()
{
return [
'email.required' => __('Email can not be empty'),
'email.email' => __('Email format is incorrect'),
'password.required' => __('Password can not be empty'),
'password.min' => __('Password must be greater than 8 digits')
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\Passport;
use Illuminate\Foundation\Http\FormRequest;
class CommSendEmailVerify extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email:strict'
];
}
public function messages()
{
return [
'email.required' => __('Email can not be empty'),
'email.email' => __('Email format is incorrect')
];
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Http\Requests\Staff;
use Illuminate\Foundation\Http\FormRequest;
class UserUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email:strict',
'password' => 'nullable',
'transfer_enable' => 'numeric',
'expired_at' => 'nullable|integer',
'banned' => 'required|in:0,1',
'plan_id' => 'nullable|integer',
'commission_rate' => 'nullable|integer|min:0|max:100',
'discount' => 'nullable|integer|min:0|max:100',
'u' => 'integer',
'd' => 'integer',
'balance' => 'integer',
'commission_balance' => 'integer'
];
}
public function messages()
{
return [
'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确',
'transfer_enable.numeric' => '流量格式不正确',
'expired_at.integer' => '到期时间格式不正确',
'banned.required' => '是否封禁不能为空',
'banned.in' => '是否封禁格式不正确',
'plan_id.integer' => '订阅计划格式不正确',
'commission_rate.integer' => '推荐返利比例格式不正确',
'commission_rate.nullable' => '推荐返利比例格式不正确',
'commission_rate.min' => '推荐返利比例最小为0',
'commission_rate.max' => '推荐返利比例最大为100',
'discount.integer' => '专属折扣比例格式不正确',
'discount.nullable' => '专属折扣比例格式不正确',
'discount.min' => '专属折扣比例最小为0',
'discount.max' => '专属折扣比例最大为100',
'u.integer' => '上行流量格式不正确',
'd.integer' => '下行流量格式不正确',
'balance.integer' => '余额格式不正确',
'commission_balance.integer' => '佣金格式不正确'
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class GiftCardCheckRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class GiftCardRedeemRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'code' => 'required|string|min:8|max:32',
];
}
/**
* Get custom messages for validator errors.
*
* @return array
*/
public function messages()
{
return [
'code.required' => '请输入兑换码',
'code.min' => '兑换码长度不能少于8位',
'code.max' => '兑换码长度不能超过32位',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class OrderSave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'plan_id' => 'required',
'period' => 'required|in:month_price,quarter_price,half_year_price,year_price,two_year_price,three_year_price,onetime_price,reset_price'
];
}
public function messages()
{
return [
'plan_id.required' => __('Plan ID cannot be empty'),
'period.required' => __('Plan period cannot be empty'),
'period.in' => __('Wrong plan period')
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class TicketSave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'subject' => 'required',
'level' => 'required|in:0,1,2',
'message' => 'required'
];
}
public function messages()
{
return [
'subject.required' => __('Ticket subject cannot be empty'),
'level.required' => __('Ticket level cannot be empty'),
'level.in' => __('Incorrect ticket level format'),
'message.required' => __('Message cannot be empty')
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class TicketWithdraw extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'withdraw_method' => 'required',
'withdraw_account' => 'required'
];
}
public function messages()
{
return [
'withdraw_method.required' => __('The withdrawal method cannot be empty'),
'withdraw_account.required' => __('The withdrawal account cannot be empty')
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UserChangePassword extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'old_password' => 'required',
'new_password' => 'required|min:8'
];
}
public function messages()
{
return [
'old_password.required' => __('Old password cannot be empty'),
'new_password.required' => __('New password cannot be empty'),
'new_password.min' => __('Password must be greater than 8 digits')
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UserTransfer extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'transfer_amount' => 'required|integer|min:1'
];
}
public function messages()
{
return [
'transfer_amount.required' => __('The transfer amount cannot be empty'),
'transfer_amount.integer' => __('The transfer amount parameter is wrong'),
'transfer_amount.min' => __('The transfer amount parameter is wrong')
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UserUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'remind_expire' => 'in:0,1',
'remind_traffic' => 'in:0,1'
];
}
public function messages()
{
return [
'show.in' => __('Incorrect format of expiration reminder'),
'renew.in' => __('Incorrect traffic alert format')
];
}
}