From 5e83c0b8f4ccff2e8e63b383389305ad67565453 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 14:32:35 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 2 +- app/helpers/exercises_helper.rb | 33 +++++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 6eaa22f01..c9aeba395 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1294,7 +1294,7 @@ class ExercisesController < ApplicationController def export_exercise @request_url = request.base_url @exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC") - filename_ = "#{@exercise.user.real_name}_#{@course.name}__#{Time.now.strftime('%Y%m%d_%H%M%S')}" + filename_ = "#{@exercise.user.real_name}_#{@course.name}__#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf" stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css" render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index dfb6e4237..b799fa40c 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -113,19 +113,26 @@ module ExercisesHelper if ex.question_type <= Exercise::JUDGMENT #选择题和判断题 standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置 right_users_count = 0 #该问题的回答正确的人数 - if ex.question_type == Exercise::MULTIPLE #多选题 - user_ids.each do |user_id| - answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).where(user_id:user_id)&.map {|s| s.exercise_choice.choice_position}.uniq - if answer_choice_array.sort == standard_answer - right_users_count += 1 - end - end - else #单选题和判断题 - user_ids.each do |user_id| - answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice&.choice_position - if [answer_choice_array] == standard_answer - right_users_count += 1 - end + # if ex.question_type == Exercise::MULTIPLE #多选题 + # user_ids.each do |user_id| + # answer_choice_array = ExerciseChoice.where(id:effictive_users.map{|e| e.exercise_choice_id if a.user_id == user_id}).pluck(:choice_position).uniq + # if answer_choice_array.sort == standard_answer + # right_users_count += 1 + # end + # end + # else #单选题和判断题 + # user_ids.each do |user_id| + # answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice&.choice_position + # if [answer_choice_array] == standard_answer + # right_users_count += 1 + # end + # end + # end + + user_ids.each do |user_id| + answer_choice_array = ExerciseChoice.where(id:effictive_users.map{|e| e.exercise_choice_id if a.user_id == user_id}).pluck(:choice_position).uniq + if answer_choice_array.sort == standard_answer + right_users_count += 1 end end From cf653740bacee97d228868632481a792a5585aa3 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 14:36:07 +0800 Subject: [PATCH 02/16] fix --- app/controllers/accounts_controller.rb | 1 - app/controllers/attachments_controller.rb | 1 - app/controllers/concerns/controller_rescue_handler.rb | 4 ++++ app/controllers/concerns/error_common.rb | 10 ---------- app/models/searchable/shixun.rb | 4 ++-- 5 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 app/controllers/concerns/error_common.rb diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 3020588e0..7159c2bca 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -1,6 +1,5 @@ class AccountsController < ApplicationController - include ErrorCommon #skip_before_action :check_account, :only => [:logout] def index diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index c539b0a60..5132e203c 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -5,7 +5,6 @@ class AttachmentsController < ApplicationController before_action :require_login, :check_auth before_action :find_file, only: %i[show destroy] - include ErrorCommon include ApplicationHelper def show diff --git a/app/controllers/concerns/controller_rescue_handler.rb b/app/controllers/concerns/controller_rescue_handler.rb index 31934db03..71e2e9178 100644 --- a/app/controllers/concerns/controller_rescue_handler.rb +++ b/app/controllers/concerns/controller_rescue_handler.rb @@ -15,5 +15,9 @@ module ControllerRescueHandler rescue_from ActiveRecord::RecordInvalid do |ex| render_error(ex.record.errors.full_messages.join(',')) end + rescue_from Exception do |e| + logger.error e + render json: {status: -1, message: e.message} + end end end \ No newline at end of file diff --git a/app/controllers/concerns/error_common.rb b/app/controllers/concerns/error_common.rb deleted file mode 100644 index 5a5f41673..000000000 --- a/app/controllers/concerns/error_common.rb +++ /dev/null @@ -1,10 +0,0 @@ -module ErrorCommon - extend ActiveSupport::Concern - - included do - rescue_from Exception do |e| - logger.error e - render json: {status: -1, message: e.message} - end - end -end \ No newline at end of file diff --git a/app/models/searchable/shixun.rb b/app/models/searchable/shixun.rb index e4108024c..7abd76ec6 100644 --- a/app/models/searchable/shixun.rb +++ b/app/models/searchable/shixun.rb @@ -21,8 +21,8 @@ module Searchable::Shixun def searchable_user_data { - author_name: user.real_name, - author_school_name: user.school_name, + author_name: user&.real_name, + author_school_name: user&.school_name, } end From 2f70b763b3fadf0d6b41161c812bf218b802761f Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 14:38:39 +0800 Subject: [PATCH 03/16] fix --- app/libs/util.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/libs/util.rb b/app/libs/util.rb index 7839b2304..6c7784606 100644 --- a/app/libs/util.rb +++ b/app/libs/util.rb @@ -39,6 +39,7 @@ module Util end def extract_content(str) + return '' if str.blank? str.gsub(/<\/?.*?>/, '').gsub(/[\n\t\r]/, '').gsub(/ /, '') end end \ No newline at end of file From 56f0a9bfb017d1684850fd8052156fe57434315e Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 14:39:20 +0800 Subject: [PATCH 04/16] fixbug --- app/controllers/exercises_controller.rb | 2 +- app/helpers/exercises_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index c9aeba395..6b2804716 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1294,7 +1294,7 @@ class ExercisesController < ApplicationController def export_exercise @request_url = request.base_url @exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC") - filename_ = "#{@exercise.user.real_name}_#{@course.name}__#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf" + filename_ = "#{@exercise.user.real_name}_#{@course.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf" stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css" render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index b799fa40c..61baac4be 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -130,7 +130,7 @@ module ExercisesHelper # end user_ids.each do |user_id| - answer_choice_array = ExerciseChoice.where(id:effictive_users.map{|e| e.exercise_choice_id if a.user_id == user_id}).pluck(:choice_position).uniq + answer_choice_array = ExerciseChoice.where(id:effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}).pluck(:choice_position).uniq if answer_choice_array.sort == standard_answer right_users_count += 1 end From 518b05ddb9aa1383d72410ef45a10075be25cb64 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 14:45:03 +0800 Subject: [PATCH 05/16] fix --- app/controllers/concerns/controller_rescue_handler.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/controller_rescue_handler.rb b/app/controllers/concerns/controller_rescue_handler.rb index 71e2e9178..bacd6a793 100644 --- a/app/controllers/concerns/controller_rescue_handler.rb +++ b/app/controllers/concerns/controller_rescue_handler.rb @@ -2,6 +2,10 @@ module ControllerRescueHandler extend ActiveSupport::Concern included do + rescue_from Exception do |e| + logger.error e + render json: {status: -1, message: e.message} + end # rescue_from ActionView::MissingTemplate, with: :object_not_found # rescue_from ActiveRecord::RecordNotFound, with: :object_not_found rescue_from Educoder::TipException, with: :tip_show @@ -15,9 +19,5 @@ module ControllerRescueHandler rescue_from ActiveRecord::RecordInvalid do |ex| render_error(ex.record.errors.full_messages.join(',')) end - rescue_from Exception do |e| - logger.error e - render json: {status: -1, message: e.message} - end end end \ No newline at end of file From 094a02163479010a0431b8ad1fe9449c44503543 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 14:49:31 +0800 Subject: [PATCH 06/16] fix tiding url --- app/views/users/get_navigation_info.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/get_navigation_info.json.jbuilder b/app/views/users/get_navigation_info.json.jbuilder index 6b04a121c..586ddbd7c 100644 --- a/app/views/users/get_navigation_info.json.jbuilder +++ b/app/views/users/get_navigation_info.json.jbuilder @@ -10,7 +10,7 @@ json.top do json.new_project_url "#{@old_domain}/projects/new" json.join_course_url "#{@old_domain}/courses/join_course_multi_role" json.join_project_url "#{@old_domain}/applied_project/applied_project_info" - json.message_url "#{@user_url}/user_tidings" + json.message_url "#{@old_domain}#{@user_url}/user_tidings" json.new_message @new_message json.career_url do From 5fcd1693c8815fcc23701016210b6ab5f07e8c18 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 15:02:24 +0800 Subject: [PATCH 07/16] modify --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fbb1fef12..1dceb8ebe 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -43,7 +43,7 @@ class ApplicationController < ActionController::Base # params[:type] 1: 注册;2:忘记密码 def check_mail_and_phone_valid login, type unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/ - tip_exception("请输入正确的手机号或邮箱") + tip_exception(-2, "请输入正确的手机号或邮箱") end # 考虑到安全参数问题,多一次查询,去掉Union user = User.where(phone: login).first || User.where(mail: login).first From 85512465508c070d0a1579853988e8d24851d976 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 15:07:46 +0800 Subject: [PATCH 08/16] fixbug --- app/controllers/exercises_controller.rb | 28 ++++++++++--------------- app/controllers/polls_controller.rb | 20 ++++++++---------- app/helpers/exercises_helper.rb | 19 ++--------------- 3 files changed, 22 insertions(+), 45 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 6b2804716..0bc7658c5 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -689,7 +689,7 @@ class ExercisesController < ApplicationController ActiveRecord::Base.transaction do begin check_ids = Exercise.where(id: params[:check_ids]) - ex_end_time = params[:end_time] || Time.at(((1.month.since.to_i)/3600.0).ceil * 3600) + ex_end_time = params[:end_time].to_time check_ids.each do |exercise| if exercise.present? if exercise.unified_setting @@ -701,20 +701,13 @@ class ExercisesController < ApplicationController if ex_status == 1 #如果试卷存在已发布的,或者是已截止的,那么则直接跳过 g_course = params[:group_ids] #表示是否传入分班参数,如果传入分班的参数,那么试卷的统一设置需修改 if g_course - # course_groups = @course.teacher_course_groups.get_user_groups(current_user.id) - # - # if course_groups.blank? - # user_course_groups = @course.course_groups.present? ? @course.course_groups.pluck(:id) : [] - # else - # user_course_groups = course_groups.pluck(:course_group_id).reject(&:blank?).uniq - # end user_course_groups = @course.charge_group_ids(current_user) - - if g_course.map(&:to_i).sort == user_course_groups.sort # 如果是设置为全部班级,则试卷不用分组,且试卷设定为统一设置,否则则分组设置 exercise.exercise_group_settings.destroy_all ex_unified = true + e_time = ex_end_time else + e_time = exercise.exercise_group_settings.end_time_no_null.map(&:end_time).max ex_unified = false g_course.each do |i| exercise_group_setting = exercise.exercise_group_settings.find_in_exercise_group("course_group_id",i).first #根据课堂分班的id,寻找试卷所在的班级 @@ -732,20 +725,21 @@ class ExercisesController < ApplicationController new_exercise_group.save end end - group_ids = params[:group_ids] end else exercise.exercise_group_settings.destroy_all ex_unified = true - end - if exercise.end_time.blank? e_time = ex_end_time - elsif exercise.exercise_group_settings.end_time_no_null.count > 0 # 该试卷分组有结束时间为空的 - e_time = exercise.exercise_group_settings.end_time_no_null.map(&:end_time).max - else - e_time = exercise.end_time end + # if exercise.end_time.blank? + # e_time = ex_end_time + # elsif exercise.exercise_group_settings.end_time_no_null.count > 0 # 该试卷分组有结束时间为空的 + # e_time = exercise.exercise_group_settings.end_time_no_null.map(&:end_time).max + # else + # e_time = ex_end_time + # end + ex_status = set_exercise_status(Time.now,e_time) exercise_params = { :publish_time => Time.now, diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 70995fbcf..469c0bd4d 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -258,15 +258,12 @@ class PollsController < ApplicationController g_course = params[:group_ids] #表示是否传入分班参数,如果传入分班的参数,那么poll的统一设置需修改 if g_course user_course_groups = @course.charge_group_ids(current_user) - # if course_groups.blank? - # user_course_groups = @course.course_groups.present? ? @course.course_groups.pluck(:id) : [] - # else - # user_course_groups = course_groups.pluck(:course_group_id) - # end if g_course.map(&:to_i).sort == user_course_groups.sort # 如果是设置为全部班级,则问卷不用分组,且问卷设定为统一设置,否则则分组设置 poll.poll_group_settings.destroy_all poll_unified = true + e_time = ex_end_time else + e_time = poll.poll_group_settings.end_time_present.map(&:end_time).max poll_unified = false g_course.each do |i| poll_group_setting = poll.poll_group_settings.find_in_poll_group("course_group_id",i).first #根据课堂分班的id,寻找问卷所在的班级 @@ -289,14 +286,15 @@ class PollsController < ApplicationController else poll.poll_group_settings.destroy_all poll_unified = true - end - if poll.end_time.blank? e_time = ex_end_time - elsif poll.poll_group_settings.end_time_present.count > 0 # 该问卷分组有结束时间为空的 - e_time = poll.poll_group_settings.end_time_present.map(&:end_time).max - else - e_time = poll.end_time end + # if poll.end_time.blank? + # e_time = ex_end_time + # elsif poll.poll_group_settings.end_time_present.count > 0 # 该问卷分组有结束时间为空的 + # e_time = poll.poll_group_settings.end_time_present.map(&:end_time).max + # else + # e_time = poll.end_time + # end poll_status = set_poll_status(Time.now,e_time) poll_params = { diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 61baac4be..b10dc128b 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -87,7 +87,7 @@ module ExercisesHelper def exercise_commit_result(questions,user_ids) question_infos = [] percent = 0.0 - questions.each do |ex| + questions.includes(:exercise_choices).each do |ex| ex_total_score = user_ids.count * ex&.question_score #该试卷的已回答的总分 ex_answers = ex.exercise_answers.includes(:exercise_choice) if ex.question_type != Exercise::PRACTICAL @@ -113,24 +113,9 @@ module ExercisesHelper if ex.question_type <= Exercise::JUDGMENT #选择题和判断题 standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置 right_users_count = 0 #该问题的回答正确的人数 - # if ex.question_type == Exercise::MULTIPLE #多选题 - # user_ids.each do |user_id| - # answer_choice_array = ExerciseChoice.where(id:effictive_users.map{|e| e.exercise_choice_id if a.user_id == user_id}).pluck(:choice_position).uniq - # if answer_choice_array.sort == standard_answer - # right_users_count += 1 - # end - # end - # else #单选题和判断题 - # user_ids.each do |user_id| - # answer_choice_array = effictive_users.select(:user_id,:exercise_choice_id).find_by(user_id:user_id)&.exercise_choice&.choice_position - # if [answer_choice_array] == standard_answer - # right_users_count += 1 - # end - # end - # end user_ids.each do |user_id| - answer_choice_array = ExerciseChoice.where(id:effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}).pluck(:choice_position).uniq + answer_choice_array = ex.exercise_choices.where(id:effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}).pluck(:choice_position).uniq if answer_choice_array.sort == standard_answer right_users_count += 1 end From 97229718991fbb9258a57083fea301c25be6941e Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 15:30:25 +0800 Subject: [PATCH 09/16] fixbug --- app/helpers/exercises_helper.rb | 10 ++++++---- app/models/game.rb | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index b10dc128b..32e5d1bfc 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -89,7 +89,7 @@ module ExercisesHelper percent = 0.0 questions.includes(:exercise_choices).each do |ex| ex_total_score = user_ids.count * ex&.question_score #该试卷的已回答的总分 - ex_answers = ex.exercise_answers.includes(:exercise_choice) + ex_answers = ex.exercise_answers if ex.question_type != Exercise::PRACTICAL ques_title = ex.question_title ques_less_title = nil @@ -111,18 +111,20 @@ module ExercisesHelper question_answer_infos = [] if ex.question_type <= Exercise::JUDGMENT #选择题和判断题 + ex_choices = ex.exercise_choices standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置 right_users_count = 0 #该问题的回答正确的人数 - user_ids.each do |user_id| - answer_choice_array = ex.exercise_choices.where(id:effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}).pluck(:choice_position).uniq + ex_choice_ids = effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}.reject(&:blank?).uniq + # answer_choice_array = ex_choices.where(id:ex_choice_ids).pluck(:choice_position) + answer_choice_array = ex_choices.map{|a| a.choice_position if ex_choice_ids.include?(a.id)}.reject(&:blank?).uniq if answer_choice_array.sort == standard_answer right_users_count += 1 end end percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0 - ex.exercise_choices.each do |c| + ex_choices.each do |c| right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置 answer_this_choice = effictive_users.search_exercise_answer("exercise_choice_id",c.id) answer_users_count = answer_this_choice.size diff --git a/app/models/game.rb b/app/models/game.rb index eed425ea6..002116748 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -31,7 +31,7 @@ class Game < ApplicationRecord # 根据得分比例来算实际得分(试卷、实训作业) def real_score score - final_score == challenge.score ? score : (final_score.to_f / challenge.score) * score + (final_score.to_f / challenge.all_score) * score end # 判断实训是否全部通关 From 4fd9279f79dad33a392778bc32242fd630c220bd Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 15:40:49 +0800 Subject: [PATCH 10/16] user account info completed change --- app/models/user.rb | 9 --------- app/views/users/accounts/show.json.jbuilder | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index fb1a47f2e..49a3e9090 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -544,15 +544,6 @@ class User < ApplicationRecord Educoder::Utils.random_hex(16) end - # 基本资料是否完善 - def base_info_completed? - user_columns = %i[nickname lastname] - user_extension_columns = %i[gender location location_city identity school_id department] - - user_columns.all? { |column| public_send(column).present? } && - user_extension_columns.all? { |column| user_extension.send(column).present? } - end - # 全部已认证 def all_certified? authentication? && professional_certification? diff --git a/app/views/users/accounts/show.json.jbuilder b/app/views/users/accounts/show.json.jbuilder index fca883ea0..6b28bda55 100644 --- a/app/views/users/accounts/show.json.jbuilder +++ b/app/views/users/accounts/show.json.jbuilder @@ -21,5 +21,5 @@ json.school_name extension&.school&.name json.department_id extension&.department_id json.department_name extension&.department&.name -json.base_info_completed user.base_info_completed? +json.base_info_completed user.profile_completed? json.all_certified user.all_certified? From 8fd8da2e8ca329378573bbaf911148c95e078d3b Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 16:00:56 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0ABCD..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 7 ------- .../exercise_questions/_exercise_questions.json.jbuilder | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 0bc7658c5..4319f2e4a 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -732,13 +732,6 @@ class ExercisesController < ApplicationController ex_unified = true e_time = ex_end_time end - # if exercise.end_time.blank? - # e_time = ex_end_time - # elsif exercise.exercise_group_settings.end_time_no_null.count > 0 # 该试卷分组有结束时间为空的 - # e_time = exercise.exercise_group_settings.end_time_no_null.map(&:end_time).max - # else - # e_time = ex_end_time - # end ex_status = set_exercise_status(Time.now,e_time) exercise_params = { diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index 4cdd97f3c..bfaf6b736 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -1,5 +1,4 @@ json.question_id question.id -# json.question_number question.question_number q_positon = question.question_number if ques_position.present? q_positon = ques_position @@ -22,7 +21,7 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选 user_answer_b = user_answer.include?(a.id) json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现 json.choice_id a.id - json.choice_text a.choice_text + json.choice_text "#{(index+65).chr}.#{a.choice_text}" json.choice_position a.choice_position if exercise_type == 1 || exercise_type == 4 #1为教师编辑/预览 试卷或问题,2为空白试卷,即标准答案和用户答案都不显示,3为用户开始答题的显示,4为老师评阅试卷或学生在截止后查看试卷 json.standard_boolean standard_answer_b From 98ea54de41236d53b984df22d2162f86b4778433 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 16:15:13 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E9=80=89=E6=8B=A9=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercises/exercise_result.json.jbuilder | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/exercises/exercise_result.json.jbuilder b/app/views/exercises/exercise_result.json.jbuilder index 7f2d871fc..38b03cccb 100644 --- a/app/views/exercises/exercise_result.json.jbuilder +++ b/app/views/exercises/exercise_result.json.jbuilder @@ -34,9 +34,16 @@ json.commit_results do json.effictive_counts q[:ques_effictive_counts] if q[:type] != Exercise::PRACTICAL json.ques_details do - json.array! q[:ques_details] do |d| + json.array! q[:ques_details].each_with_index.to_a do |d,index| + if q[:type] <= Exercise::MULTIPLE + ques_index = (index+65).chr + elsif q[:type] == Exercise::JUDGMENT + ques_index = (index+1).to_s + else + ques_index = "" + end json.choice_position d[:choice_position] - json.choice_text d[:choice_text] + json.choice_text "#{ques_index}.#{d[:choice_text]}" json.choice_users_count d[:choice_users_count] json.choice_percent d[:choice_percent] json.choice_right_boolean d[:right_answer] @@ -50,9 +57,9 @@ json.commit_results do json.challenge_position cha[:cha_position] json.challenge_percent cha[:cha_percent] json.challenge_details do - json.array! cha[:cha_details] do |ch| + json.array! cha[:cha_details].each_with_index.to_a do |ch,index| json.choice_position ch[:choice_position] - json.choice_text ch[:choice_text] + json.choice_text "#{(index+1).to_s}.#{ch[:choice_text]}" json.choice_users_count ch[:choice_users_count] json.choice_percent ch[:choice_percent] json.choice_right_boolean ch[:right_answer] From a2832d44a1a055cf2a9bea016715d854944c924f Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 16 Jul 2019 16:25:00 +0800 Subject: [PATCH 13/16] fixbug --- app/views/exercises/exercise_result.json.jbuilder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/exercises/exercise_result.json.jbuilder b/app/views/exercises/exercise_result.json.jbuilder index 38b03cccb..2c4b3ded7 100644 --- a/app/views/exercises/exercise_result.json.jbuilder +++ b/app/views/exercises/exercise_result.json.jbuilder @@ -40,10 +40,10 @@ json.commit_results do elsif q[:type] == Exercise::JUDGMENT ques_index = (index+1).to_s else - ques_index = "" + ques_index = nil end json.choice_position d[:choice_position] - json.choice_text "#{ques_index}.#{d[:choice_text]}" + json.choice_text ques_index.present? ? "#{ques_index}.#{d[:choice_text]}" : d[:choice_text] json.choice_users_count d[:choice_users_count] json.choice_percent d[:choice_percent] json.choice_right_boolean d[:right_answer] @@ -57,9 +57,9 @@ json.commit_results do json.challenge_position cha[:cha_position] json.challenge_percent cha[:cha_percent] json.challenge_details do - json.array! cha[:cha_details].each_with_index.to_a do |ch,index| + json.array! cha[:cha_details] do |ch| json.choice_position ch[:choice_position] - json.choice_text "#{(index+1).to_s}.#{ch[:choice_text]}" + json.choice_text ch[:choice_text] json.choice_users_count ch[:choice_users_count] json.choice_percent ch[:choice_percent] json.choice_right_boolean ch[:right_answer] From 7df20dfa797e882010fc61c532432aefa1dcae34 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 16:57:11 +0800 Subject: [PATCH 14/16] competition list, show, staff api --- app/controllers/application_controller.rb | 4 ++ .../competitions/base_controller.rb | 11 +++++ .../competition_staffs_controller.rb | 4 ++ .../competitions/competitions_controller.rb | 32 +++++++++++++++ app/controllers/concerns/paginate_helper.rb | 8 ++++ app/decorators/application_decorator.rb | 9 +++++ app/decorators/competition_decorator.rb | 6 +++ .../competition_stage_section_decorator.rb | 5 +++ app/models/competition.rb | 40 +++++++++++++++++++ app/models/competition_entry.rb | 4 ++ app/models/competition_module.rb | 7 ++++ app/models/competition_module_md_content.rb | 5 +++ app/models/competition_staff.rb | 3 ++ app/models/competition_stage.rb | 7 ++++ app/models/competition_stage_section.rb | 6 +++ app/models/competition_team.rb | 8 ++++ app/models/team_member.rb | 8 ++++ .../competition_staffs/show.json.jbuilder | 26 ++++++++++++ .../competitions/index.json.jbuilder | 29 ++++++++++++++ .../competitions/show.json.jbuilder | 36 +++++++++++++++++ config/routes.rb | 8 ++++ 21 files changed, 266 insertions(+) create mode 100644 app/controllers/competitions/base_controller.rb create mode 100644 app/controllers/competitions/competition_staffs_controller.rb create mode 100644 app/controllers/competitions/competitions_controller.rb create mode 100644 app/controllers/concerns/paginate_helper.rb create mode 100644 app/decorators/application_decorator.rb create mode 100644 app/decorators/competition_decorator.rb create mode 100644 app/decorators/competition_stage_section_decorator.rb create mode 100644 app/models/competition.rb create mode 100644 app/models/competition_entry.rb create mode 100644 app/models/competition_module.rb create mode 100644 app/models/competition_module_md_content.rb create mode 100644 app/models/competition_staff.rb create mode 100644 app/models/competition_stage.rb create mode 100644 app/models/competition_stage_section.rb create mode 100644 app/models/competition_team.rb create mode 100644 app/models/team_member.rb create mode 100644 app/views/competitions/competition_staffs/show.json.jbuilder create mode 100644 app/views/competitions/competitions/index.json.jbuilder create mode 100644 app/views/competitions/competitions/show.json.jbuilder diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1dceb8ebe..ee42ab8b5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,6 +30,10 @@ class ApplicationController < ActionController::Base end end + def admin_or_business? + User.current.admin? || User.current.business? + end + def user_course_identity @user_course_identity = current_user.course_identity(@course) if @user_course_identity > Course::STUDENT && @course.is_public == 0 diff --git a/app/controllers/competitions/base_controller.rb b/app/controllers/competitions/base_controller.rb new file mode 100644 index 000000000..127474ee7 --- /dev/null +++ b/app/controllers/competitions/base_controller.rb @@ -0,0 +1,11 @@ +class Competitions::BaseController < ApplicationController + include PaginateHelper + + before_action :require_login + + helper_method :current_competition + + def current_competition + @_current_competition ||= Competition.find_by!(identifier: params[:competition_id].presence || params[:id]) + end +end \ No newline at end of file diff --git a/app/controllers/competitions/competition_staffs_controller.rb b/app/controllers/competitions/competition_staffs_controller.rb new file mode 100644 index 000000000..39b91e57f --- /dev/null +++ b/app/controllers/competitions/competition_staffs_controller.rb @@ -0,0 +1,4 @@ +class Competitions::CompetitionStaffsController < Competitions::BaseController + def show + end +end diff --git a/app/controllers/competitions/competitions_controller.rb b/app/controllers/competitions/competitions_controller.rb new file mode 100644 index 000000000..f962682a1 --- /dev/null +++ b/app/controllers/competitions/competitions_controller.rb @@ -0,0 +1,32 @@ +class Competitions::CompetitionsController < Competitions::BaseController + skip_before_action :require_login + + def index + # 已上架 或者 即将上架 + competitions = Competition.where(status: true).or(Competition.where.not(published_at: nil)) + + competitions = + case params[:category] + when 'nearly_published' then competitions.where(status: false) + when 'progressing' then competitions.where('end_time > NOW()') + when 'ended' then competitions.where('end_time < NOW()') + else competitions + end + + @count = competitions.count + + competitions = competitions.order(published_at: :desc, online_time: :desc) + @competitions = paginate(competitions.includes(current_stage_section: :competition_stage)) + + ids = @competitions.map(&:id) + @member_count_map = TeamMember.where(competition_id: ids).group(:competition_id).count + @stage_count_map = CompetitionStage.where(competition_id: ids).group(:competition_id).count + end + + def show + unless current_competition.published? || admin_or_business? + render_forbidden + return + end + end +end \ No newline at end of file diff --git a/app/controllers/concerns/paginate_helper.rb b/app/controllers/concerns/paginate_helper.rb new file mode 100644 index 000000000..13148bf42 --- /dev/null +++ b/app/controllers/concerns/paginate_helper.rb @@ -0,0 +1,8 @@ +module PaginateHelper + def paginate(objs, **opts) + page = params[:page].to_i <= 0 ? 1 : params[:page].to_i + per_page = params[:per_page].to_i > 0 ? params[:per_page].to_i : 20 + + Kaminari.paginate_array(objs).page(page).per(per_page) + end +end \ No newline at end of file diff --git a/app/decorators/application_decorator.rb b/app/decorators/application_decorator.rb new file mode 100644 index 000000000..ccaf720e5 --- /dev/null +++ b/app/decorators/application_decorator.rb @@ -0,0 +1,9 @@ +module ApplicationDecorator + def display_time_method(*columns, format: '%Y-%m-%d %H:%M:%S') + columns.each do |column_name| + define_method "display_#{column_name}" do + public_send(column_name)&.strftime(format) + end + end + end +end \ No newline at end of file diff --git a/app/decorators/competition_decorator.rb b/app/decorators/competition_decorator.rb new file mode 100644 index 000000000..2be5b3ecb --- /dev/null +++ b/app/decorators/competition_decorator.rb @@ -0,0 +1,6 @@ +module CompetitionDecorator + extend ApplicationDecorator + + display_time_method :start_time, :end_time, :enroll_end_time + +end diff --git a/app/decorators/competition_stage_section_decorator.rb b/app/decorators/competition_stage_section_decorator.rb new file mode 100644 index 000000000..1196cb9ad --- /dev/null +++ b/app/decorators/competition_stage_section_decorator.rb @@ -0,0 +1,5 @@ +module CompetitionStageSectionDecorator + extend ApplicationDecorator + + display_time_method :start_time, :end_time +end \ No newline at end of file diff --git a/app/models/competition.rb b/app/models/competition.rb new file mode 100644 index 000000000..9a85bda58 --- /dev/null +++ b/app/models/competition.rb @@ -0,0 +1,40 @@ +class Competition < ApplicationRecord + + has_many :competition_modules, dependent: :destroy + has_many :competition_stages, dependent: :destroy + has_many :competition_stage_sections, dependent: :destroy + has_one :current_stage_section, -> { where('end_time > NOW()') }, class_name: 'CompetitionStageSection' + has_many :team_members, dependent: :destroy + has_many :competition_staffs, dependent: :destroy + has_one :teacher_staff, -> { where(category: :teacher) }, class_name: 'CompetitionStaff' + has_one :member_staff, -> { where.not(category: :teacher) }, class_name: 'CompetitionStaff' + + has_many :attachments, as: :container + + after_create :create_competition_modules + + # 是否上架 + def published? + status? + end + + # 报名是否结束 + def enroll_ended? + enroll_end_time.blank? || enroll_end_time < Time.now + end + + # 是否已经报名 + def enrolled?(user) + team_members.exists?(user_id: user.id) + end + + private + + def create_competition_modules + CompetitionModule.bulk_insert(*%i[competition_id name position]) do |worker| + %w(首页 报名 通知公告 排行榜 资料下载).each_with_index do |name, index| + worker.add(competition_id: id, name: name, position: index + 1) + end + end + end +end diff --git a/app/models/competition_entry.rb b/app/models/competition_entry.rb new file mode 100644 index 000000000..685faca24 --- /dev/null +++ b/app/models/competition_entry.rb @@ -0,0 +1,4 @@ +class CompetitionEntry < ApplicationRecord + belongs_to :competition_stage + belongs_to :competition_stage_section +end \ No newline at end of file diff --git a/app/models/competition_module.rb b/app/models/competition_module.rb new file mode 100644 index 000000000..be73bf3c1 --- /dev/null +++ b/app/models/competition_module.rb @@ -0,0 +1,7 @@ +class CompetitionModule < ApplicationRecord + default_scope { order('position ASC') } + + belongs_to :competition + + has_one :competition_module_md_content, dependent: :destroy +end diff --git a/app/models/competition_module_md_content.rb b/app/models/competition_module_md_content.rb new file mode 100644 index 000000000..cbf5a829a --- /dev/null +++ b/app/models/competition_module_md_content.rb @@ -0,0 +1,5 @@ +class CompetitionModuleMdContent < ApplicationRecord + belongs_to :competition_module + + has_many :attachments, as: :container, dependent: :destroy +end \ No newline at end of file diff --git a/app/models/competition_staff.rb b/app/models/competition_staff.rb new file mode 100644 index 000000000..2630a5d3d --- /dev/null +++ b/app/models/competition_staff.rb @@ -0,0 +1,3 @@ +class CompetitionStaff < ApplicationRecord + belongs_to :competition +end \ No newline at end of file diff --git a/app/models/competition_stage.rb b/app/models/competition_stage.rb new file mode 100644 index 000000000..60d4b1644 --- /dev/null +++ b/app/models/competition_stage.rb @@ -0,0 +1,7 @@ +class CompetitionStage < ApplicationRecord + belongs_to :competition + + has_many :competition_stage_sections, dependent: :destroy + has_many :competition_entries, dependent: :destroy + +end \ No newline at end of file diff --git a/app/models/competition_stage_section.rb b/app/models/competition_stage_section.rb new file mode 100644 index 000000000..027e7ec69 --- /dev/null +++ b/app/models/competition_stage_section.rb @@ -0,0 +1,6 @@ +class CompetitionStageSection < ApplicationRecord + belongs_to :competition + belongs_to :competition_stage + + has_many :competition_entries, dependent: :destroy +end \ No newline at end of file diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb new file mode 100644 index 000000000..aa19db3b0 --- /dev/null +++ b/app/models/competition_team.rb @@ -0,0 +1,8 @@ +class CompetitionTeam < ApplicationRecord + belongs_to :user + belongs_to :competition + + has_many :team_members, dependent: :destroy + has_many :members, -> { without_teachers }, class_name: 'TeamMember' + has_many :teachers, -> { only_teachers }, class_name: 'TeamMember' +end \ No newline at end of file diff --git a/app/models/team_member.rb b/app/models/team_member.rb new file mode 100644 index 000000000..3909325e8 --- /dev/null +++ b/app/models/team_member.rb @@ -0,0 +1,8 @@ +class TeamMember < ApplicationRecord + belongs_to :user + belongs_to :competition + belongs_to :competition_team + + scope :only_teachers, -> { where(is_teacher: true) } + scope :without_teachers, -> { where(is_teacher: false) } +end \ No newline at end of file diff --git a/app/views/competitions/competition_staffs/show.json.jbuilder b/app/views/competitions/competition_staffs/show.json.jbuilder new file mode 100644 index 000000000..2cba22d2f --- /dev/null +++ b/app/views/competitions/competition_staffs/show.json.jbuilder @@ -0,0 +1,26 @@ +competition = current_competition + +json.enroll_ended competition.enroll_ended? +json.enrolled competition.enrolled?(current_user) + +# 教师报名设置 +if competition.teacher_staff.present? + json.teacher_staff do + json.minimum competition.teacher_staff.minimum + json.maximum competition.teacher_staff.maximum + json.mutiple_limited competition.teacher_staff.mutiple_limited + end +else + json.teacher_staff nil +end + +# 教师报名设置 +if competition.member_staff.present? + json.member_staff do + json.minimum competition.member_staff.minimum + json.maximum competition.member_staff.maximum + json.mutiple_limited competition.member_staff.mutiple_limited + end +else + json.member_staff nil +end diff --git a/app/views/competitions/competitions/index.json.jbuilder b/app/views/competitions/competitions/index.json.jbuilder new file mode 100644 index 000000000..f0d70f69e --- /dev/null +++ b/app/views/competitions/competitions/index.json.jbuilder @@ -0,0 +1,29 @@ +json.count @count +json.competitions do + json.array! @competitions.each do |competition| + json.extract! competition, :id, :identifier, :name, :sub_title + + json.visits_count competition.visits + member_count = @member_count_map&.fetch(competition.id, 0) || competition.team_members.count + json.member_count member_count.zero? ? 268 : member_count + + json.image url_to_avatar(competition) + json.published competition.published? + json.nearly_published competition.published_at.present? + json.single_stage (@stage_count_map&.fetch(competition.id, 0) || competition.competition_stages.count) == 1 + + json.start_time competition.display_start_time + json.end_time competition.display_end_time + json.enroll_end_time competition.display_enroll_end_time + + section = competition.current_stage_section + if section + json.current_stage do + + json.name = section.competition_stage.name + json.start_time section.display_start_time + json.end_time section.display_end_time + end + end + end +end \ No newline at end of file diff --git a/app/views/competitions/competitions/show.json.jbuilder b/app/views/competitions/competitions/show.json.jbuilder new file mode 100644 index 000000000..18216ee92 --- /dev/null +++ b/app/views/competitions/competitions/show.json.jbuilder @@ -0,0 +1,36 @@ +competition = current_competition +json.extract! competition, :id, :name, :sub_title, :identifier + +json.start_time competition.display_start_time +json.end_time competition.display_end_time +json.enroll_end_time competition.display_enroll_end_time + +json.images do + json.array! competition.attachments, partial: 'attachments/attachment_simple', as: :attachment +end + +json.competition_stages do + stages = competition.competition_stages.includes(competition_stage_sections: :competition_entries) + json.array! stages.each do |stage| + json.extract! stage, :id, :name + + json.sections do + json.array! stage.competition_stage_sections.each do |section| + json.extract! section, :id, :name + + decorator_section = ActiveDecorator::Decorator.instance.decorate(section) + json.start_time decorator_section.display_start_time + json.end_time decorator_section.display_end_time + + is_start = section.start_time > Time.now + json.entries do + json.array! section.competition_entries.each do |entry| + json.extract! entry, :id, :name + + json.url is_start ? entry.url : '' + end + end + end + end + end +end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 676954600..90872faa8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -668,6 +668,14 @@ Rails.application.routes.draw do end resources :repertoires, only: [:index] + + scope module: :competitions do + resources :competitions, only: [:index, :show] do + resources :competition_modules, only: [:index, :show] + resource :competition_staff + resources :competition_teams, only: [:index, :show] + end + end end #git 认证回调 From 9cf393acb08588a671aa07fa16ffda4f4f3c2db1 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 17:24:39 +0800 Subject: [PATCH 15/16] update user info api add professional logical && fix bug --- app/models/apply_user_authentication.rb | 1 + app/models/user.rb | 2 +- app/services/users/update_account_service.rb | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/apply_user_authentication.rb b/app/models/apply_user_authentication.rb index 3907c3f16..c7fb5019e 100644 --- a/app/models/apply_user_authentication.rb +++ b/app/models/apply_user_authentication.rb @@ -6,4 +6,5 @@ class ApplyUserAuthentication < ApplicationRecord scope :real_name_auth, -> { where(auth_type: 1) } scope :professional_auth, -> { where(auth_type: 2) } scope :processing, -> { where(status: 0) } + scope :passed, -> { where(status: 1) } end diff --git a/app/models/user.rb b/app/models/user.rb index 49a3e9090..d089c49c3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -58,7 +58,7 @@ class User < ApplicationRecord has_many :tidings, :dependent => :destroy has_many :games, :dependent => :destroy - has_many :created_subjects + has_many :created_subjects, foreign_key: :user_id, class_name: 'Subject' has_many :subjects, :through => :subject_members has_many :subject_members, :dependent => :destroy has_many :grades, :dependent => :destroy diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index 6a8588dee..d603cec8c 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -35,6 +35,13 @@ class Users::UpdateAccountService < ApplicationService extension.technical_title = params[:technical_title] end + # 职业、学校变动需要重新进行职业认证 + if extension.identity_changed? || extension.school_id_changed? + user.professional_certification = false + # 撤销之前的职业认证 + user.apply_user_authentication.professional_auth.passed.update_all(status: 3) + end + # 表示资料完整 user.profile_completed = true From 718320c8d4897113af0da956b4782d45a024eba3 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 16 Jul 2019 17:31:03 +0800 Subject: [PATCH 16/16] modify --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ee42ab8b5..4bc3d5133 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -54,7 +54,7 @@ class ApplicationController < ActionController::Base if type.to_i == 1 && !user.nil? tip_exception(-2, "该手机号码或邮箱已被注册") elsif type.to_i == 2 && user.nil? - tip_exception("该手机号码或邮箱未注册") + tip_exception(-2, "该手机号码或邮箱未注册") end sucess_status end