From 6d06bfbe380060575c45de70e2db0bde9736a82a Mon Sep 17 00:00:00 2001 From: Dai Date: Sat, 27 Jul 2024 14:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B6=E9=95=BF=E7=AB=AF=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/StudentFeedbackService.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/common/service/StudentFeedbackService.php b/app/common/service/StudentFeedbackService.php index 92266fe..e82aa68 100644 --- a/app/common/service/StudentFeedbackService.php +++ b/app/common/service/StudentFeedbackService.php @@ -19,12 +19,21 @@ class StudentFeedbackService public function feedback($request) { try { - if (empty($request->student)) { - throw new Exception('请登陆学生端后再试~'); + if (empty((array)$request->student) && empty((array)$request->parent)) { + throw new Exception('请登陆后再查看'); } - $student = Student::where(['id' => $request->student->id])->findOrEmpty(); - if ($student->isEmpty()) { - throw new Exception('未找到用户信息'); + if (!empty((array)$request->student)) { + $student = Student::where(['id' => $request->student->id])->findOrEmpty(); + if ($student->isEmpty()) { + throw new Exception('未找到用户信息'); + } + } + if (!empty((array)$request->parent)) { + $student = Student::where(['parent_id' => $request->parent->id])->findOrEmpty(); + if ($student->isEmpty()) { + throw new Exception('未找到用户信息'); + } + } $data = $request->post();