master
ubuntu 2022-07-11 10:53:11 +08:00
parent 67fd07d14a
commit 49b76918c7
2 changed files with 3 additions and 3 deletions

View File

@ -274,7 +274,7 @@ class Spu extends Base
protected function validateSku($sku)
{
return $this->validateByApi($sku, [
'stock' => 'require|number|gt:0',
'stock' => 'require|number|>=:0',
'original_price' => 'number',
'price' => 'number',
'score' => 'number',

View File

@ -542,8 +542,8 @@ class SpuRepository extends Repository
throw new RepositoryException('请填写库存');
}
$spec['price'] = $spec['original_price'] ?? 0;
if (isset($spec['price']) && $spec['price'] <= 0) {
throw new RepositoryException('规格价格必须大于0');
if (isset($spec['price']) && $spec['price'] < 0) {
throw new RepositoryException('规格价格必须大于等于0');
}
if (!isset($spec['price']) && !isset($spec['score'])) {