From 4b0e9ba960b78b7f59996234b6ea142c21da498b Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Mon, 11 Jul 2022 10:47:12 +0800 Subject: [PATCH] setter --- app/controller/manager/mall/Spu.php | 2 +- app/repository/SpuRepository.php | 4 ++-- public/.htaccess | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controller/manager/mall/Spu.php b/app/controller/manager/mall/Spu.php index d4b2b46..95a13a2 100755 --- a/app/controller/manager/mall/Spu.php +++ b/app/controller/manager/mall/Spu.php @@ -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', diff --git a/app/repository/SpuRepository.php b/app/repository/SpuRepository.php index f1a1943..25bfc15 100755 --- a/app/repository/SpuRepository.php +++ b/app/repository/SpuRepository.php @@ -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'])) { diff --git a/public/.htaccess b/public/.htaccess index 5cae19e..be1eac6 100755 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,10 +1,10 @@ - - SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 - Options +FollowSymlinks -Multiviews - RewriteEngine On - - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC] - RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] + + SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 + Options +FollowSymlinks -Multiviews + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_URI} !^(.*)\.(gif|jpg|jpeg|png|swf|mp4)$ [NC] + RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L] \ No newline at end of file