1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\common\validate;
- use think\Validate;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 验证器
- */
- class Goods extends Validate
- {
- protected $rule = [
- 'goods_name' => 'require|max:200',
- 'goods_price' => 'require',
- 'gc_name' => 'require',
- 'gc_sort' => 'between:0,255',
- 'goods_content' => 'require',
- ];
- protected $message = [
- 'goods_name.require' => '商品名称不能为空',
- 'goods_name.max' => '商品名称不能超过200个字符',
- 'goods_price.require' => '商品价格不能为空',
- 'gc_name.require' => '分类标题为必填',
- 'gc_sort.between' => '排序应该在0至255之间',
- 'goods_content.require' => '咨询内容不能为空',
- ];
- protected $scene = [
- 'edit_save_goods' => ['goods_name', 'goods_price'],
- 'goods_class_add' => ['gc_name', 'gc_sort'], //goodsclass
- 'goods_class_edit' => ['gc_name', 'gc_sort'], //goodsclass
- 'save_consult' => ['goods_content'], //home goods
- ];
- }
|