From 809fd2a091e72ebc326a2314b5162d58011d61ed Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Thu, 22 Aug 2024 09:38:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=94=9F=E6=B4=BB=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E9=AA=8C=E8=AF=81=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/validate/LocalStoreGoodsValidate.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/api/validate/LocalStoreGoodsValidate.php b/app/api/validate/LocalStoreGoodsValidate.php index c31b2fe4..9d6757cb 100755 --- a/app/api/validate/LocalStoreGoodsValidate.php +++ b/app/api/validate/LocalStoreGoodsValidate.php @@ -14,7 +14,7 @@ class LocalStoreGoodsValidate extends Validate 'lstore_id' => 'require', 'title' => 'require', 'price' => 'require|checkPrice', - 'url' => 'require' + 'url' => 'require|checkPic' ]; protected $message = [ @@ -24,7 +24,8 @@ class LocalStoreGoodsValidate extends Validate 'url.require' => '商品图片不能为空', ]; - public function checkPrice($value, $data, $rule) + // 检查金额格式 + public function checkPrice($value) { $pattern = '/^\d+(\.\d{1,2})?$/'; if (!preg_match($pattern, $value)) { @@ -32,4 +33,10 @@ class LocalStoreGoodsValidate extends Validate } return true; } + + // 检查商品图片 + public function checkPic($value) + { + dump($value);die; + } } \ No newline at end of file