Pārlūkot izejas kodu

对批量导入申请津补贴文件的判断进行调整

sugangqiang 1 gadu atpakaļ
vecāks
revīzija
bbe830d61f
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6 2
      app/enterprise/controller/TalentAllowance.php

+ 6 - 2
app/enterprise/controller/TalentAllowance.php

@@ -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];