master
wangxinglong 2022-07-11 10:47:12 +08:00
parent 67fd07d14a
commit 4b0e9ba960
3 changed files with 12 additions and 12 deletions

View File

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

View File

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

View File

@ -1,10 +1,10 @@
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
Options +FollowSymlinks -Multiviews Options +FollowSymlinks -Multiviews
RewriteEngine On RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC] RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC]
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule> </IfModule>