TransferOutValidation.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Module\Transfer\Validations;
  3. use UCore\ValidationCore;
  4. /**
  5. * 转出验证类
  6. */
  7. class TransferOutValidation extends ValidationCore
  8. {
  9. /** @var \App\Module\Transfer\Models\TransferApp|null 转账应用对象,由验证器设置 */
  10. public ?\App\Module\Transfer\Models\TransferApp $transfer_app = null;
  11. /** @var bool 是否跳过密码验证(用于第三方应用) */
  12. public bool $skip_password_validation = false;
  13. /**
  14. * 验证规则
  15. */
  16. public function rules($rules = []): array
  17. {
  18. return [
  19. // 基础验证
  20. ['transfer_app_id,user_id', 'required'],
  21. ['transfer_app_id,user_id', 'integer', 'min' => 1],
  22. ['amount', 'required'],
  23. ['password', 'required', 'string', 'min' => 6],
  24. ['google_code', 'string', 'size' => 6],
  25. ['out_user_id', 'string', 'max' => 50],
  26. ['remark', 'string', 'max' => 255],
  27. ['callback_data', 'array'],
  28. ];
  29. }
  30. /**
  31. * 默认值
  32. */
  33. public function default(): array
  34. {
  35. return [];
  36. }
  37. }