Account.php 878 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\api\validate\user;
  3. use think\Validate;
  4. class Account extends Validate
  5. {
  6. protected $rule = [
  7. 'type' => 'require|in:wechat,alipay,bank',
  8. 'account_name' => 'require',
  9. 'account_header' => 'require',
  10. 'account_no' => 'requireIf:type,alipay|requireIf:type,bank'
  11. ];
  12. protected $message = [
  13. 'type.require' => '请选择账户类型',
  14. 'type.in' => '请选择正确的账户类型',
  15. 'account_name.require' => '请填写姓名',
  16. 'account_header.require' => '请填写开户行',
  17. 'account_no.requireIf' => '请填写账号信息',
  18. ];
  19. protected $scene = [
  20. 'index' => ['type'],
  21. 'wechat' => ['type', 'account_name'],
  22. 'alipay' => ['type', 'account_name', 'account_no'],
  23. 'bank' => ['type', 'account_name', 'account_header', 'account_no']
  24. ];
  25. }