StoreAdminValidate.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\validate\store;
  12. use think\Validate;
  13. class StoreAdminValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'account' => ['require', 'length:4,64'],
  23. 'conf_pwd' => ['require', 'length:4,64'],
  24. 'pwd' => ['require', 'length:4,64'],
  25. 'staff_name' => 'require',
  26. 'roles' => ['require', 'array'],
  27. ];
  28. /**
  29. * 定义错误信息
  30. * 格式:'字段名.规则名' => '错误信息'
  31. *
  32. * @var array
  33. */
  34. protected $message = [
  35. 'account.require' => '请填写门店管理员账号',
  36. 'account.length' => '门店管理员账号长度4-64位字符',
  37. 'conf_pwd.require' => '请输入确认密码',
  38. 'conf_pwd.length' => '确认密码长度4-64位字符',
  39. 'pwd.require' => '请输入密码',
  40. 'pwd.length' => '密码长度4-64位字符',
  41. 'staff_name.require' => '请输门店管理员姓名',
  42. 'roles.require' => '请选择管理员身份',
  43. 'roles.array' => '身份必须为数组',
  44. ];
  45. protected $scene = [
  46. 'get' => ['account', 'pwd'],
  47. 'update' => ['account', 'roles'],
  48. ];
  49. }