From 16c53510ce2cb9cbc8fcc1c25b04dbd0fcf91d04 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 22 Aug 2019 18:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=88=A0=E9=99=A4=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 1 + app/controllers/courses_controller.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 57eed15fd..5303b487c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -108,6 +108,7 @@ class ApplicationController < ActionController::Base def find_course return normal_status(2, '缺少course_id参数!') if params[:course_id].blank? @course = Course.find(params[:course_id]) + tip_exception(404, "") if @course.is_delete == 1 && !current_user.admin? rescue Exception => e tip_exception(e.message) end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 6194b7b41..af235c4c9 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1178,6 +1178,7 @@ class CoursesController < ApplicationController # Use callbacks to share common setup or constraints between actions. def set_course @course = Course.find_by!(id: params[:id]) + tip_exception(404, "") if @course.is_delete == 1 && !current_user.admin? end # Never trust parameters from the scary internet, only allow the white list through.