123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- namespace app\api\validate;
- use think\Validate;
- /**
- * 身体测量验证器
- */
- class BodyMeasurements extends Validate
- {
- // 验证规则
- protected $rule = [
- 'profile_id' => 'require|integer|gt:0',
- 'chest' => 'float|egt:0|elt:200',
- 'waist' => 'float|egt:0|elt:200',
- 'hip' => 'float|egt:0|elt:200',
- 'thigh' => 'float|egt:0|elt:100',
- 'calf' => 'float|egt:0|elt:80',
- 'upper_arm' => 'float|egt:0|elt:80',
- 'forearm' => 'float|egt:0|elt:60',
- 'neck' => 'float|egt:0|elt:80',
- 'shoulder_width' => 'float|egt:0|elt:100',
- 'bust' => 'float|egt:0|elt:200',
- 'underbust' => 'float|egt:0|elt:150',
- 'inseam' => 'float|egt:0|elt:150',
- 'outseam' => 'float|egt:0|elt:150',
- 'knee' => 'float|egt:0|elt:80',
- 'arm_length' => 'float|egt:0|elt:100',
- 'wrist' => 'float|egt:0|elt:30',
- 'pants_length' => 'float|egt:0|elt:150',
- 'shoe_size' => 'length:0,10',
- 'measurement_date' => 'date',
- 'belly_belt' => 'float|egt:0|elt:100',
- 'leg_root' => 'float|egt:0|elt:100',
- ];
- // 验证消息
- protected $message = [
- 'profile_id.require' => '档案ID不能为空',
- 'profile_id.integer' => '档案ID必须是整数',
- 'profile_id.gt' => '档案ID必须大于0',
- 'chest.float' => '胸围必须是数字',
- 'chest.egt' => '胸围不能小于0',
- 'chest.elt' => '胸围不能大于200厘米',
- 'waist.float' => '腰围必须是数字',
- 'waist.egt' => '腰围不能小于0',
- 'waist.elt' => '腰围不能大于200厘米',
- 'hip.float' => '臀围必须是数字',
- 'hip.egt' => '臀围不能小于0',
- 'hip.elt' => '臀围不能大于200厘米',
- 'thigh.float' => '大腿围必须是数字',
- 'thigh.egt' => '大腿围不能小于0',
- 'thigh.elt' => '大腿围不能大于100厘米',
- 'calf.float' => '小腿围必须是数字',
- 'calf.egt' => '小腿围不能小于0',
- 'calf.elt' => '小腿围不能大于80厘米',
- 'upper_arm.float' => '上臂围必须是数字',
- 'upper_arm.egt' => '上臂围不能小于0',
- 'upper_arm.elt' => '上臂围不能大于80厘米',
- 'forearm.float' => '前臂围必须是数字',
- 'forearm.egt' => '前臂围不能小于0',
- 'forearm.elt' => '前臂围不能大于60厘米',
- 'neck.float' => '颈围必须是数字',
- 'neck.egt' => '颈围不能小于0',
- 'neck.elt' => '颈围不能大于80厘米',
- 'shoulder_width.float' => '肩宽必须是数字',
- 'shoulder_width.egt' => '肩宽不能小于0',
- 'shoulder_width.elt' => '肩宽不能大于100厘米',
- 'bust.float' => '乳围必须是数字',
- 'bust.egt' => '乳围不能小于0',
- 'bust.elt' => '乳围不能大于200厘米',
- 'underbust.float' => '下胸围必须是数字',
- 'underbust.egt' => '下胸围不能小于0',
- 'underbust.elt' => '下胸围不能大于150厘米',
- 'inseam.float' => '内缝长必须是数字',
- 'inseam.egt' => '内缝长不能小于0',
- 'inseam.elt' => '内缝长不能大于150厘米',
- 'outseam.float' => '外缝长必须是数字',
- 'outseam.egt' => '外缝长不能小于0',
- 'outseam.elt' => '外缝长不能大于150厘米',
- 'knee.float' => '膝围必须是数字',
- 'knee.egt' => '膝围不能小于0',
- 'knee.elt' => '膝围不能大于80厘米',
- 'arm_length.float' => '臂长必须是数字',
- 'arm_length.egt' => '臂长不能小于0',
- 'arm_length.elt' => '臂长不能大于100厘米',
- 'wrist.float' => '腕围必须是数字',
- 'wrist.egt' => '腕围不能小于0',
- 'wrist.elt' => '腕围不能大于30厘米',
- 'pants_length.float' => '裤长必须是数字',
- 'pants_length.egt' => '裤长不能小于0',
- 'pants_length.elt' => '裤长不能大于150厘米',
- 'shoe_size.length' => '鞋码长度不能超过10个字符',
- 'measurement_date.date' => '测量日期格式错误',
- 'belly_belt.float' => '肚围长度必须是数字',
- 'belly_belt.egt' => '肚围长度不能小于0',
- 'belly_belt.elt' => '肚围长度不能大于100厘米',
- 'leg_root.float' => '腿根长度必须是数字',
- 'leg_root.egt' => '腿根长度不能小于0',
- 'leg_root.elt' => '腿根长度不能大于100厘米',
- ];
- // 验证场景
- protected $scene = [
- 'add' => ['profile_id', 'chest', 'waist', 'hip', 'thigh', 'calf', 'upper_arm', 'forearm', 'neck', 'shoulder_width', 'bust', 'underbust', 'inseam', 'outseam', 'knee', 'arm_length', 'wrist', 'pants_length', 'shoe_size', 'measurement_date'],
- ];
- }
|