Goods.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 验证器
  14. */
  15. class Goods extends Validate
  16. {
  17. protected $rule = [
  18. 'goods_name'=>'require|max:200',
  19. 'goods_price'=>'require',
  20. 'gc_name'=>'require',
  21. 'gc_sort'=>'between:0,255',
  22. 'goods_content'=>'require',
  23. ];
  24. protected $message = [
  25. 'goods_name.require'=>'商品名称不能为空',
  26. 'goods_name.max'=>'商品名称不能超过200个字符',
  27. 'goods_price.require'=>'商品价格不能为空',
  28. 'gc_name.require'=>'分类标题为必填',
  29. 'gc_sort.between'=>'排序应该在0至255之间',
  30. 'goods_content.require'=>'咨询内容不能为空',
  31. ];
  32. protected $scene = [
  33. 'edit_save_goods' => ['goods_name', 'goods_price'],
  34. 'goods_class_add' => ['gc_name', 'gc_sort'],//goodsclass
  35. 'goods_class_edit' => ['gc_name', 'gc_sort'],//goodsclass
  36. 'save_consult' => ['goods_content'],//home goods
  37. ];
  38. }