Commit 1cd6c3a5 authored by 郭勇志's avatar 郭勇志

修改验证方式

parent 010d5c5f
......@@ -15,7 +15,7 @@ class DownTemplate extends Model
return [
[['ENG_NAME', 'CN_NAME'], 'required'],
[['ENG_NAME'], 'validateExistence'],
[['SUFFIX'], 'validateContain'],
[['SUFFIX'], 'in', 'range' => ['Xls','Xlsx','Csv'],'message'=>'不支持的后缀' ],
];
}
/**
......@@ -28,10 +28,4 @@ class DownTemplate extends Model
$this->addError($attribute, '文件不存在.');
}
}
public function validateContain($attribute)
{
if(!in_array($this->SUFFIX,['Xls','Xlsx','Csv'])){
$this->addError($attribute, '不支持的后缀.');
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment