| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Module\Transfer\Validations;
- use App\Module\Transfer\Validators\TransferOrderInValidator;
- use UCore\ValidationCore;
- /**
- * 转入验证类
- */
- class TransferInValidation extends ValidationCore
- {
- /** @var \App\Module\Transfer\Models\TransferApp|null 转账应用对象,由验证器设置 */
- public ?\App\Module\Transfer\Models\TransferApp $transfer_app = null;
- /**
- * 验证规则
- */
- public function rules($rules = []): array
- {
- return [
- // 基础验证
- [ 'transfer_app_id,out_order_id,user_id', 'required' ],
- [ 'transfer_app_id,user_id', 'integer', 'min' => 1 ],
- [ 'out_order_id', 'string', 'max' => 100 ],
- [ 'amount', 'required' ],
- [ 'amount', 'float', 'min' => 0.1, 'max' => 10000000 ], // 限制最大金额为1000万,防止异常大金额
- [ 'out_user_id', 'string', 'max' => 50 ],
- [ 'remark', 'string', 'max' => 255 ],
- [ 'callback_data', 'array' ],
- [
- 'out_order_id', new TransferOrderInValidator($this, []),
- 'msg' => '外部订单号重复'
- ]
- ];
- }
- /**
- * 默认值
- */
- public function default(): array
- {
- return [];
- }
- }
|