'require|integer|gt:0', 'goods_sku_id' => 'integer|egt:0', 'nums' => 'require|integer|gt:0', 'cartIds' => 'require|array|min:1', 'isChecked' => 'require|in:0,1', ]; /** * 提示消息 */ protected $message = [ 'goods_id.require' => '商品ID不能为空', 'goods_id.integer' => '商品ID必须是整数', 'goods_id.gt' => '商品ID必须大于0', 'goods_sku_id.integer' => '商品规格ID必须是整数', 'goods_sku_id.egt' => '商品规格ID必须大于或等于0', 'nums.require' => '商品数量不能为空', 'nums.integer' => '商品数量必须是整数', 'nums.gt' => '商品数量必须大于0', 'cartIds.require' => '购物车ID不能为空', 'cartIds.array' => '购物车ID必须为数组', 'cartIds.min' => '至少选择一个购物车项', 'isChecked.require' => '选中状态不能为空', 'isChecked.in' => '选中状态只能是0或1', ]; /** * 验证场景 */ protected $scene = [ 'add' => ['goods_id', 'goods_sku_id', 'nums'], 'set_nums' => ['nums'], 'checked' => ['cartIds', 'isChecked'], ]; }