From 1da92aeeb0b4d57aead4f7eb3da12a73b292deeb Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Tue, 11 Feb 2025 10:18:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/validate/v1/ProductValidate.php | 38 +++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/app/admin/validate/v1/ProductValidate.php b/app/admin/validate/v1/ProductValidate.php index 2530f05c..5904f7af 100644 --- a/app/admin/validate/v1/ProductValidate.php +++ b/app/admin/validate/v1/ProductValidate.php @@ -14,24 +14,25 @@ class ProductValidate extends Validate * @var array */ protected $rule = [ - 'category_id' => 'integer', - 'spu' => 'require|max:255', - 'name' => 'require|max:125', - 'short_name' => 'max:64', - 'cover_image' => 'max:255', - 'desc' => 'max:255', - 'video_img' => 'max:255', - 'video_url' => 'max:255', - 'is_sale' => 'in:0,1', - 'is_new' => 'in:0,1', - 'is_hot' => 'in:0,1', - 'sort' => 'integer', - 'detail' => 'max:65535', - 'status' => 'in:-1,1', - 'seo_title' => 'max:255', + 'language_id' => 'require|integer', + 'category_id' => 'integer', + 'spu' => 'require|max:255', + 'name' => 'require|max:125', + 'short_name' => 'max:64', + 'cover_image' => 'max:255', + 'desc' => 'max:255', + 'video_img' => 'max:255', + 'video_url' => 'max:255', + 'is_sale' => 'in:0,1', + 'is_new' => 'in:0,1', + 'is_hot' => 'in:0,1', + 'sort' => 'integer', + 'detail' => 'max:65535', + 'status' => 'in:-1,1', + 'seo_title' => 'max:255', 'seo_keywords' => 'max:255', - 'seo_desc' => 'max:255', - 'created_at' => 'checkFormatDatetimeRange' + 'seo_desc' => 'max:255', + 'created_at' => 'checkFormatDatetimeRange' ]; /** @@ -41,6 +42,8 @@ class ProductValidate extends Validate * @var array */ protected $message = [ + 'language_id.require' => '语言ID不能为空', + 'language_id.integer' => '语言ID必须为整数', 'category_id.integer' => '分类ID必须为整数', 'spu.require' => 'spu不能为空', 'spu.max' => 'spu不能超过255个字符', @@ -77,6 +80,7 @@ class ProductValidate extends Validate public function sceneUpdate() { return $this->only([ + 'language_id', 'category_id', 'spu', 'name',