|
|
|
@ -914,7 +914,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
teacher_already_exist = current_user.teacher_of_course_non_active? course
|
|
|
|
|
unless teacher_already_exist
|
|
|
|
|
existing_course_message = CourseMessage.find_by(course_id: course.id, course_message_id: current_user.id,
|
|
|
|
|
course_message_type: "JoinCourseRequest", status: 0, viewed: false)
|
|
|
|
|
course_message_type: "JoinCourseRequest", status: 0)
|
|
|
|
|
if existing_course_message.blank?
|
|
|
|
|
course_message = CourseMessage.new(course_id: course.id, user_id: course.tea_id, status: 0,
|
|
|
|
|
course_message_id: current_user.id, course_message_type: "JoinCourseRequest",
|
|
|
|
@ -928,6 +928,8 @@ class CoursesController < ApplicationController
|
|
|
|
|
ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role)
|
|
|
|
|
teacher_role = 1
|
|
|
|
|
message = "#{course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核"
|
|
|
|
|
else
|
|
|
|
|
message = "#{existing_course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -941,7 +943,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
rescue => e
|
|
|
|
|
uid_logger(e.message)
|
|
|
|
|
tip_exception("加入课堂失败")
|
|
|
|
|
tip_exception(e.message)
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|