联系人提示
This commit is contained in:
@@ -6,6 +6,25 @@ use think\Validate;
|
|||||||
|
|
||||||
class ContactsValidator extends Validate
|
class ContactsValidator extends Validate
|
||||||
{
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// 初始化验证消息
|
||||||
|
$this->message = [
|
||||||
|
'name.require' => trans('name_not_null'),
|
||||||
|
'name.max' => trans('name_max'),
|
||||||
|
'name.checkEmptyString' => trans('name_check_empty'),
|
||||||
|
'phone.require' => trans('phone_not_null'),
|
||||||
|
'phone.checkInternationalPhone' => trans('phone_international'),
|
||||||
|
'content.require' => trans('content_not_null'),
|
||||||
|
'content.min' => trans('content_min'),
|
||||||
|
'content.max' => trans('content_max'),
|
||||||
|
'vehicle_id.integer' => trans('vehicle_id_integer'),
|
||||||
|
'email.email' => trans('email'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// 验证规则
|
// 验证规则
|
||||||
protected $rule = [
|
protected $rule = [
|
||||||
'name' => 'require|max:255|checkEmptyString',
|
'name' => 'require|max:255|checkEmptyString',
|
||||||
@@ -16,18 +35,7 @@ class ContactsValidator extends Validate
|
|||||||
];
|
];
|
||||||
|
|
||||||
// 错误提示信息
|
// 错误提示信息
|
||||||
protected $message = [
|
protected $message = [];
|
||||||
'name.require' => '姓名不能为空',
|
|
||||||
'name.max' => '姓名长度不能超过255个字符',
|
|
||||||
'name.checkEmptyString' => '姓名不能只包含空格',
|
|
||||||
'phone.require' => '联系电话不能为空',
|
|
||||||
'phone.checkInternationalPhone' => '请使用国际格式',
|
|
||||||
'content.require' => '内容不能为空',
|
|
||||||
'content.min' => '内容至少需要10个字符',
|
|
||||||
'content.max' => '内容长度超过最大限制',
|
|
||||||
'vehicle_id.integer' => '车辆ID必须为数字',
|
|
||||||
'email.email' => '邮箱格式不正确'
|
|
||||||
];
|
|
||||||
|
|
||||||
// 验证场景
|
// 验证场景
|
||||||
protected $scene = [
|
protected $scene = [
|
||||||
|
|||||||
@@ -35,4 +35,16 @@ return [
|
|||||||
'in_stock' => 'بقعة',
|
'in_stock' => 'بقعة',
|
||||||
'in_transit' => 'في الطريق',
|
'in_transit' => 'في الطريق',
|
||||||
'in_order' => 'أمر',
|
'in_order' => 'أمر',
|
||||||
|
|
||||||
|
// 联系人
|
||||||
|
'name_not_null' => 'الاسم لا يمكن فارغة',
|
||||||
|
'name_max' => 'الاسم لا يمكن أن يكون أكثر من 255 حرفا في الطول',
|
||||||
|
'name_check_empty' => 'الاسم لا يحتوي على مسافات فقط',
|
||||||
|
'phone_not_null' => 'رقم الهاتف لا يمكن أن تكون فارغة',
|
||||||
|
'phone_international' => 'يرجى استخدام النموذج الدولي',
|
||||||
|
'content_not_null' => 'المحتوى لا يمكن أن تكون فارغة',
|
||||||
|
'content_min' => 'المحتوى يتطلب ما لا يقل عن 10 أحرف',
|
||||||
|
'content_max' => 'طول المحتوى يتجاوز الحد الأقصى',
|
||||||
|
'vehicle_id_integer' => 'رقم السيارة يجب أن تكون رقمية',
|
||||||
|
'email' => 'شكل علبة البريد غير صحيحة',
|
||||||
];
|
];
|
||||||
@@ -36,4 +36,16 @@ return [
|
|||||||
'in_stock' => 'In stock',
|
'in_stock' => 'In stock',
|
||||||
'in_transit' => 'In transit',
|
'in_transit' => 'In transit',
|
||||||
'in_order' => 'order',
|
'in_order' => 'order',
|
||||||
|
|
||||||
|
// 联系方式
|
||||||
|
'name_not_null' => 'name not null',
|
||||||
|
'name_max' => 'The length of the name cannot exceed 255 characters',
|
||||||
|
'name_check_empty' => 'Name cannot contain only spaces',
|
||||||
|
'phone_not_null' => 'The contact phone number cannot be empty',
|
||||||
|
'phone_international' => 'Please use international format',
|
||||||
|
'content_not_null' => 'The content cannot be empty',
|
||||||
|
'content_min' => 'The content requires at least 10 characters',
|
||||||
|
'content_max' => 'The content length exceeds the maximum limit',
|
||||||
|
'vehicle_id_integer' => 'The vehicle ID must be a number',
|
||||||
|
'email' => 'Email format incorrect',
|
||||||
];
|
];
|
||||||
@@ -36,4 +36,16 @@ return [
|
|||||||
'in_stock' => 'Наличные товары',
|
'in_stock' => 'Наличные товары',
|
||||||
'in_transit' => 'В пути',
|
'in_transit' => 'В пути',
|
||||||
'in_order' => 'Заказать',
|
'in_order' => 'Заказать',
|
||||||
|
|
||||||
|
// 联系人
|
||||||
|
'name_not_null' => 'Имя не может быть пустым.',
|
||||||
|
'name_max' => 'Длина имени не должна превышать 255 символов.',
|
||||||
|
'name_check_empty' => 'Имя не может содержать только пробелы.',
|
||||||
|
'phone_not_null' => 'Контактный телефон не может быть пустым.',
|
||||||
|
'phone_international' => 'Пожалуйста, используйте международный формат.',
|
||||||
|
'content_not_null' => 'Содержание не может быть пустым',
|
||||||
|
'content_min' => 'Содержание должно быть не менее 10 символов.',
|
||||||
|
'content_max' => 'Объем контента превышает максимальный предел',
|
||||||
|
'vehicle_id_integer' => 'Идентификатор автомобиля должен быть цифровым.',
|
||||||
|
'email' => 'Неверный формат почтового ящика',
|
||||||
];
|
];
|
||||||
@@ -37,4 +37,16 @@ return [
|
|||||||
'in_stock' => '现货',
|
'in_stock' => '现货',
|
||||||
'in_transit' => '在途',
|
'in_transit' => '在途',
|
||||||
'in_order' => '订购',
|
'in_order' => '订购',
|
||||||
|
|
||||||
|
// 联系人
|
||||||
|
'name_not_null' => '姓名不能为空',
|
||||||
|
'name_max' => '姓名长度不能超过255个字符',
|
||||||
|
'name_check_empty' => '姓名不能只包含空格',
|
||||||
|
'phone_not_null' => '联系电话不能为空',
|
||||||
|
'phone_international' => '请使用国际格式',
|
||||||
|
'content_not_null' => '内容不能为空',
|
||||||
|
'content_min' => '内容至少需要10个字符',
|
||||||
|
'content_max' => '内容长度超过最大限制',
|
||||||
|
'vehicle_id_integer' => '车辆ID必须为数字',
|
||||||
|
'email' => '邮箱格式不正确',
|
||||||
];
|
];
|
||||||
Reference in New Issue
Block a user