Loading src/Tools/ExcelImporter.php +6 −4 Original line number Original line Diff line number Diff line Loading @@ -121,14 +121,15 @@ class ExcelImporter * @param $errorCount * @param $errorCount * @throws \PhpOffice\PhpSpreadsheet\Exception * @throws \PhpOffice\PhpSpreadsheet\Exception */ */ public function checkRequire($requires, $errorCount) public function checkRequire($requires, &$errorCount) { { foreach ($requires as $k => $v) { foreach ($requires as $k => $v) { if ($v === '') { if (!$v || $v === '') { $this->setErrorMessage($k . "不能为空", $errorCount); $this->setErrorMessage($k . "不能为空", $errorCount); continue; return false; } } } } return true; } } /** /** Loading @@ -142,9 +143,10 @@ class ExcelImporter foreach ($data as $k => $v) { foreach ($data as $k => $v) { if (!is_numeric($v)) { if (!is_numeric($v)) { $this->setErrorMessage("{$k}只能是数字", $errorCount); $this->setErrorMessage("{$k}只能是数字", $errorCount); continue; return false; } } } } return true; } } /** /** Loading Loading
src/Tools/ExcelImporter.php +6 −4 Original line number Original line Diff line number Diff line Loading @@ -121,14 +121,15 @@ class ExcelImporter * @param $errorCount * @param $errorCount * @throws \PhpOffice\PhpSpreadsheet\Exception * @throws \PhpOffice\PhpSpreadsheet\Exception */ */ public function checkRequire($requires, $errorCount) public function checkRequire($requires, &$errorCount) { { foreach ($requires as $k => $v) { foreach ($requires as $k => $v) { if ($v === '') { if (!$v || $v === '') { $this->setErrorMessage($k . "不能为空", $errorCount); $this->setErrorMessage($k . "不能为空", $errorCount); continue; return false; } } } } return true; } } /** /** Loading @@ -142,9 +143,10 @@ class ExcelImporter foreach ($data as $k => $v) { foreach ($data as $k => $v) { if (!is_numeric($v)) { if (!is_numeric($v)) { $this->setErrorMessage("{$k}只能是数字", $errorCount); $this->setErrorMessage("{$k}只能是数字", $errorCount); continue; return false; } } } } return true; } } /** /** Loading