setter
parent
67fd07d14a
commit
4b0e9ba960
|
@ -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',
|
||||
|
|
|
@ -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'])) {
|
||||
|
|
Loading…
Reference in New Issue