You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
class Weapps::CourseStickiesController < Weapps::BaseController
|
|
|
|
# before_action :require_wechat_login!
|
|
|
|
before_action :teacher_allowed
|
|
|
|
|
|
|
|
def create
|
|
|
|
manage_course = current_user.manage_courses.order("sticky=1 desc, sticky_time desc, created_at desc").first
|
|
|
|
render_error("该课堂已置顶,请勿重复操作") if current_course.sticky && manage_course&.id.to_i == current_course.id
|
|
|
|
current_course.update_attributes!(sticky: 1, sticky_time: Time.now)
|
|
|
|
render_ok
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def current_course
|
|
|
|
@_current_course = Course.find params[:course_id]
|
|
|
|
end
|
|
|
|
|
|
|
|
def teacher_allowed
|
|
|
|
render_forbidden if current_user.course_identity(current_course) > Course::ASSISTANT_PROFESSOR
|
|
|
|
end
|
|
|
|
end
|