|
@@ -15,6 +15,7 @@ use App\Models\Setting;
|
|
use App\Models\Student;
|
|
use App\Models\Student;
|
|
use App\Models\StudentCourse;
|
|
use App\Models\StudentCourse;
|
|
use App\Models\StudentCourseTeacher;
|
|
use App\Models\StudentCourseTeacher;
|
|
|
|
+use App\Models\Teacher;
|
|
use App\Models\WeChatUser;
|
|
use App\Models\WeChatUser;
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
use EasyWeChat\Factory;
|
|
use EasyWeChat\Factory;
|
|
@@ -448,8 +449,21 @@ class ApiController extends Controller
|
|
|
|
|
|
public function getRemarkTitles(Request $request)
|
|
public function getRemarkTitles(Request $request)
|
|
{
|
|
{
|
|
|
|
+ if(empty($request->input('id')) || empty($student = Student::find($request->input('id')))) {
|
|
|
|
+ return response()->json(['status' => 'fail', 'info' => '找不到学员']);
|
|
|
|
+ }
|
|
|
|
+ if(empty($student_course = StudentCourse::where('student_id', $student->id)->first())) {
|
|
|
|
+ return response()->json(['status' => 'fail', 'info' => '找不到课程']);
|
|
|
|
+ }
|
|
|
|
+ if($student_course->assign_teacher == 1) {
|
|
|
|
+ $teachers = Teacher::all();
|
|
|
|
+ } else {
|
|
|
|
+ $teacher_ids = StudentCourseTeacher::where('student_course', $student_course->id)->get()->pluck('teacher_id')->unique('teacher_id');
|
|
|
|
+ $teachers = Teacher::whereIn('id', $teacher_ids)->get();
|
|
|
|
+ }
|
|
$titles = RemarkTitle::where('status', 2)->get();
|
|
$titles = RemarkTitle::where('status', 2)->get();
|
|
- return response()->json(['status' => 'success', 'titles' => $titles]);
|
|
|
|
|
|
+
|
|
|
|
+ return response()->json(['status' => 'success', 'titles' => $titles, 'teachers' => $teachers]);
|
|
}
|
|
}
|
|
|
|
|
|
public function remarkTeacher(Request $request)
|
|
public function remarkTeacher(Request $request)
|