SystemSupplierValidate.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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\supplier;
  12. use think\Validate;
  13. class SystemSupplierValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'supplier_name' => 'require|max:25',
  23. 'name' => 'max:25',
  24. 'phone' => 'require|mobile',
  25. 'email' => 'email|max:50',
  26. 'address' => 'max:255',
  27. 'province' => 'require|gt:0',
  28. 'city' => 'require|gt:0',
  29. 'area' => 'require|gt:0',
  30. 'detailed_address' => 'max:255',
  31. 'account' => 'require|length:4,64',
  32. 'pwd' => ['require', 'length:4,64'],
  33. 'mark' => 'max:255',
  34. ];
  35. /**
  36. * 定义错误信息
  37. * 格式:'字段名.规则名' => '错误信息'
  38. *
  39. * @var array
  40. */
  41. protected $message = [
  42. 'supplier_name.require' => '请填写供应商名称',
  43. 'supplier_name.max' => '供应商名称最多不能超过25个字符',
  44. 'name.max' => '名称最多不能超过25个字符',
  45. 'phone.require' => '请填写手机号',
  46. 'phone.mobile' => '手机号格式不正确',
  47. 'email.email' => '邮箱格式不正确',
  48. 'email.max' => '邮箱最多不能超过100个字符',
  49. 'address.max' => '供应商地址最多不能超过255个字符',
  50. 'mark.max' => '备注最多不能超过255个字符',
  51. 'province.require' => '请选择省份',
  52. 'province.gt' => '请选择省份',
  53. 'city.require' => '请选择城市',
  54. 'city.gt' => '请选择城市',
  55. 'area.require' => '请选择地区',
  56. 'area.gt' => '请选择地区',
  57. 'detailed_address.max' => '详细地址最多不能超过255个字符',
  58. 'account.require' => '请填写供应商登录用户名',
  59. 'account.length' => '供应商登录用户名4-64长度字符',
  60. 'pwd.require' => '请输入密码',
  61. 'pwd.length' => '密码长度4-64位字符',
  62. ];
  63. protected $scene = [
  64. 'login' => ['account', 'pwd'],
  65. 'update' => ['supplier_name', 'name', 'phone', 'email', 'address', 'detailed_address', 'province', 'city', 'area'],
  66. 'save' => ['supplier_name', 'name', 'phone', 'email', 'address', 'detailed_address', 'province', 'city', 'area','account', 'pwd', 'mark'],
  67. 'admin_update' => ['supplier_name', 'name', 'phone', 'email', 'address', 'detailed_address', 'province', 'city', 'area','account', 'mark'],
  68. ];
  69. }