| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Module\Transfer\Validations;
- use UCore\ValidationCore;
- /**
- * 转出验证类
- */
- class TransferOutValidation extends ValidationCore
- {
- /** @var \App\Module\Transfer\Models\TransferApp|null 转账应用对象,由验证器设置 */
- public ?\App\Module\Transfer\Models\TransferApp $transfer_app = null;
- /** @var bool 是否跳过密码验证(用于第三方应用) */
- public bool $skip_password_validation = false;
- /**
- * 验证规则
- */
- public function rules($rules = []): array
- {
- return [
- // 基础验证
- ['transfer_app_id,user_id', 'required'],
- ['transfer_app_id,user_id', 'integer', 'min' => 1],
- ['amount', 'required'],
- ['amount', 'float', 'min' => 10, 'max' => 10000000], // 限制最大金额为1000万,防止异常大金额
- ['password', 'required', 'string', 'min' => 6],
- ['google_code', 'string', 'size' => 6],
- ['out_user_id', 'string', 'max' => 50],
- ['remark', 'string', 'max' => 255],
- ['callback_data', 'array'],
- ];
- }
- /**
- * 默认值
- */
- public function default(): array
- {
- return [];
- }
- }
|