'require|file|fileExt:xlsx,xls', 'goods_id' => 'require|integer|gt:0', 'item_id' => 'require|integer|gt:0', 'sell_price' => 'float|egt:0', 'lineation_price' => 'float|egt:0', 'cost_price' => 'float|egt:0', 'stock' => 'integer|egt:0', 'weight' => 'float|egt:0', 'volume' => 'float|egt:0', ]; protected $message = [ 'file.require' => '请上传导入文件', 'file.file' => '上传的文件格式不正确', 'file.fileExt' => '只支持xlsx和xls格式的Excel文件', 'goods_id.require' => '商品ID不能为空', 'goods_id.integer' => '商品ID必须为整数', 'goods_id.gt' => '商品ID必须大于0', 'item_id.require' => '规格ID不能为空', 'item_id.integer' => '规格ID必须为整数', 'item_id.gt' => '规格ID必须大于0', 'sell_price.float' => '销售价格必须为数字', 'sell_price.egt' => '销售价格不能小于0', 'lineation_price.float' => '划线价格必须为数字', 'lineation_price.egt' => '划线价格不能小于0', 'cost_price.float' => '成本价格必须为数字', 'cost_price.egt' => '成本价格不能小于0', 'stock.integer' => '库存数量必须为整数', 'stock.egt' => '库存数量不能小于0', 'weight.float' => '重量必须为数字', 'weight.egt' => '重量不能小于0', 'volume.float' => '体积必须为数字', 'volume.egt' => '体积不能小于0', ]; /** * @notes 导入场景 * @return GoodsSpecPriceValidate * @author * @date 2024/01/01 00:00 */ public function sceneImport() { return $this->only(['file']); } /** * @notes 单条数据验证场景 * @return GoodsSpecPriceValidate * @author * @date 2024/01/01 00:00 */ public function sceneItem() { return $this->only(['goods_id', 'item_id', 'sell_price', 'lineation_price', 'cost_price', 'stock', 'weight', 'volume']); } }