| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?phpnamespace app\api\validate;use think\Validate;class UserCancel extends Validate{    /**     * 验证规则     */    protected $rule = [        'type'    => 'require|in:mobile,email',        'mobile'  => 'regex:^1\d{10}$|requireIf:type,mobile',        'email'   => 'email|requireIf:type,email',        'captcha' => 'require',        'newpassword' => 'require|length:6,30',    ];    /**     * 提示消息     */    protected $message = [        'type.require'    => '验证类型不能为空',        'type.in'         => '验证类型只能是手机号或邮箱',        'mobile.regex'    => '手机号格式不正确',        'mobile.requireIf' => '手机号不能为空',        'email.email'     => '邮箱格式不正确',        'email.requireIf' => '邮箱不能为空',        'captcha.require' => '验证码不能为空',        'newpassword.require' => '新密码不能为空',        'newpassword.length' => '新密码长度必须在6-30个字符之间'    ];    /**     * 验证场景     */    protected $scene = [        'cancel' => ['type', 'mobile', 'email', 'captcha'],        'resetpwd' => ['type', 'mobile', 'email', 'newpassword', 'captcha'],            ];   } 
 |