<?php
namespace app\validate;

use think\Validate;

class Message extends Validate
{
    protected $rule = [
        'company_name' => 'requireWithout:name|length:2,100',
        'name' => 'requireWithout:company_name|length:2,50',
        'content' => 'require|length:4,500',
        'phone' => 'requireWithout:email|mobile',
        'email' => 'requireWithout:phone|email',
    ];
    protected $message = [
        'company_name.requireWithout' => '公司名称和联系人署名至少需要填写一个',
        'company_name.length' => '公司名称长度限制为2~100个字符',
        'name.requireWithout' => '公司名称和联系人署名至少需要填写一个',
        'name.length' => '联系人署名长度限制为2~50个字符',
        'phone.requireWithout' => '联系电话和邮箱至少需要填写一个',
        'phone.mobile' => '请输入正确的联系电话',
        'email.requireWithout' => '联系电话和邮箱至少需要填写一个',
        'email.email' => '请输入正确的邮箱',
        'content.require' => '咨询事项不能为空',
        'content.length' => '咨询事项长度限制为4~500个字符',
    ];
}