mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-04-22 01:54:25 +08:00
重构初始化
This commit is contained in:
83
app/http/admin/validation/AdminUserValidator.php
Normal file
83
app/http/admin/validation/AdminUserValidator.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 管理员用户参数校验器。
|
||||
*/
|
||||
class AdminUserValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'username' => 'sometimes|string|alpha_dash|min:2|max:32',
|
||||
'password' => 'nullable|string|min:6|max:64',
|
||||
'real_name' => 'sometimes|string|min:2|max:50',
|
||||
'mobile' => 'nullable|string|max:20',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'is_super' => 'sometimes|integer|in:0,1',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '管理员ID',
|
||||
'keyword' => '关键词',
|
||||
'username' => '登录账号',
|
||||
'password' => '登录密码',
|
||||
'real_name' => '真实姓名',
|
||||
'mobile' => '手机号',
|
||||
'email' => '邮箱',
|
||||
'is_super' => '超级管理员',
|
||||
'status' => '状态',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'status', 'is_super', 'page', 'page_size'],
|
||||
'store' => ['username', 'password', 'real_name', 'mobile', 'email', 'is_super', 'status', 'remark'],
|
||||
'update' => ['id', 'username', 'password', 'real_name', 'mobile', 'email', 'is_super', 'status', 'remark'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function sceneStore(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'username' => 'required|string|alpha_dash|min:2|max:32',
|
||||
'password' => 'required|string|min:6|max:64',
|
||||
'real_name' => 'required|string|min:2|max:50',
|
||||
'is_super' => 'required|integer|in:0,1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneUpdate(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
'username' => 'required|string|alpha_dash|min:2|max:32',
|
||||
'real_name' => 'required|string|min:2|max:50',
|
||||
'is_super' => 'required|integer|in:0,1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneShow(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneDestroy(): static
|
||||
{
|
||||
return $this->sceneShow();
|
||||
}
|
||||
}
|
||||
27
app/http/admin/validation/AuthValidator.php
Normal file
27
app/http/admin/validation/AuthValidator.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 管理员登录参数校验器。
|
||||
*
|
||||
* 用于校验后台管理员登录入参。
|
||||
*/
|
||||
class AuthValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'username' => 'required|string|min:1|max:32',
|
||||
'password' => 'required|string|min:6|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'username' => '用户名',
|
||||
'password' => '密码',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'login' => ['username', 'password'],
|
||||
];
|
||||
}
|
||||
36
app/http/admin/validation/ChannelDailyStatValidator.php
Normal file
36
app/http/admin/validation/ChannelDailyStatValidator.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 通道日统计参数校验器。
|
||||
*/
|
||||
class ChannelDailyStatValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'required|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'channel_id' => 'sometimes|integer|min:1',
|
||||
'stat_date' => 'sometimes|date_format:Y-m-d',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '统计ID',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'channel_id' => '所属通道',
|
||||
'stat_date' => '统计日期',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'channel_id', 'stat_date', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
];
|
||||
}
|
||||
40
app/http/admin/validation/ChannelNotifyLogValidator.php
Normal file
40
app/http/admin/validation/ChannelNotifyLogValidator.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 渠道通知日志参数校验器。
|
||||
*/
|
||||
class ChannelNotifyLogValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'required|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'channel_id' => 'sometimes|integer|min:1',
|
||||
'notify_type' => 'sometimes|integer|in:0,1',
|
||||
'verify_status' => 'sometimes|integer|in:0,1,2',
|
||||
'process_status' => 'sometimes|integer|in:0,1,2',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '日志ID',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'channel_id' => '所属通道',
|
||||
'notify_type' => '通知类型',
|
||||
'verify_status' => '验签状态',
|
||||
'process_status' => '处理状态',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'channel_id', 'notify_type', 'verify_status', 'process_status', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
];
|
||||
}
|
||||
45
app/http/admin/validation/FileRecordValidator.php
Normal file
45
app/http/admin/validation/FileRecordValidator.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 文件参数校验器。
|
||||
*/
|
||||
class FileRecordValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'scene' => 'nullable|integer|in:1,2,3,4',
|
||||
'source_type' => 'nullable|integer|in:1,2',
|
||||
'visibility' => 'nullable|integer|in:1,2',
|
||||
'storage_engine' => 'nullable|integer|in:1,2,3,4',
|
||||
'remote_url' => 'nullable|string|max:2048|url',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '文件ID',
|
||||
'keyword' => '关键字',
|
||||
'scene' => '文件场景',
|
||||
'source_type' => '来源类型',
|
||||
'visibility' => '可见性',
|
||||
'storage_engine' => '存储引擎',
|
||||
'remote_url' => '远程地址',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'scene', 'source_type', 'visibility', 'storage_engine', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
'preview' => ['id'],
|
||||
'download' => ['id'],
|
||||
'store' => ['scene', 'visibility'],
|
||||
'importRemote' => ['remote_url', 'scene', 'visibility'],
|
||||
];
|
||||
}
|
||||
38
app/http/admin/validation/MerchantAccountLedgerValidator.php
Normal file
38
app/http/admin/validation/MerchantAccountLedgerValidator.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户账户流水参数校验器。
|
||||
*/
|
||||
class MerchantAccountLedgerValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'required|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'biz_type' => 'sometimes|integer|min:0',
|
||||
'event_type' => 'sometimes|integer|min:0',
|
||||
'direction' => 'sometimes|integer|in:0,1',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '流水ID',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'biz_type' => '业务类型',
|
||||
'event_type' => '事件类型',
|
||||
'direction' => '方向',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'biz_type', 'event_type', 'direction', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
];
|
||||
}
|
||||
32
app/http/admin/validation/MerchantAccountValidator.php
Normal file
32
app/http/admin/validation/MerchantAccountValidator.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户账户参数校验器。
|
||||
*/
|
||||
class MerchantAccountValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'required|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '账户ID',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
];
|
||||
}
|
||||
71
app/http/admin/validation/MerchantApiCredentialValidator.php
Normal file
71
app/http/admin/validation/MerchantApiCredentialValidator.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户接口凭证参数校验器。
|
||||
*/
|
||||
class MerchantApiCredentialValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1|exists:ma_merchant,id',
|
||||
'sign_type' => 'sometimes|integer|in:0',
|
||||
'api_key' => 'nullable|string|max:128',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '凭证ID',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'sign_type' => '签名类型',
|
||||
'api_key' => '接口凭证值',
|
||||
'status' => '状态',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'status', 'page', 'page_size'],
|
||||
'store' => ['merchant_id', 'sign_type', 'api_key', 'status'],
|
||||
'update' => ['id', 'sign_type', 'api_key', 'status'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function sceneStore(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'merchant_id' => 'required|integer|min:1|exists:ma_merchant,id',
|
||||
'sign_type' => 'required|integer|in:0',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneUpdate(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
'sign_type' => 'required|integer|in:0',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneShow(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneDestroy(): static
|
||||
{
|
||||
return $this->sceneShow();
|
||||
}
|
||||
}
|
||||
70
app/http/admin/validation/MerchantGroupValidator.php
Normal file
70
app/http/admin/validation/MerchantGroupValidator.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户分组参数校验器。
|
||||
*
|
||||
* 用于校验商户分组的查询和增删改参数。
|
||||
*/
|
||||
class MerchantGroupValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'group_name' => 'sometimes|string|min:2|max:128',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:255',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '分组ID',
|
||||
'keyword' => '关键字',
|
||||
'group_name' => '分组名称',
|
||||
'status' => '状态',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'group_name', 'status', 'page', 'page_size'],
|
||||
'store' => ['group_name', 'status', 'remark'],
|
||||
'update' => ['id', 'group_name', 'status', 'remark'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function sceneStore(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'group_name' => 'required|string|min:2|max:128',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneUpdate(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
'group_name' => 'required|string|min:2|max:128',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneShow(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneDestroy(): static
|
||||
{
|
||||
return $this->sceneShow();
|
||||
}
|
||||
}
|
||||
89
app/http/admin/validation/MerchantPolicyValidator.php
Normal file
89
app/http/admin/validation/MerchantPolicyValidator.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户策略校验器。
|
||||
*/
|
||||
class MerchantPolicyValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'merchant_id' => 'sometimes|integer|min:1|exists:ma_merchant,id',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'group_id' => 'sometimes|integer|min:1|exists:ma_merchant_group,id',
|
||||
'has_policy' => 'sometimes|integer|in:0,1',
|
||||
'settlement_cycle_override' => 'sometimes|integer|in:0,1,2,3,4',
|
||||
'auto_payout' => 'sometimes|integer|in:0,1',
|
||||
'min_settlement_amount' => 'sometimes|integer|min:0',
|
||||
'retry_policy_json' => 'sometimes|array',
|
||||
'route_policy_json' => 'sometimes|array',
|
||||
'fee_rule_override_json' => 'sometimes|array',
|
||||
'risk_policy_json' => 'sometimes|array',
|
||||
'remark' => 'sometimes|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '策略ID',
|
||||
'merchant_id' => '所属商户',
|
||||
'keyword' => '关键字',
|
||||
'group_id' => '商户分组',
|
||||
'has_policy' => '策略状态',
|
||||
'settlement_cycle_override' => '结算周期覆盖',
|
||||
'auto_payout' => '自动处理',
|
||||
'min_settlement_amount' => '最小结算金额',
|
||||
'retry_policy_json' => '重试策略',
|
||||
'route_policy_json' => '路由策略',
|
||||
'fee_rule_override_json' => '费率覆盖策略',
|
||||
'risk_policy_json' => '风控策略',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'group_id', 'has_policy', 'settlement_cycle_override', 'auto_payout', 'page', 'page_size'],
|
||||
'show' => ['merchant_id'],
|
||||
'store' => [
|
||||
'merchant_id',
|
||||
'settlement_cycle_override',
|
||||
'auto_payout',
|
||||
'min_settlement_amount',
|
||||
'retry_policy_json',
|
||||
'route_policy_json',
|
||||
'fee_rule_override_json',
|
||||
'risk_policy_json',
|
||||
'remark',
|
||||
],
|
||||
'update' => [
|
||||
'merchant_id',
|
||||
'settlement_cycle_override',
|
||||
'auto_payout',
|
||||
'min_settlement_amount',
|
||||
'retry_policy_json',
|
||||
'route_policy_json',
|
||||
'fee_rule_override_json',
|
||||
'risk_policy_json',
|
||||
'remark',
|
||||
],
|
||||
];
|
||||
|
||||
public function sceneStore(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'merchant_id' => 'required|integer|min:1|exists:ma_merchant,id',
|
||||
'settlement_cycle_override' => 'required|integer|in:0,1,2,3,4',
|
||||
'auto_payout' => 'required|integer|in:0,1',
|
||||
'min_settlement_amount' => 'required|integer|min:0',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneUpdate(): static
|
||||
{
|
||||
return $this->sceneStore();
|
||||
}
|
||||
}
|
||||
154
app/http/admin/validation/MerchantValidator.php
Normal file
154
app/http/admin/validation/MerchantValidator.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户列表参数校验器。
|
||||
*
|
||||
* 目前只用于列表查询,后续如需新增、编辑、详情校验,可以继续补充场景。
|
||||
*/
|
||||
class MerchantValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'group_id' => 'sometimes|integer|min:1',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'merchant_type' => 'sometimes|integer|in:0,1,2',
|
||||
'merchant_no' => 'sometimes|string|max:32',
|
||||
'merchant_name' => 'sometimes|string|max:100',
|
||||
'merchant_short_name' => 'sometimes|string|max:60',
|
||||
'password' => 'sometimes|string|min:6|max:32',
|
||||
'password_confirm' => 'sometimes|string|min:6|max:32|same:password',
|
||||
'risk_level' => 'sometimes|integer|in:0,1,2',
|
||||
'contact_name' => 'sometimes|string|max:50',
|
||||
'contact_phone' => 'sometimes|string|max:20',
|
||||
'contact_email' => 'sometimes|string|max:100',
|
||||
'settlement_account_name' => 'sometimes|string|max:100',
|
||||
'settlement_account_no' => 'sometimes|string|max:100',
|
||||
'settlement_bank_name' => 'sometimes|string|max:100',
|
||||
'settlement_bank_branch' => 'sometimes|string|max:100',
|
||||
'remark' => 'sometimes|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '商户ID',
|
||||
'keyword' => '关键字',
|
||||
'group_id' => '商户分组',
|
||||
'status' => '状态',
|
||||
'merchant_type' => '商户类型',
|
||||
'merchant_no' => '商户号',
|
||||
'merchant_name' => '商户名称',
|
||||
'merchant_short_name' => '商户简称',
|
||||
'password' => '登录密码',
|
||||
'password_confirm' => '确认密码',
|
||||
'risk_level' => '风控等级',
|
||||
'contact_name' => '联系人',
|
||||
'contact_phone' => '联系电话',
|
||||
'contact_email' => '联系邮箱',
|
||||
'settlement_account_name' => '结算账户名',
|
||||
'settlement_account_no' => '结算账号',
|
||||
'settlement_bank_name' => '开户行',
|
||||
'settlement_bank_branch' => '开户支行',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'group_id', 'status', 'merchant_type', 'risk_level', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
'overview' => ['id'],
|
||||
'store' => [
|
||||
'merchant_name',
|
||||
'merchant_short_name',
|
||||
'merchant_type',
|
||||
'group_id',
|
||||
'risk_level',
|
||||
'contact_name',
|
||||
'contact_phone',
|
||||
'contact_email',
|
||||
'settlement_account_name',
|
||||
'settlement_account_no',
|
||||
'settlement_bank_name',
|
||||
'settlement_bank_branch',
|
||||
'status',
|
||||
'remark',
|
||||
],
|
||||
'update' => [
|
||||
'id',
|
||||
'merchant_name',
|
||||
'merchant_short_name',
|
||||
'merchant_type',
|
||||
'group_id',
|
||||
'risk_level',
|
||||
'contact_name',
|
||||
'contact_phone',
|
||||
'contact_email',
|
||||
'settlement_account_name',
|
||||
'settlement_account_no',
|
||||
'settlement_bank_name',
|
||||
'settlement_bank_branch',
|
||||
'status',
|
||||
'remark',
|
||||
],
|
||||
'updateStatus' => ['id', 'status'],
|
||||
'resetPassword' => ['id', 'password', 'password_confirm'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function sceneStore(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'merchant_name' => 'required|string|max:100',
|
||||
'merchant_type' => 'required|integer|in:0,1,2',
|
||||
'group_id' => 'required|integer|min:1|exists:ma_merchant_group,id',
|
||||
'risk_level' => 'required|integer|in:0,1,2',
|
||||
'contact_name' => 'required|string|max:50',
|
||||
'contact_phone' => 'required|string|max:20',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneUpdate(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
'merchant_name' => 'required|string|max:100',
|
||||
'merchant_type' => 'required|integer|in:0,1,2',
|
||||
'group_id' => 'required|integer|min:1|exists:ma_merchant_group,id',
|
||||
'risk_level' => 'required|integer|in:0,1,2',
|
||||
'contact_name' => 'required|string|max:50',
|
||||
'contact_phone' => 'required|string|max:20',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneUpdateStatus(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneResetPassword(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
'password' => 'required|string|min:6|max:32',
|
||||
'password_confirm' => 'required|string|min:6|max:32|same:password',
|
||||
]);
|
||||
}
|
||||
|
||||
public function sceneDestroy(): static
|
||||
{
|
||||
return $this->appendRules([
|
||||
'id' => 'required|integer|min:1',
|
||||
]);
|
||||
}
|
||||
}
|
||||
40
app/http/admin/validation/PayCallbackLogValidator.php
Normal file
40
app/http/admin/validation/PayCallbackLogValidator.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付回调日志参数校验器。
|
||||
*/
|
||||
class PayCallbackLogValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'required|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'channel_id' => 'sometimes|integer|min:1',
|
||||
'callback_type' => 'sometimes|integer|in:0,1',
|
||||
'verify_status' => 'sometimes|integer|in:0,1,2',
|
||||
'process_status' => 'sometimes|integer|in:0,1,2',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '日志ID',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'channel_id' => '所属通道',
|
||||
'callback_type' => '回调类型',
|
||||
'verify_status' => '验签状态',
|
||||
'process_status' => '处理状态',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'channel_id', 'callback_type', 'verify_status', 'process_status', 'page', 'page_size'],
|
||||
'show' => ['id'],
|
||||
];
|
||||
}
|
||||
39
app/http/admin/validation/PayOrderValidator.php
Normal file
39
app/http/admin/validation/PayOrderValidator.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付订单列表参数校验器。
|
||||
*
|
||||
* 仅供管理后台使用。
|
||||
*/
|
||||
class PayOrderValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'pay_type_id' => 'sometimes|integer|min:1',
|
||||
'status' => 'sometimes|integer|in:0,1,2,3,4,5',
|
||||
'channel_mode' => 'sometimes|integer|in:0,1',
|
||||
'callback_status' => 'sometimes|integer|in:0,1,2',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'keyword' => '关键字',
|
||||
'merchant_id' => '商户ID',
|
||||
'pay_type_id' => '支付方式',
|
||||
'status' => '状态',
|
||||
'channel_mode' => '通道模式',
|
||||
'callback_status' => '回调状态',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'pay_type_id', 'status', 'channel_mode', 'callback_status', 'page', 'page_size'],
|
||||
];
|
||||
}
|
||||
103
app/http/admin/validation/PaymentChannelValidator.php
Normal file
103
app/http/admin/validation/PaymentChannelValidator.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付通道参数校验器。
|
||||
*
|
||||
* 用于校验支付通道的查询和增删改参数。
|
||||
*/
|
||||
class PaymentChannelValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:0',
|
||||
'name' => 'sometimes|string|min:2|max:128',
|
||||
'split_rate_bp' => 'sometimes|integer|min:0|max:10000',
|
||||
'cost_rate_bp' => 'sometimes|integer|min:0|max:10000',
|
||||
'channel_mode' => 'sometimes|integer|in:0,1',
|
||||
'pay_type_id' => 'sometimes|integer|min:1|exists:ma_payment_type,id',
|
||||
'plugin_code' => 'sometimes|string|min:1|max:64|exists:ma_payment_plugin,code',
|
||||
'api_config_id' => 'nullable|integer|min:1',
|
||||
'daily_limit_amount' => 'nullable|integer|min:0',
|
||||
'daily_limit_count' => 'nullable|integer|min:0',
|
||||
'min_amount' => 'nullable|integer|min:0',
|
||||
'max_amount' => 'nullable|integer|min:0',
|
||||
'remark' => 'nullable|string|max:255',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'sort_no' => 'nullable|integer|min:0',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '通道ID',
|
||||
'keyword' => '关键字',
|
||||
'merchant_id' => '所属商户',
|
||||
'name' => '通道名称',
|
||||
'split_rate_bp' => '分成比例',
|
||||
'cost_rate_bp' => '通道成本',
|
||||
'channel_mode' => '通道模式',
|
||||
'pay_type_id' => '支付方式',
|
||||
'plugin_code' => '支付插件',
|
||||
'api_config_id' => '配置ID',
|
||||
'daily_limit_amount' => '单日限额',
|
||||
'daily_limit_count' => '单日限笔',
|
||||
'min_amount' => '最小金额',
|
||||
'max_amount' => '最大金额',
|
||||
'remark' => '备注',
|
||||
'status' => '状态',
|
||||
'sort_no' => '排序',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'pay_type_id', 'plugin_code', 'channel_mode', 'status', 'page', 'page_size'],
|
||||
'store' => ['merchant_id', 'name', 'split_rate_bp', 'cost_rate_bp', 'channel_mode', 'pay_type_id', 'plugin_code', 'api_config_id', 'daily_limit_amount', 'daily_limit_count', 'min_amount', 'max_amount', 'remark', 'status', 'sort_no'],
|
||||
'update' => ['id', 'merchant_id', 'name', 'split_rate_bp', 'cost_rate_bp', 'channel_mode', 'pay_type_id', 'plugin_code', 'api_config_id', 'daily_limit_amount', 'daily_limit_count', 'min_amount', 'max_amount', 'remark', 'status', 'sort_no'],
|
||||
'updateStatus' => ['id', 'status'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
return match ($this->scene()) {
|
||||
'store' => array_merge($rules, [
|
||||
'merchant_id' => 'required|integer|min:0',
|
||||
'name' => 'required|string|min:2|max:128',
|
||||
'split_rate_bp' => 'required|integer|min:0|max:10000',
|
||||
'cost_rate_bp' => 'required|integer|min:0|max:10000',
|
||||
'channel_mode' => 'required|integer|in:0,1',
|
||||
'pay_type_id' => 'required|integer|min:1|exists:ma_payment_type,id',
|
||||
'plugin_code' => 'required|string|min:1|max:64|exists:ma_payment_plugin,code',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'update' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'merchant_id' => 'required|integer|min:0',
|
||||
'name' => 'required|string|min:2|max:128',
|
||||
'split_rate_bp' => 'required|integer|min:0|max:10000',
|
||||
'cost_rate_bp' => 'required|integer|min:0|max:10000',
|
||||
'channel_mode' => 'required|integer|in:0,1',
|
||||
'pay_type_id' => 'required|integer|min:1|exists:ma_payment_type,id',
|
||||
'plugin_code' => 'required|string|min:1|max:64|exists:ma_payment_plugin,code',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'updateStatus' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'show', 'destroy' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
]),
|
||||
default => $rules,
|
||||
};
|
||||
}
|
||||
}
|
||||
68
app/http/admin/validation/PaymentPluginConfValidator.php
Normal file
68
app/http/admin/validation/PaymentPluginConfValidator.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付插件配置参数校验器。
|
||||
*
|
||||
* 用于校验插件配置列表、详情和增删改参数。
|
||||
*/
|
||||
class PaymentPluginConfValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'plugin_code' => 'sometimes|string|alpha_dash|min:2|max:32',
|
||||
'config' => 'nullable|array',
|
||||
'settlement_cycle_type' => 'sometimes|integer|in:0,1,2,3,4',
|
||||
'settlement_cutoff_time' => 'nullable|date_format:H:i:s',
|
||||
'remark' => 'nullable|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
'ids' => 'sometimes|array',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '配置ID',
|
||||
'keyword' => '关键字',
|
||||
'plugin_code' => '插件编码',
|
||||
'config' => '插件配置',
|
||||
'settlement_cycle_type' => '结算周期',
|
||||
'settlement_cutoff_time' => '结算截止时间',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
'ids' => '配置ID集合',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'plugin_code', 'page', 'page_size'],
|
||||
'store' => ['plugin_code', 'config', 'settlement_cycle_type', 'settlement_cutoff_time', 'remark'],
|
||||
'update' => ['id', 'plugin_code', 'config', 'settlement_cycle_type', 'settlement_cutoff_time', 'remark'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
'options' => ['plugin_code'],
|
||||
'selectOptions' => ['keyword', 'plugin_code', 'page', 'page_size', 'ids'],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
return match ($this->scene()) {
|
||||
'store' => array_merge($rules, [
|
||||
'plugin_code' => 'required|string|alpha_dash|min:2|max:32',
|
||||
]),
|
||||
'update' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'plugin_code' => 'required|string|alpha_dash|min:2|max:32',
|
||||
]),
|
||||
'show', 'destroy' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
]),
|
||||
default => $rules,
|
||||
};
|
||||
}
|
||||
}
|
||||
45
app/http/admin/validation/PaymentPluginValidator.php
Normal file
45
app/http/admin/validation/PaymentPluginValidator.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付插件参数校验器。
|
||||
*
|
||||
* 用于校验支付插件的查询、详情和状态备注更新参数。
|
||||
*/
|
||||
class PaymentPluginValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'code' => 'sometimes|string|alpha_dash|min:2|max:32',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:500',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'name' => 'sometimes|string|max:50',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
'pay_type_code' => 'sometimes|string|max:32',
|
||||
'ids' => 'sometimes|array',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'code' => '插件编码',
|
||||
'name' => '插件名称',
|
||||
'status' => '状态',
|
||||
'remark' => '备注',
|
||||
'keyword' => '关键字',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
'pay_type_code' => '支付方式编码',
|
||||
'ids' => '插件编码集合',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'code', 'name', 'status', 'page', 'page_size'],
|
||||
'update' => ['code', 'status', 'remark'],
|
||||
'updateStatus' => ['code', 'status'],
|
||||
'show' => ['code'],
|
||||
'selectOptions' => ['keyword', 'page', 'page_size', 'pay_type_code', 'ids'],
|
||||
];
|
||||
}
|
||||
70
app/http/admin/validation/PaymentPollGroupBindValidator.php
Normal file
70
app/http/admin/validation/PaymentPollGroupBindValidator.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 商户分组路由绑定参数校验器。
|
||||
*
|
||||
* 用于校验商户分组在支付方式下绑定轮询组的参数。
|
||||
*/
|
||||
class PaymentPollGroupBindValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_group_id' => 'sometimes|integer|min:1|exists:ma_merchant_group,id',
|
||||
'pay_type_id' => 'sometimes|integer|min:1|exists:ma_payment_type,id',
|
||||
'poll_group_id' => 'sometimes|integer|min:1|exists:ma_payment_poll_group,id',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '绑定ID',
|
||||
'keyword' => '关键字',
|
||||
'merchant_group_id' => '商户分组',
|
||||
'pay_type_id' => '支付方式',
|
||||
'poll_group_id' => '轮询组',
|
||||
'status' => '状态',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_group_id', 'pay_type_id', 'poll_group_id', 'status', 'page', 'page_size'],
|
||||
'store' => ['merchant_group_id', 'pay_type_id', 'poll_group_id', 'status', 'remark'],
|
||||
'update' => ['id', 'merchant_group_id', 'pay_type_id', 'poll_group_id', 'status', 'remark'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
return match ($this->scene()) {
|
||||
'store' => array_merge($rules, [
|
||||
'merchant_group_id' => 'required|integer|min:1|exists:ma_merchant_group,id',
|
||||
'pay_type_id' => 'required|integer|min:1|exists:ma_payment_type,id',
|
||||
'poll_group_id' => 'required|integer|min:1|exists:ma_payment_poll_group,id',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'update' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'merchant_group_id' => 'required|integer|min:1|exists:ma_merchant_group,id',
|
||||
'pay_type_id' => 'required|integer|min:1|exists:ma_payment_type,id',
|
||||
'poll_group_id' => 'required|integer|min:1|exists:ma_payment_poll_group,id',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'show', 'destroy' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
]),
|
||||
default => $rules,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 轮询组通道编排参数校验器。
|
||||
*
|
||||
* 用于校验轮询组与通道关系的查询和增删改参数。
|
||||
*/
|
||||
class PaymentPollGroupChannelValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'poll_group_id' => 'sometimes|integer|min:1|exists:ma_payment_poll_group,id',
|
||||
'channel_id' => 'sometimes|integer|min:1|exists:ma_payment_channel,id',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'sort_no' => 'nullable|integer|min:0',
|
||||
'weight' => 'nullable|integer|min:1',
|
||||
'is_default' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '编排ID',
|
||||
'keyword' => '关键字',
|
||||
'poll_group_id' => '轮询组',
|
||||
'channel_id' => '支付通道',
|
||||
'status' => '状态',
|
||||
'sort_no' => '排序',
|
||||
'weight' => '权重',
|
||||
'is_default' => '默认通道',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'poll_group_id', 'channel_id', 'status', 'page', 'page_size'],
|
||||
'store' => ['poll_group_id', 'channel_id', 'sort_no', 'weight', 'is_default', 'status', 'remark'],
|
||||
'update' => ['id', 'poll_group_id', 'channel_id', 'sort_no', 'weight', 'is_default', 'status', 'remark'],
|
||||
'updateStatus' => ['id', 'status'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
return match ($this->scene()) {
|
||||
'store' => array_merge($rules, [
|
||||
'poll_group_id' => 'required|integer|min:1|exists:ma_payment_poll_group,id',
|
||||
'channel_id' => 'required|integer|min:1|exists:ma_payment_channel,id',
|
||||
'sort_no' => 'required|integer|min:0',
|
||||
'weight' => 'required|integer|min:1',
|
||||
'is_default' => 'required|integer|in:0,1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'update' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'poll_group_id' => 'required|integer|min:1|exists:ma_payment_poll_group,id',
|
||||
'channel_id' => 'required|integer|min:1|exists:ma_payment_channel,id',
|
||||
'sort_no' => 'required|integer|min:0',
|
||||
'weight' => 'required|integer|min:1',
|
||||
'is_default' => 'required|integer|in:0,1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'updateStatus' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'show', 'destroy' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
]),
|
||||
default => $rules,
|
||||
};
|
||||
}
|
||||
}
|
||||
75
app/http/admin/validation/PaymentPollGroupValidator.php
Normal file
75
app/http/admin/validation/PaymentPollGroupValidator.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付轮询组参数校验器。
|
||||
*
|
||||
* 用于校验轮询组的查询和增删改参数。
|
||||
*/
|
||||
class PaymentPollGroupValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'group_name' => 'sometimes|string|min:2|max:128',
|
||||
'pay_type_id' => 'sometimes|integer|min:1|exists:ma_payment_type,id',
|
||||
'route_mode' => 'sometimes|integer|in:0,1,2',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:255',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '轮询组ID',
|
||||
'keyword' => '关键字',
|
||||
'group_name' => '轮询组名称',
|
||||
'pay_type_id' => '支付方式',
|
||||
'route_mode' => '路由模式',
|
||||
'status' => '状态',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'group_name', 'pay_type_id', 'route_mode', 'status', 'page', 'page_size'],
|
||||
'store' => ['group_name', 'pay_type_id', 'route_mode', 'status', 'remark'],
|
||||
'update' => ['id', 'group_name', 'pay_type_id', 'route_mode', 'status', 'remark'],
|
||||
'updateStatus' => ['id', 'status'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
return match ($this->scene()) {
|
||||
'store' => array_merge($rules, [
|
||||
'group_name' => 'required|string|min:2|max:128',
|
||||
'pay_type_id' => 'required|integer|min:1|exists:ma_payment_type,id',
|
||||
'route_mode' => 'required|integer|in:0,1,2',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'update' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'group_name' => 'required|string|min:2|max:128',
|
||||
'pay_type_id' => 'required|integer|min:1|exists:ma_payment_type,id',
|
||||
'route_mode' => 'required|integer|in:0,1,2',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'updateStatus' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'show', 'destroy' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
]),
|
||||
default => $rules,
|
||||
};
|
||||
}
|
||||
}
|
||||
75
app/http/admin/validation/PaymentTypeValidator.php
Normal file
75
app/http/admin/validation/PaymentTypeValidator.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 支付方式参数校验器。
|
||||
*
|
||||
* 用于校验支付方式列表查询和增删改参数。
|
||||
*/
|
||||
class PaymentTypeValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'id' => 'sometimes|integer|min:1',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'code' => 'sometimes|string|alpha_dash|min:2|max:32',
|
||||
'name' => 'sometimes|string|min:2|max:50',
|
||||
'icon' => 'nullable|string|max:255',
|
||||
'sort_no' => 'nullable|integer|min:0',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
'remark' => 'nullable|string|max:500',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'id' => '支付方式ID',
|
||||
'keyword' => '关键字',
|
||||
'code' => '支付方式编码',
|
||||
'name' => '支付方式名称',
|
||||
'icon' => '图标',
|
||||
'sort_no' => '排序',
|
||||
'status' => '状态',
|
||||
'remark' => '备注',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'code', 'name', 'status', 'page', 'page_size'],
|
||||
'store' => ['code', 'name', 'icon', 'sort_no', 'status', 'remark'],
|
||||
'update' => ['id', 'code', 'name', 'icon', 'sort_no', 'status', 'remark'],
|
||||
'updateStatus' => ['id', 'status'],
|
||||
'show' => ['id'],
|
||||
'destroy' => ['id'],
|
||||
];
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = parent::rules();
|
||||
|
||||
return match ($this->scene()) {
|
||||
'store' => array_merge($rules, [
|
||||
'code' => 'required|string|alpha_dash|min:2|max:32',
|
||||
'name' => 'required|string|min:2|max:50',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'update' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'code' => 'required|string|alpha_dash|min:2|max:32',
|
||||
'name' => 'required|string|min:2|max:50',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'updateStatus' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
'status' => 'required|integer|in:0,1',
|
||||
]),
|
||||
'show', 'destroy' => array_merge($rules, [
|
||||
'id' => 'required|integer|min:1',
|
||||
]),
|
||||
default => $rules,
|
||||
};
|
||||
}
|
||||
}
|
||||
36
app/http/admin/validation/RefundActionValidator.php
Normal file
36
app/http/admin/validation/RefundActionValidator.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 退款操作参数校验器。
|
||||
*
|
||||
* 仅供管理后台的退款重试、处理等操作使用。
|
||||
*/
|
||||
class RefundActionValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'refund_no' => 'required|string|max:64',
|
||||
'processing_at' => 'sometimes|date_format:Y-m-d H:i:s',
|
||||
'failed_at' => 'sometimes|date_format:Y-m-d H:i:s',
|
||||
'last_error' => 'sometimes|string|max:512',
|
||||
'channel_refund_no' => 'sometimes|string|max:64',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'refund_no' => '退款单号',
|
||||
'processing_at' => '处理时间',
|
||||
'failed_at' => '失败时间',
|
||||
'last_error' => '错误信息',
|
||||
'channel_refund_no' => '渠道退款单号',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'retry' => ['refund_no', 'processing_at'],
|
||||
'mark_fail' => ['refund_no', 'failed_at', 'last_error'],
|
||||
'mark_processing' => ['refund_no', 'processing_at'],
|
||||
'mark_success' => ['refund_no', 'channel_refund_no'],
|
||||
];
|
||||
}
|
||||
37
app/http/admin/validation/RefundOrderValidator.php
Normal file
37
app/http/admin/validation/RefundOrderValidator.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 退款订单列表参数校验器。
|
||||
*
|
||||
* 仅供管理后台使用。
|
||||
*/
|
||||
class RefundOrderValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'pay_type_id' => 'sometimes|integer|min:1',
|
||||
'status' => 'sometimes|integer|in:0,1,2,3,4',
|
||||
'channel_mode' => 'sometimes|integer|in:0,1',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'keyword' => '关键字',
|
||||
'merchant_id' => '商户ID',
|
||||
'pay_type_id' => '支付方式',
|
||||
'status' => '退款状态',
|
||||
'channel_mode' => '通道模式',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'pay_type_id', 'status', 'channel_mode', 'page', 'page_size'],
|
||||
];
|
||||
}
|
||||
35
app/http/admin/validation/RouteResolveValidator.php
Normal file
35
app/http/admin/validation/RouteResolveValidator.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 路由解析参数校验器。
|
||||
*
|
||||
* 仅供管理后台预览路由使用。
|
||||
*/
|
||||
class RouteResolveValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'merchant_group_id' => 'required|integer|min:1',
|
||||
'pay_type_id' => 'required|integer|min:1',
|
||||
'pay_amount' => 'required|integer|min:1',
|
||||
'pay_type_code' => 'sometimes|string|max:32',
|
||||
'channel_mode' => 'sometimes|integer|in:0,1',
|
||||
'stat_date' => 'sometimes|date_format:Y-m-d',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'merchant_group_id' => '商户分组',
|
||||
'pay_type_id' => '支付方式',
|
||||
'pay_amount' => '支付金额',
|
||||
'pay_type_code' => '支付方式编码',
|
||||
'channel_mode' => '通道模式',
|
||||
'stat_date' => '统计日期',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'resolve' => ['merchant_group_id', 'pay_type_id', 'pay_amount', 'pay_type_code', 'channel_mode', 'stat_date'],
|
||||
];
|
||||
}
|
||||
38
app/http/admin/validation/SettlementOrderValidator.php
Normal file
38
app/http/admin/validation/SettlementOrderValidator.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
/**
|
||||
* 清算订单参数校验器。
|
||||
*/
|
||||
class SettlementOrderValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'settle_no' => 'required|string|max:32',
|
||||
'keyword' => 'sometimes|string|max:128',
|
||||
'merchant_id' => 'sometimes|integer|min:1',
|
||||
'channel_id' => 'sometimes|integer|min:1',
|
||||
'status' => 'sometimes|integer|min:0',
|
||||
'cycle_type' => 'sometimes|integer|min:0',
|
||||
'page' => 'sometimes|integer|min:1',
|
||||
'page_size' => 'sometimes|integer|min:1|max:100',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'settle_no' => '清算单号',
|
||||
'keyword' => '关键词',
|
||||
'merchant_id' => '所属商户',
|
||||
'channel_id' => '所属通道',
|
||||
'status' => '状态',
|
||||
'cycle_type' => '结算周期类型',
|
||||
'page' => '页码',
|
||||
'page_size' => '每页条数',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'index' => ['keyword', 'merchant_id', 'channel_id', 'status', 'cycle_type', 'page', 'page_size'],
|
||||
'show' => ['settle_no'],
|
||||
];
|
||||
}
|
||||
23
app/http/admin/validation/SystemConfigPageValidator.php
Normal file
23
app/http/admin/validation/SystemConfigPageValidator.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\validation;
|
||||
|
||||
use support\validation\Validator;
|
||||
|
||||
class SystemConfigPageValidator extends Validator
|
||||
{
|
||||
protected array $rules = [
|
||||
'group_code' => 'required|string|min:1|max:50|regex:/^[a-z0-9_]+$/',
|
||||
'values' => 'required|array',
|
||||
];
|
||||
|
||||
protected array $attributes = [
|
||||
'group_code' => '配置分组',
|
||||
'values' => '配置值',
|
||||
];
|
||||
|
||||
protected array $scenes = [
|
||||
'show' => ['group_code'],
|
||||
'store' => ['group_code', 'values'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user