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();