Goods.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 验证器
  10. */
  11. class Goods extends Validate
  12. {
  13. protected $rule = [
  14. 'goods_name' => 'require|max:200',
  15. 'goods_price' => 'require',
  16. 'gc_name' => 'require',
  17. 'gc_sort' => 'between:0,255',
  18. 'goods_content' => 'require',
  19. ];
  20. protected $message = [
  21. 'goods_name.require' => '商品名称不能为空',
  22. 'goods_name.max' => '商品名称不能超过200个字符',
  23. 'goods_price.require' => '商品价格不能为空',
  24. 'gc_name.require' => '分类标题为必填',
  25. 'gc_sort.between' => '排序应该在0至255之间',
  26. 'goods_content.require' => '咨询内容不能为空',
  27. ];
  28. protected $scene = [
  29. 'edit_save_goods' => ['goods_name', 'goods_price'],
  30. 'goods_class_add' => ['gc_name', 'gc_sort'], //goodsclass
  31. 'goods_class_edit' => ['gc_name', 'gc_sort'], //goodsclass
  32. 'save_consult' => ['goods_content'], //home goods
  33. ];
  34. }