TransferOutThirdPartyValidation.php 1.1 KB

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