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.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							890 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							890 B
						
					
					
				# 学生加入课堂 消息通知
 | 
						|
class StudentJoinCourseNotifyJob < ApplicationJob
 | 
						|
  queue_as :notify
 | 
						|
 | 
						|
  def perform(student_id, course_id)
 | 
						|
    student = User.find_by(id: student_id)
 | 
						|
    course = Course.find_by(id: course_id)
 | 
						|
    return if student.blank? || course.blank?
 | 
						|
 | 
						|
    attrs = %i[user_id trigger_user_id status container_id container_type belong_container_id
 | 
						|
              belong_container_type tiding_type created_at updated_at]
 | 
						|
 | 
						|
    same_attrs = {
 | 
						|
      trigger_user_id: student.id, container_id: course.id, container_type: 'StudentJoinCourse',
 | 
						|
      belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'System', status: 0
 | 
						|
    }
 | 
						|
    Tiding.bulk_insert(*attrs) do |worker|
 | 
						|
      course.teachers_without_assistant_professor.each do |teacher|
 | 
						|
        worker.add same_attrs.merge(user_id: teacher.user_id)
 | 
						|
      end
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |