StoreCategoryValidate.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\outapi\validate;
  12. use think\Validate;
  13. class StoreCategoryValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'pid' => 'number|egt:0',
  23. 'cate_name' => 'require|max:25',
  24. 'pic' => 'max:128',
  25. 'big_pic' => 'max:200',
  26. 'sort' => 'number|egt:0',
  27. 'is_show' => 'in:0,1'
  28. ];
  29. /**
  30. * 定义错误信息
  31. * 格式:'字段名.规则名' => '错误信息'
  32. *
  33. * @var array
  34. */
  35. protected $message = [
  36. 'pid.number' => '400745',
  37. 'pid.egt' => '400745',
  38. 'cate_name.require' => '410095',
  39. 'cate_name.max' => '400746',
  40. 'pic.max' => '400747',
  41. 'big_pic.max' => '400748',
  42. 'sort.number' => '400749',
  43. 'sort.egt' => '400750',
  44. 'is_show.in' => '400751',
  45. ];
  46. protected $scene = [
  47. 'save' => ['pid', 'cate_name', 'pic', 'big_pic', 'sort', 'is_show'],
  48. ];
  49. }