SystemStoreValidate.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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\admin\merchant;
  12. use think\Validate;
  13. class SystemStoreValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'name' => 'require',
  23. 'introduction' => 'require',
  24. 'phone' => ['require','mobile'],
  25. 'address' => 'require',
  26. 'detailed_address' => 'require',
  27. 'longitude' => 'require',
  28. 'latitude' => 'require',
  29. 'day_time' => 'require',
  30. 'store_account' => ['require', 'length:4,64'],
  31. 'true_password' => ['require', 'length:4,64'],
  32. 'store_password' => ['require', 'length:4,64'],
  33. ];
  34. /**
  35. * 定义错误信息
  36. * 格式:'字段名.规则名' => '错误信息'
  37. *
  38. * @var array
  39. */
  40. protected $message = [
  41. 'name.require' => '请填写门店名称',
  42. 'introduction.require' => '请填写门店简介',
  43. 'phone.require' => '请填写门店电话',
  44. 'phone.mobile' => '手机号格式不正确',
  45. 'address.require' => '请选择地址',
  46. 'detailed_address.require' => '请填写详细地址',
  47. 'longitude.require' => '请选择经纬度',
  48. 'latitude.require' => '请选择经纬度',
  49. 'day_time.require' => '请选择营业时间',
  50. 'store_account.require' => '请填写门店管理员账号',
  51. 'store_account.length' => '门店管理员账号长度4-64位字符',
  52. 'true_password.require' => '请填写门店管理员确认密码',
  53. 'true_password.length' => '门店管理员确认密码长度4-64位字符',
  54. 'store_password.require' => '请填写门店管理员密码',
  55. 'store_password.length' => '门店管理员密码长度4-64位字符',
  56. ];
  57. protected $scene = [
  58. 'reset' => ['store_account', 'true_password', 'store_password'],
  59. 'save' => ['name', 'phone', 'address', 'detailed_address', 'latlng', 'day_time', 'store_account', 'store_password'],
  60. 'update' => ['name', 'phone', 'address', 'detailed_address', 'latlng', 'day_time'],
  61. ];
  62. }