Commit 0e8a12b6 authored by 王源's avatar 王源 🎧

修改excel导入空判断和数值判断逻辑

parent 9caba02c
...@@ -121,14 +121,15 @@ class ExcelImporter ...@@ -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;
} }
/** /**
...@@ -142,9 +143,10 @@ class ExcelImporter ...@@ -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;
} }
/** /**
......
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