加入课堂时增加课程是否已结束的判断

dev_oauth
cxt 6 years ago
parent c6066ec5bd
commit 00e2eb4017

@ -906,15 +906,17 @@ class CoursesController < ApplicationController
# 邀请码验证 # 邀请码验证
return normal_status(-1, "邀请码不能为空") if params[:invite_code].blank? return normal_status(-1, "邀请码不能为空") if params[:invite_code].blank?
invite_code = params[:invite_code] invite_code = params[:invite_code]
course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0, is_end: 0) course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0)
course_group = CourseGroup.find_by(invite_code: invite_code) course_group = CourseGroup.find_by(invite_code: invite_code)
if course.blank? if course.blank?
return normal_status(-1, "邀请码无效") if course_group.blank? return normal_status(-1, "邀请码无效") if course_group.blank?
course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0, is_end: 0) course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0)
return normal_status(-1, "邀请码无效") if course.blank? return normal_status(-1, "邀请码无效") if course.blank?
end end
return normal_status(-1, "课堂已结束,无法加入") if course.is_end
# 实名认证和职业认证的身份判断 # 实名认证和职业认证的身份判断
return normal_status(-1, "该课堂要求成员完成实名和职业认证") if course.authentication && return normal_status(-1, "该课堂要求成员完成实名和职业认证") if course.authentication &&
course.professional_certification && (!current_user.authentication || !current_user.professional_certification) course.professional_certification && (!current_user.authentication || !current_user.professional_certification)

Loading…
Cancel
Save