TransferInValidation.php 947 B

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