diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1bc2bad7d..f04d126f4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -45,6 +45,13 @@ class ApplicationController < ActionController::Base check_account tip_exception(@course.excellent ? 410 : 409, "您没有权限进入") end + if @user_course_identity == Course::STUDENT + # 实名认证和职业认证的身份判断 + tip_exception(-2, "你的实名认证和职业认证审核未通过") if @course.authentication && + @course.professional_certification && (!current_user.authentication && !current_user.professional_certification) + tip_exception(-2, "你的实名认证审核未通过") if @course.authentication && !current_user.authentication + tip_exception(-2, "你的职业认证审核未通过") if @course.professional_certification && !current_user.professional_certification + end uid_logger("###############user_course_identity:#{@user_course_identity}") end diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index fcbecec0d..9602673e5 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -136,7 +136,9 @@ class HackUserLastestCodesController < ApplicationController if @my_hack.hack_user_debug.present? @my_hack.hack_user_debug.update_attributes!(debug_params) else - @my_hack.hack_user_debug.create!(debug_params) + debug = HackUserDebug.new(debug_params) + debug.hack_user_lastest_code_id = @my_hack.id + debug.save! end end diff --git a/app/services/admins/identity_auths/refuse_apply_service.rb b/app/services/admins/identity_auths/refuse_apply_service.rb index 7ac2e6c38..dfc9168a9 100644 --- a/app/services/admins/identity_auths/refuse_apply_service.rb +++ b/app/services/admins/identity_auths/refuse_apply_service.rb @@ -10,6 +10,7 @@ class Admins::IdentityAuths::RefuseApplyService < ApplicationService def call ActiveRecord::Base.transaction do apply.update!(status: 2, remarks: reason) + user.update!(authentication: false) deal_tiding! apply.attachment&.destroy diff --git a/app/services/admins/professional_auths/refuse_apply_service.rb b/app/services/admins/professional_auths/refuse_apply_service.rb index a055488c3..014fbab0b 100644 --- a/app/services/admins/professional_auths/refuse_apply_service.rb +++ b/app/services/admins/professional_auths/refuse_apply_service.rb @@ -10,6 +10,7 @@ class Admins::ProfessionalAuths::RefuseApplyService < ApplicationService def call ActiveRecord::Base.transaction do apply.update!(status: 2, remarks: reason) + user.update!(professional_certification: false) deal_tiding! apply.attachment&.destroy diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index 1b9b02c91..b4aa8f496 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -18,7 +18,7 @@ class Users::ApplyAuthenticationService < ApplicationService user.show_realname = params[:show_realname].to_s == 'true' if params[:show_realname].to_s.present? ActiveRecord::Base.transaction do - user.authentication = false + user.authentication = true user.save! user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present? diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index 81cd11a4c..074f1cee7 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -14,13 +14,13 @@ class Users::ApplyProfessionalAuthService < ApplicationService Users::ApplyProfessionalAuthForm.new(params).validate! raise Error, '您已经申请过职业认证了' if ApplyUserAuthentication.professional_auth.processing.exists?(user_id: user.id) - user.professional_certification = false - extension = user.user_extension extension.school_id = params[:school_id] extension.department_id = params[:department_id] extension.identity = params[:identity] + user.professional_certification = extension.identity != 0 + extra = params[:extra].to_s.strip.presence if extension.identity.to_s == 'student' extension.technical_title = nil diff --git a/app/views/courses/apply_teachers.json.jbuilder b/app/views/courses/apply_teachers.json.jbuilder index bd88d5fbe..b81f5d77b 100644 --- a/app/views/courses/apply_teachers.json.jbuilder +++ b/app/views/courses/apply_teachers.json.jbuilder @@ -9,6 +9,7 @@ json.application_list do json.name_link user_path(application.application_user) json.login application.application_user.login json.image_url url_to_avatar(application.application_user) + json.school_name application.application_user.school_name json.role application.content.to_i == 3 || application.content.to_i == 7 ? "助教" : application.content.to_i == 2 || application.content.to_i == 9 ? "教师" : "" end end \ No newline at end of file diff --git a/db/migrate/20191120123353_add_code_forhack_user_debugs.rb b/db/migrate/20191120123353_add_code_forhack_user_debugs.rb new file mode 100644 index 000000000..d3285f26b --- /dev/null +++ b/db/migrate/20191120123353_add_code_forhack_user_debugs.rb @@ -0,0 +1,5 @@ +class AddCodeForhackUserDebugs < ActiveRecord::Migration[5.2] + def change + add_column :hack_user_debugs, :code, :text + end +end diff --git a/db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb b/db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb new file mode 100644 index 000000000..c66e13a03 --- /dev/null +++ b/db/migrate/20191121025552_modify_execute_time_for_hack_user_code.rb @@ -0,0 +1,6 @@ +class ModifyExecuteTimeForHackUserCode < ActiveRecord::Migration[5.2] + def change + change_column :hack_user_debugs, :execute_time, :float + change_column :hack_user_codes, :execute_time, :float + end +end