Spec.php 1.0 KB

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