本地生活商品添加验证规则

This commit is contained in:
wangxiaowei 2024-08-22 09:34:12 +08:00
parent fa398633aa
commit 33bf92de0f

@ -26,11 +26,10 @@ class LocalStoreGoodsValidate extends Validate
public function checkPrice($value, $data, $rule)
{
dump($value);dump($data);dump($rule);die;
// $pattern = '/^\d+(\.\d{1,2})?$/';
// if (!preg_match($pattern, $value)) {
// return "价格或金额格式不正确";
// }
// return true;
$pattern = '/^\d+(\.\d{1,2})?$/';
if (!preg_match($pattern, $value)) {
return "价格或金额格式不正确";
}
return true;
}
}