128 lines
5.0 KiB
PHP
128 lines
5.0 KiB
PHP
<?php
|
|
|
|
namespace app\common\validate;
|
|
|
|
use think\Validate;
|
|
|
|
class VehVehicleSkuValidate extends Validate
|
|
{
|
|
/**
|
|
* 规则定义
|
|
*/
|
|
protected $rule = [
|
|
'sku_code' => 'max:40|alphaNum',
|
|
'fingerprint' => 'length:64|alphaNum',
|
|
'brand_code' => 'require|max:32',
|
|
'brand_name' => 'require|max:64',
|
|
'series_code' => 'max:64',
|
|
'series_name' => 'max:128',
|
|
'model_code' => 'max:64',
|
|
'model_name' => 'require|max:128',
|
|
'model_year' => 'require|number|between:1900,2100',
|
|
'trim_code' => 'max:64',
|
|
'trim_level_code' => 'max:64',
|
|
'edition_code' => 'max:64',
|
|
'trim' => 'max:128',
|
|
'trim_level' => 'max:64',
|
|
'edition_name' => 'max:64',
|
|
'body_type_code' => 'max:32',
|
|
'drive_type_code' => 'max:16',
|
|
'motor_layout_code' => 'max:32',
|
|
'fuel_type_code' => 'max:16',
|
|
'engine_disp_l' => 'float|between:0,99.9',
|
|
'engine_turbo' => 'in:0,1',
|
|
'engine_power_kw' => 'number|between:0,2000',
|
|
'battery_kwh' => 'float|between:0,999.99',
|
|
'transmission_code' => 'max:16',
|
|
'gears' => 'number|between:1,20',
|
|
'range_km' => 'number|between:0,2000',
|
|
'range_std_code' => 'max:16',
|
|
'doors' => 'number|between:2,10',
|
|
'seats' => 'number|between:1,20',
|
|
'weight_kg' => 'number|between:0,10000',
|
|
'dimensions_mm' => 'array',
|
|
'color_exterior_code'=> 'max:32',
|
|
'color_exterior_text'=> 'max:64',
|
|
'color_interior_code'=> 'max:32',
|
|
'color_interior_text'=> 'max:64',
|
|
'options_official' => 'array',
|
|
'features' => 'array',
|
|
'emission_std_code' => 'max:16',
|
|
'origin_country' => 'alpha|length:2',
|
|
'currency' => 'require|alpha|length:3',
|
|
'msrp' => 'float|between:0,9999999999.99',
|
|
'is_active' => 'in:0,1',
|
|
'corp_id' => 'require|number',
|
|
'remark' => 'max:255',
|
|
'created_by' => 'number',
|
|
'updated_by' => 'number',
|
|
'created_at' => 'require|number',
|
|
'updated_at' => 'require|number',
|
|
];
|
|
|
|
/**
|
|
* 字段别名
|
|
*/
|
|
protected $field = [
|
|
'sku_code' => 'SKU编码',
|
|
'fingerprint' => '规格指纹',
|
|
'brand_code' => '品牌代码',
|
|
'brand_name' => '品牌名称',
|
|
'series_code' => '车系代码',
|
|
'series_name' => '车系名称',
|
|
'model_code' => '车型代码',
|
|
'model_name' => '车型名称',
|
|
'model_year' => '年款',
|
|
'trim_code' => '版型代码',
|
|
'trim_level_code' => '配置等级代码',
|
|
'edition_code' => '特别版代码',
|
|
'trim' => '版型/细分配置',
|
|
'trim_level' => '配置等级',
|
|
'edition_name' => '特别版名称',
|
|
'body_type_code' => '车身类型',
|
|
'drive_type_code' => '驱动方式',
|
|
'motor_layout_code' => '电机布置',
|
|
'fuel_type_code' => '能源类型',
|
|
'engine_disp_l' => '排量(L)',
|
|
'engine_turbo' => '是否涡轮',
|
|
'engine_power_kw' => '最大功率(kW)',
|
|
'battery_kwh' => '电池容量(kWh)',
|
|
'transmission_code' => '变速箱代码',
|
|
'gears' => '挡位数',
|
|
'range_km' => '续航里程',
|
|
'range_std_code' => '续航标准',
|
|
'doors' => '门数',
|
|
'seats' => '座位数',
|
|
'weight_kg' => '整备质量',
|
|
'dimensions_mm' => '车身尺寸',
|
|
'color_exterior_code'=> '外观色代码',
|
|
'color_exterior_text'=> '外观色名称',
|
|
'color_interior_code'=> '内饰色代码',
|
|
'color_interior_text'=> '内饰色名称',
|
|
'options_official' => '官方选装',
|
|
'features' => '功能配置',
|
|
'emission_std_code' => '排放标准',
|
|
'origin_country' => '原产国',
|
|
'currency' => '币种',
|
|
'msrp' => '建议零售价',
|
|
'is_active' => '是否启用',
|
|
'corp_id' => '公司ID',
|
|
'remark' => '备注',
|
|
'created_by' => '创建人',
|
|
'updated_by' => '更新人',
|
|
'created_at' => '创建时间',
|
|
'updated_at' => '更新时间',
|
|
];
|
|
|
|
/**
|
|
* 场景定义
|
|
*/
|
|
protected $scene = [
|
|
'store' => [
|
|
'brand_code', 'brand_name', 'model_year','currency'
|
|
],
|
|
'update' => [
|
|
'id', 'brand_code','brand_name', 'model_year','currency'
|
|
],
|
|
];
|
|
} |