// +---------------------------------------------------------------------- namespace app\validate\api; use think\Validate; class StoreCartValidate extends Validate { protected $failException = true; protected $rule = [ 'product_id|商品ID' => 'require', 'product_attr_unique|SKU' => 'require', 'cart_num|购买数量' => 'require|integer|>:0', ]; }