From 0f23e993078a2c93b3cfdc3f2ae7bd1646c383fe Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Thu, 21 Aug 2025 14:12:51 +0800 Subject: [PATCH] update --- app/Console/Commands/AutoSchoolmate.php | 4 +++- app/Http/Controllers/Admin/TeacherController.php | 12 ++++++++++++ app/Http/Controllers/Admin/UserController.php | 6 +++--- app/Models/CourseContent.php | 5 +++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/AutoSchoolmate.php b/app/Console/Commands/AutoSchoolmate.php index f492c99..a2cfb21 100755 --- a/app/Console/Commands/AutoSchoolmate.php +++ b/app/Console/Commands/AutoSchoolmate.php @@ -52,7 +52,9 @@ class AutoSchoolmate extends Command // 获取报名通过的学员 $courseSigns = CourseSign::where('course_id', $course->id)->where('status', 1)->get(); // 用户设置成校友 - User::whereIn('id', $courseSigns->pluck('user_id'))->where('is_black',0)->update(['is_schoolmate' => 1]); + User::whereIn('id', $courseSigns->pluck('user_id')) + //->where('is_black',0) + ->update(['is_schoolmate' => 1]); } return $this->info('更新完成'); } diff --git a/app/Http/Controllers/Admin/TeacherController.php b/app/Http/Controllers/Admin/TeacherController.php index e50bce4..e82631c 100755 --- a/app/Http/Controllers/Admin/TeacherController.php +++ b/app/Http/Controllers/Admin/TeacherController.php @@ -32,6 +32,8 @@ class TeacherController extends BaseController * @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"), * @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"), * @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"), + * @OA\Parameter(name="theme", in="query", @OA\Schema(type="string"), required=false, description="主题"), + * @OA\Parameter(name="direction", in="query", @OA\Schema(type="string"), required=false, description="方向"), * @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"), * @OA\Response( * response="200", @@ -110,6 +112,16 @@ class TeacherController extends BaseController $filename = (new CustomForm())->getTableComment($tableName); return Excel::download(new BaseExport($export_fields, $list, $tableName), $filename . date('YmdHis') . '.xlsx'); } else { + if (isset($all['theme']) || isset($all['direction'])) { + $list = $list->whereHas('courseContents', function ($query) use ($all) { + if (isset($all['theme'])) { + $query->where('theme', $all['theme']); + } + if (isset($all['direction'])) { + $query->where('direction', $all['direction']); + } + }); + } // 输出 $list = $list->paginate($all['page_size'] ?? 20); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 340a866..28ba2a3 100755 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -654,9 +654,9 @@ class UserController extends BaseController if (isset($all['is_schoolmate'])) { $data['is_schoolmate'] = $all['is_schoolmate']; } - if (isset($all['is_black'])) { - $data['is_black'] = $all['is_black']; - } +// if (isset($all['is_black'])) { +// $data['is_black'] = $all['is_black']; +// } $this->model->whereIn('id', $idsArray)->update($data); return $this->success('批量更新成功'); } diff --git a/app/Models/CourseContent.php b/app/Models/CourseContent.php index c28bbe7..0619f2f 100755 --- a/app/Models/CourseContent.php +++ b/app/Models/CourseContent.php @@ -60,6 +60,11 @@ class CourseContent extends SoftDeletesModel return $this->hasOne(CourseContentEvaluation::class, 'course_content_id', 'id'); } + public function directionDetail() + { + return $this->hasOne(ParameterDetail::class, 'id', 'direction'); + } + /** * 获取课程详情小程序码 */