Spec.php 831 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 验证器
  10. */
  11. class Spec extends Validate
  12. {
  13. protected $rule = [
  14. 'sp_name' => 'require',
  15. 'sp_sort' => 'require|number',
  16. 'gc_id' => 'require|number',
  17. ];
  18. protected $message = [
  19. 'sp_name.require' => '规格名称为必填',
  20. 'sp_sort.require' => '规格排序为必填',
  21. 'sp_sort.number' => '规格排序必须为数字',
  22. 'gc_id.require' => '分类为必填',
  23. 'gc_id.number' => '分类ID必须为数字',
  24. ];
  25. protected $scene = [
  26. 'spec_add' => ['sp_name', 'sp_sort', 'gc_id'],
  27. 'spec_edit' => ['sp_name', 'sp_sort', 'gc_id'],
  28. ];
  29. }