<?php

namespace app\common\validate;

use think\Validate;

class Upload extends Validate {

    protected $rule = [
        'image' => ['fileExt' => 'jpg,png,gif,jpeg', 'fileSize' => 5 * 1024 * 1024, 'fileMime' => 'image/jpg,image/png,image/gif,image/jpeg'],
        'file' => ['fileExt' => 'pdf,doc,docx,xlsx,xls,csv', 'fileSize' => 20 * 1024 * 1024, 'fileMime' => 'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
        'hybrid' => ['fileExt' => 'zip,rar,7z', 'fileSize' => 100 * 1024 * 1024, 'fileMime' => 'application/zip,application/x-rar-compressed,application/x-7z-compressed'],
        'system' => ['fileExt' => 'jpg,png,gif,jpeg,pdf,doc,docx,xlsx,xls,csv', 'fileSize' => 20 * 1024 * 1024, 'fileMime' => 'image/jpg,image/png,image/gif,image/jpeg,application/pdf,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
    ];
    protected $message = [
        'image.fileExt' => '图片的格式仅支持:png,jpg,jpeg,gif',
        'image.fileSize' => '图片大小不能大于5兆',
        'image.fileMime' => '图片的文件类型不正确',
        'file.fileExt' => '文件的格式支持:pdf,doc,docx,xlsx,xls,csv',
        'file.fileSize' => '文件大小不能大于20兆',
        'file.fileMime' => '文件类型不支持',
        'hybrid.fileExt' => '文件的格式支持:zip,rar,7z',
        'hybrid.fileSize' => '文件大小不能大于100兆',
        'hybrid.fileMime' => '文件类型不支持',
        'system.fileExt' => '文件的格式仅支持:png,jpg,jpeg,gif,pdf,doc,docx,xlsx,xls,csv',
        'system.fileSize' => '文件大小不能大于20兆',
        'system.fileMime' => '文件类型不支持'
    ];

}
