Admin.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 验证器
  13. */
  14. class Admin extends Validate
  15. {
  16. protected $rule = [
  17. 'admin_name' => 'require|length:3,12',
  18. 'admin_password' => 'require|min:6',
  19. 'admin_gid' => 'require',
  20. 'captcha' => 'require|min:3',
  21. ];
  22. protected $message = [
  23. 'admin_name.require' => '登录名必填',
  24. 'admin_name.length' => '登录名长度在3到12位',
  25. 'admin_password.require' => '密码为必填',
  26. 'admin_password.min' => '密码长度至少为6位',
  27. 'admin_gid.require' => '权限组为必填',
  28. 'captcha.require' => '验证码为必填',
  29. 'captcha.min' => '验证码长度至少为3位',
  30. ];
  31. protected $scene = [
  32. 'admin_add' => ['admin_name', 'admin_password', 'admin_gid'],
  33. 'index' => ['admin_name', 'admin_password', 'captcha'], //login index
  34. ];
  35. }