|
@@ -107,13 +107,17 @@ class TalentAllowance extends EnterpriseController {
|
|
return \StrUtil::back(new Response(Response::ERROR, "没有上传批量申请文档"), "TalentAllowanceInfo.importCallBack");
|
|
return \StrUtil::back(new Response(Response::ERROR, "没有上传批量申请文档"), "TalentAllowanceInfo.importCallBack");
|
|
}
|
|
}
|
|
if (!isExcelFile($tmp->getMime())) {
|
|
if (!isExcelFile($tmp->getMime())) {
|
|
- return \StrUtil::back(new Response(Response::ERROR, "只能识别Excel文档"), "TalentAllowanceInfo.importCallBack");
|
|
|
|
|
|
+ //return \StrUtil::back(new Response(Response::ERROR, "只能识别Excel文档"), "TalentAllowanceInfo.importCallBack");
|
|
}
|
|
}
|
|
if (round($tmp->getSize() / 1024 / 1024, 2) > $maxFileSize) {
|
|
if (round($tmp->getSize() / 1024 / 1024, 2) > $maxFileSize) {
|
|
return \StrUtil::back(new Response(Response::ERROR, "文档大小不能超过10MB"), "TalentAllowanceInfo.importCallBack");
|
|
return \StrUtil::back(new Response(Response::ERROR, "文档大小不能超过10MB"), "TalentAllowanceInfo.importCallBack");
|
|
}
|
|
}
|
|
$filepath = $tmp->getPathname();
|
|
$filepath = $tmp->getPathname();
|
|
- $rows = getExcelDatas($filepath);
|
|
|
|
|
|
+ try {
|
|
|
|
+ $rows = getExcelDatas($filepath);
|
|
|
|
+ } catch (\PhpOffice\PhpSpreadsheet\Exception $e) {
|
|
|
|
+ return \StrUtil::back(new Response(Response::ERROR, "文件识别错误!"), "TalentAllowanceInfo.importCallBack");
|
|
|
|
+ }
|
|
array_shift($rows); //去标题行
|
|
array_shift($rows); //去标题行
|
|
//检查excel文件有没有问题
|
|
//检查excel文件有没有问题
|
|
$checkMonths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
$checkMonths = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|