OrderValidate.php
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace app\api\validate;
use think\Validate;
class OrderValidate extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'goods_id' => 'require',
'order_id' => 'require',
'goods_sku_id' => 'require',
'order_type' => 'require|in:self,replace',
'invoice_image' => 'require',
'purchase_price' => 'require',
'mileage_image' => 'require',
'mileage' => 'require',
'driving_license_image' => 'require',
'vin' => 'require',
'plate_number' => 'require',
'brand' => 'require',
'engine_number' => 'require',
'register_time' => 'require',
'issue_time' => 'require',
'owner_name' => 'require',
'mobile' => 'require|regex:/^1\d{10}$/',
'id_number' => ['require', 'regex' => '^\d{18}$|^\d{17}(X|x)$'],
'id_number_image' => 'require',
'exterior_images' => 'require',
];
/**
* 提示消息
*/
protected $message = [
'goods_id.require' => '商品ID不能为空',
'goods_sku_id.require' => '规格ID不能为空',
'order_type' => '下单类型',
'invoice_image.require' => '请上传购车发票',
'purchase_price.require' => '请输入购车金额',
'mileage_image.require' => '请上传表显里程图片',
'mileage.require' => '请输入表显里程',
'driving_license_image.require' => '请上传行驶证',
'vin.require' => '请输入车辆VIN码',
'plate_number.require' => '请输入车牌号',
'brand.require' => '请输入品牌型号',
'engine_number.require' => '请输入发动机型号',
'register_time.require' => '请输入注册日期',
'issue_time.require' => '请输入发证日期',
'owner_name.require' => '请输入车主姓名',
'mobile' => '请输入正确的电话号',
'id_number' => '请输入正确的身份证号',
'id_number_image' => '请上传身份证图片',
'exterior_images' => '请上传车辆外观',
];
/**
* 验证场景
*/
protected $scene = [
'pay' => ['goods_id', 'order_type', 'goods_sku_id', 'invoice_image', 'purchase_price', 'mileage_image', 'mileage',
'driving_license_image', 'vin', 'plate_number', 'brand', 'engine_number', 'register_time', 'issue_time',
'owner_name', 'mobile', 'id_number', 'id_number_image', 'exterior_images'],
'edit_order' => ['order_id', 'goods_id', 'order_type', 'goods_sku_id', 'invoice_image', 'purchase_price', 'mileage_image', 'mileage',
'driving_license_image', 'vin', 'plate_number', 'brand', 'engine_number', 'register_time', 'issue_time',
'owner_name', 'mobile', 'id_number', 'id_number_image', 'exterior_images'],
];
}