diff --git a/app/Http/Controllers/Admin/CourseContentController.php b/app/Http/Controllers/Admin/CourseContentController.php index c16d5ab..261fa2a 100755 --- a/app/Http/Controllers/Admin/CourseContentController.php +++ b/app/Http/Controllers/Admin/CourseContentController.php @@ -146,12 +146,6 @@ class CourseContentController extends BaseController * @OA\Parameter(name="teacher_id", in="query", @OA\Schema(type="integer"), description="老师ID"), * @OA\Parameter(name="address", in="query", @OA\Schema(type="string"), description="地址"), * @OA\Parameter(name="theme", in="query", @OA\Schema(type="string"), description="主题"), - * @OA\Parameter(name="course_content_evaluation_title", in="query", @OA\Schema(type="string"), description="问卷标题"), - * @OA\Parameter(name="course_content_evaluation_desc", in="query", @OA\Schema(type="string"), description="问卷描述"), - * @OA\Parameter(name="course_content_evaluation_type_id", in="query", @OA\Schema(type="string"), description="问卷类型id"), - * @OA\Parameter(name="course_content_evaluation_start_time", in="query", @OA\Schema(type="string"), description="问卷开始时间"), - * @OA\Parameter(name="course_content_evaluation_end_time", in="query", @OA\Schema(type="string"), description="问卷结束时间"), - * @OA\Parameter(name="course_content_evaluation_status", in="query", @OA\Schema(type="string"), description="问卷状态0未发布1已发布"), * @OA\Response( * response=200, * description="操作成功" diff --git a/app/Http/Controllers/Admin/CourseContentEvaluationAskController.php b/app/Http/Controllers/Admin/CourseContentEvaluationAskController.php index e2755f3..7b45b63 100644 --- a/app/Http/Controllers/Admin/CourseContentEvaluationAskController.php +++ b/app/Http/Controllers/Admin/CourseContentEvaluationAskController.php @@ -92,14 +92,19 @@ class CourseContentEvaluationAskController extends BaseController * summary="保存", * description="", * @OA\Parameter(name="id", in="query", @OA\Schema(type="integer", format="int64"), required=true, description="课程内容评价字段ID(存在则更新,不存在则新增)"), - * @OA\Parameter(name="course_content_id", in="query", @OA\Schema(type="integer", format="int32"), required=true, description="课程排课ID"), - * @OA\Parameter(name="title", in="query", @OA\Schema(type="string"), required=true, description="标题"), - * @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=true, description="字段类型。单选radio,多选checkbox,问答text,评分number,日期date,日期时间datetime"), - * @OA\Parameter(name="key", in="query", @OA\Schema(type="string"), required=true, description="英文标识"), - * @OA\Parameter(name="remark", in="query", @OA\Schema(type="string"), required=false, description="备注"), - * @OA\Parameter(name="sort", in="query", @OA\Schema(type="integer", format="int32"), required=false, description="排序"), - * @OA\Parameter(name="options", in="query", @OA\Schema(type="string"), required=false, description="选项,以英文逗号分隔"), - * @OA\Parameter(name="allow_input", in="query", @OA\Schema(type="string"), required=false, description="是否支持自行输入0否1是"), + * @OA\Parameter(name="course_id", in="query", @OA\Schema(type="integer"), required=false, description="课程ID"), + * @OA\Parameter(name="course_content_id", in="query", @OA\Schema(type="integer"), required=false, description="课程排课ID"), + * @OA\Parameter(name="course_content_evaluation_id", in="query", @OA\Schema(type="integer"), required=false, description="评价问卷ID"), + * @OA\Parameter(name="name", in="query", @OA\Schema(type="string"), required=false, description="字段名字"), + * @OA\Parameter(name="field", in="query", @OA\Schema(type="string"), required=false, description="字段英文标识"), + * @OA\Parameter(name="edit_input", in="query", @OA\Schema(type="string", maxLength=50), required=false, description="编辑框类型"), + * @OA\Parameter(name="rule", in="query", @OA\Schema(type="string"), required=false, description="检测规则"), + * @OA\Parameter(name="sort", in="query", @OA\Schema(type="integer", default=1), required=false, description="排序"), + * @OA\Parameter(name="help", in="query", @OA\Schema(type="string"), required=false, description="帮助文字"), + * @OA\Parameter(name="select_item", in="query", @OA\Schema(type="object", format="json"), required=false, description="下拉框选项(JSON格式)"), + * @OA\Parameter(name="need_fill", in="query", @OA\Schema(type="boolean", default=0), required=false, description="是否需要填写(0: 否, 1: 是)"), + * @OA\Parameter(name="belong_user", in="query", @OA\Schema(type="boolean", default=0), required=false, description="是否属于用户信息(0: 否, 1: 是)"), + * @OA\Parameter(name="allow_input", in="query", @OA\Schema(type="boolean", default=0), required=false, description="是否支持自行录入(0: 否, 1: 是)"), * @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="认证token"), * @OA\Response( * response="200", diff --git a/app/Http/Controllers/Admin/CourseContentEvaluationsController.php b/app/Http/Controllers/Admin/CourseContentEvaluationsController.php new file mode 100644 index 0000000..cd6785f --- /dev/null +++ b/app/Http/Controllers/Admin/CourseContentEvaluationsController.php @@ -0,0 +1,135 @@ +all(); + $messages = [ + 'id.required' => 'Id必填', + ]; + $validator = Validator::make($all, [ + 'id' => 'required' + ], $messages); + if ($validator->fails()) { + return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]); + } + $detail = $this->model->find($all['id']); + return $this->success($detail); + } + + /** + * @OA\Post( + * path="/api/admin/course-content-evaluations/save", + * tags={"问卷管理"}, + * summary="保存", + * description="", + * @OA\Parameter(name="id", in="query", @OA\Schema(type="integer", format="int64"), required=true, description="课程内容评价字段ID(存在则更新,不存在则新增)"), + * @OA\Parameter(name="course_id", in="query", @OA\Schema(type="integer"), required=false, description="课程ID"), + * @OA\Parameter(name="course_content_id", in="query", @OA\Schema(type="integer"), required=false, description="课程内容ID"), + * @OA\Parameter(name="title", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷标题"), + * @OA\Parameter(name="desc", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷描述"), + * @OA\Parameter(name="type_id", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷类型ID"), + * @OA\Parameter(name="start_time", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷开始时间"), + * @OA\Parameter(name="end_time", in="query", @OA\Schema(type="string", maxLength=255), required=false, description="问卷截止时间"), + * @OA\Parameter(name="status", in="query", @OA\Schema(type="string", maxLength=255, default="0"), required=false, description="问卷状态(0未发布,1已发布)"), + * @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="认证token"), + * @OA\Response( + * response="200", + * description="操作成功" + * ) + * ) + */ + public function save() + { + return parent::save(); + } + + /** + * @OA\Get( + * path="/api/admin/course-content-evaluations/destroy", + * tags={"问卷管理"}, + * summary="删除", + * description="", + * @OA\Parameter(name="id", in="query", @OA\Schema(type="string"), required=true, description="id"), + * @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"), + * @OA\Response( + * response="200", + * description="暂无" + * ) + * ) + */ + public function destroy() + { + return parent::destroy(); + } + +} diff --git a/app/Models/CourseContentEvaluation.php b/app/Models/CourseContentEvaluation.php new file mode 100644 index 0000000..a46cdd7 --- /dev/null +++ b/app/Models/CourseContentEvaluation.php @@ -0,0 +1,8 @@ +id(); + $table->integer('admin_id')->nullable(); + $table->integer('department_id')->nullable(); + $table->integer('course_id')->nullable()->comment('课程id'); $table->integer('course_content_id')->nullable()->comment('课程排课id'); - // 字段名字 - $table->string('title')->nullable()->comment('标题'); - // 字段类型 - $table->string('type')->nullable()->comment('字段类型。单选radio,多选checkbox,问答text,评分number,日期date,日期时间datetime'); - // 英文标识 - $table->string('key')->nullable()->comment('英文标识'); - // 备注 - $table->string('remark')->nullable()->comment('备注'); - // 排序 - $table->integer('sort')->nullable()->comment('排序'); - // 选项 - $table->string('options')->nullable()->comment('选项'); + $table->integer('course_content_evaluation_id')->nullable()->comment('评价问卷id'); + $table->string('name')->nullable()->comment('字段名字'); + $table->string('field')->nullable()->comment('字段英文标识'); + $table->string('edit_input', 50)->comment('编辑框类型'); + $table->string('rule')->nullable()->comment('检测规则'); + $table->integer('sort')->default(1)->nullable()->comment('排序'); + $table->string('help')->nullable()->comment('帮助文字'); + $table->json('select_item')->nullable()->comment('下拉框选项'); + $table->boolean('need_fill')->default(0)->nullable()->comment('是否需要填写'); + $table->boolean('belong_user')->default(0)->nullable()->comment('是否属于用户信息'); // 是否支持自行录入 $table->boolean('allow_input')->nullable()->default(0)->comment('是否支持自行录入'); $table->timestamps(); diff --git a/database/migrations/2025_07_03_093224_create_course_content_evaluations_table.php b/database/migrations/2025_07_03_093224_create_course_content_evaluations_table.php index 03e3b1f..21a7903 100644 --- a/database/migrations/2025_07_03_093224_create_course_content_evaluations_table.php +++ b/database/migrations/2025_07_03_093224_create_course_content_evaluations_table.php @@ -14,6 +14,8 @@ return new class extends Migration { { Schema::create('course_content_evaluations', function (Blueprint $table) { $table->id(); + $table->string('course_id')->nullable()->comment('课程id'); + $table->string('course_content_id')->nullable()->comment('课程内容id'); $table->string('title')->nullable()->comment('问卷标题'); // 问卷描述 $table->string('desc')->nullable()->comment('问卷描述'); diff --git a/routes/api.php b/routes/api.php index 203651d..c414e85 100755 --- a/routes/api.php +++ b/routes/api.php @@ -180,6 +180,12 @@ Route::group(["namespace" => "Admin", "prefix" => "admin"], function () { Route::post('book/excel-show', [\App\Http\Controllers\Admin\BookController::class, "excelShow"]); Route::post('book/import', [\App\Http\Controllers\Admin\BookController::class, "import"]); + // 课程评价问卷 + Route::get('course-content-evaluations/index', [\App\Http\Controllers\Admin\CourseContentEvaluationsController::class, "index"]); + Route::get('course-content-evaluations/show', [\App\Http\Controllers\Admin\CourseContentEvaluationsController::class, "show"]); + Route::post('course-content-evaluations/save', [\App\Http\Controllers\Admin\CourseContentEvaluationsController::class, "save"]); + Route::get('course-content-evaluations/destroy', [\App\Http\Controllers\Admin\CourseContentEvaluationsController::class, "destroy"]); + // 课程评价设置 Route::get('course-content-evaluation-ask/index', [\App\Http\Controllers\Admin\CourseContentEvaluationAskController::class, "index"]); Route::get('course-content-evaluation-ask/show', [\App\Http\Controllers\Admin\CourseContentEvaluationAskController::class, "show"]);