new-admin-api/app/validate/merchant/BroadcastGoodsValidate.php

28 lines
514 B
PHP

<?php
namespace app\validate\merchant;
use think\Validate;
class BroadcastGoodsValidate extends Validate
{
protected $failException = true;
protected $rule = [
'name|商品名称' => 'require|min:3|max:14',
'cover_img|商品图' => 'require',
'price|价格' => 'require|min:0.01',
'product_id|商品' => 'require|array|length:2',
];
public function isBatch()
{
$this->rule['product_id|商品'] = 'require|integer';
return $this;
}
}