Browse Source

fixbug:修改异常为抛出

yb 2 months ago
parent
commit
258150106b
1 changed files with 8 additions and 8 deletions
  1. 8 8
      app/admin/service/consultant/CustomService.php

+ 8 - 8
app/admin/service/consultant/CustomService.php

@@ -1216,19 +1216,19 @@ class CustomService
                         if ($val[3] == 1) {$level = 1;} else if ($val[4] == 1) {$level = 2;} else if ($val[5] == 1) {$level = 3;} else if ($val[6] == 1) {$level = 4;}
                         $line = '第'.($key + 2).'行:';
                         if (empty($val[7]) && empty($val[8])) {
-                            return json_fail($line.'报备人和顾问必须存在其中之一');
+                            throw new \Exception($line.'报备人和顾问必须存在其中之一');
                         }
                         if (empty($val[9])) {
-                            return json_fail($line.'无团队信息');
+                            throw new \Exception($line.'无团队信息');
                         }
                         if ($val[0] == '1970-01-01 08:00:00') {
-                            return json_fail($line.'日期格式错误');
+                            throw new \Exception($line.'日期格式错误');
                         }
                         if (empty($val[2])) {
-                            return json_fail($line.'手机号不能为空');
+                            throw new \Exception($line.'手机号不能为空');
                         }
                         if (!preg_match($validate, $val[2])) {
-                            return json_fail($line.'手机号格式非法');
+                            throw new \Exception($line.'手机号格式非法');
                         }
                         $consultantName = $val[7];
                         $reportName = $val[8];
@@ -1238,7 +1238,7 @@ class CustomService
                         $reportKey = $reportName.'-'.$teamName;
                         $reportConsultantId = $teamKeys[$reportKey]['consultant_id'] ?? 0;
                         if ($consultantId <= 0 && $reportConsultantId <= 0) {
-                            return json_fail($line.'健康顾问或报备人都不存在');
+                            throw new \Exception($line.'健康顾问或报备人都不存在');
                         }
                         if ($consultantId > 0) {
                             $deptId = $teamKeys[$consultantKey]['dept_id'] ?? 0;
@@ -1251,10 +1251,10 @@ class CustomService
                             }
                         }
                         if (empty($deptId)) {
-                            return json_fail($line.'团队不存在');
+                            throw new \Exception($line.'团队不存在');
                         }
                         if (MarketCustomer::checkCustomExists($val[2])) {
-                            return json_fail($line.'客户已转到访,无法二次录入');
+                            throw new \Exception($line.'客户已转到访,无法二次录入');
                         }
                         //查看手机号是否存在
                         $insertData = [