diff --git a/app/common/service/SkuService.php b/app/common/service/SkuService.php index 73256b4..d9ebd80 100644 --- a/app/common/service/SkuService.php +++ b/app/common/service/SkuService.php @@ -6,6 +6,7 @@ use app\common\model\SkuAttributeValue; use app\common\validate\SkuValidate; use app\common\traits\crud\CrudServiceTrait; use app\common\model\Sku; +use support\exception\BusinessException; use support\Redis; use support\Request; @@ -84,6 +85,10 @@ class SkuService isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'); $domain = $protocol . '://' . $request->host(); + if(!is_numeric($data['price'])){ + throw new BusinessException('价格不合法,需要是数字'); + } + $spec = []; foreach ($data['spec'] as $key => $value) { $specItem = [];