From 21b8b3de95ee3c9771e2947e48ad5fabdb50cb1e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 14:04:13 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cf7ac6d2e..9fd7dc0b5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -319,6 +319,7 @@ class ApplicationController < ActionController::Base # 通关后,把最后一次成功的代码存到数据库 # type 0 创始内容, 1 最新内容 def game_passed_code(path, myshixun, game_id) + return if myshixun.shixun.hide_code file_content = git_fle_content myshixun.repo_path, path unless file_content.present? raise("获取文件代码异常") From b23704a9660043ade4a4073c706cbc65ca9764c9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 14:08:07 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/department.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/models/department.rb b/app/models/department.rb index bf5c3a90e..c019862db 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -3,8 +3,7 @@ class Department < ApplicationRecord has_many :department_members, dependent: :destroy - after_create_commit :reset_data_cache - after_update_commit :reset_data_cache + after_commit :reset_data_cache def self.cached_names_data(school) Rails.cache.fetch(names_data_cache_key(school.id), expires_in: 7.days) do @@ -16,9 +15,7 @@ class Department < ApplicationRecord def reset_data_cache # 清除部门名称缓存 - if new_record? || name_previously_changed? - Rails.cache.delete(self.class.names_data_cache_key(school_id)) - end + Rails.cache.delete(self.class.names_data_cache_key(school_id)) end def self.names_data_cache_key(school_id) From 3ad752994112c4903b8d9a75c885515b136b280b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 14:25:00 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 0a19f1c08..112b3352a 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -90,6 +90,7 @@ class MyshixunsController < ApplicationController # params[:pics] = "a.png,b.png,c.png" def training_task_status + logger.info("##################training_task_status_start#{jsonTestDetails['buildID']}") ActiveRecord::Base.transaction do begin t1 = Time.now From 88e839b48d754378b202482cf16c8785e75f0607 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 14:28:18 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/departments_controller.rb | 2 +- app/controllers/repertoires_controller.rb | 2 +- app/controllers/schools_controller.rb | 2 +- app/models/department.rb | 19 ------------------- app/models/repertoire.rb | 19 ------------------- app/models/school.rb | 22 ---------------------- 6 files changed, 3 insertions(+), 63 deletions(-) diff --git a/app/controllers/departments_controller.rb b/app/controllers/departments_controller.rb index f0fa8fe2c..b6ebcb2ef 100644 --- a/app/controllers/departments_controller.rb +++ b/app/controllers/departments_controller.rb @@ -1,6 +1,6 @@ class DepartmentsController < ApplicationController def for_option - render_ok(departments: Department.cached_names_data(current_school)) + render_ok(departments: current_school.departments.select(:id, :name).as_json) end private diff --git a/app/controllers/repertoires_controller.rb b/app/controllers/repertoires_controller.rb index 0ac78a15b..b62c94403 100644 --- a/app/controllers/repertoires_controller.rb +++ b/app/controllers/repertoires_controller.rb @@ -1,5 +1,5 @@ class RepertoiresController < ApplicationController def index - render_ok(repertoires: Repertoire.cache_data) + render_ok(repertoires: Repertoire.select(:id, :name).order(:created_at).as_json) end end \ No newline at end of file diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index ea94f4c69..f0dd6dd75 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -11,6 +11,6 @@ class SchoolsController < ApplicationController end def for_option - render_ok(schools: School.cached_names_data) + render_ok(schools: School.select(:id, :name).as_json) end end diff --git a/app/models/department.rb b/app/models/department.rb index c019862db..15a8a7c1b 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -2,23 +2,4 @@ class Department < ApplicationRecord belongs_to :school has_many :department_members, dependent: :destroy - - after_commit :reset_data_cache - - def self.cached_names_data(school) - Rails.cache.fetch(names_data_cache_key(school.id), expires_in: 7.days) do - school.departments.select(:id, :name).as_json - end - end - - private - - def reset_data_cache - # 清除部门名称缓存 - Rails.cache.delete(self.class.names_data_cache_key(school_id)) - end - - def self.names_data_cache_key(school_id) - "schools/#{school_id}/department_names_data" - end end diff --git a/app/models/repertoire.rb b/app/models/repertoire.rb index 140416658..72e1ebfff 100644 --- a/app/models/repertoire.rb +++ b/app/models/repertoire.rb @@ -3,23 +3,4 @@ class Repertoire < ApplicationRecord has_many :tag_repertoires, through: :sub_repertoires has_many :user_interests, dependent: :delete_all - - after_create_commit :reset_cache_data - after_update_commit :reset_cache_data - - def self.cache_data - Rails.cache.fetch(data_cache_key, expires_in: 1.days) do - Repertoire.select(:id, :name).order(:created_at).as_json - end - end - - def self.data_cache_key - 'repertoire/cache_data' - end - - private - - def reset_cache_data - Rails.cache.delete(self.class.data_cache_key) - end end diff --git a/app/models/school.rb b/app/models/school.rb index 983a93735..a0c829160 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -10,9 +10,6 @@ class School < ApplicationRecord has_many :ec_major_schools, :dependent => :destroy has_many :ec_majors, :through => :ec_major_schools - after_create_commit :reset_data_cache - after_update_commit :reset_data_cache - # 学校管理员 def manager?(user) ec_school_users.exists?(user_id: user.id) @@ -33,23 +30,4 @@ class School < ApplicationRecord def manage_permission?(user) manager?(user) || major_manager?(user) || course_manager?(user) end - - def self.cached_names_data - Rails.cache.fetch(names_data_cache_key, expires_in: 7.days) do - School.select(:id, :name).as_json - end - end - - private - - def reset_data_cache - # 清除学校名称缓存 - if new_record? || name_previously_changed? - Rails.cache.delete(self.class.names_data_cache_key) - end - end - - def self.names_data_cache_key - 'schools/names_data' - end end From 9e331cba6da52bc17d3829bfe4aa939a25924f94 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 14:42:40 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 973e73dac..bb0737128 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -169,7 +169,7 @@ class CoursesController < ApplicationController extra_params[:school_id] = @school.id extra_params[:is_public] = params[:is_public].present? ? params[:is_public] : 0 - if @course.is_end && (course_params[:end_date].nil? || course_params[:end_date].to_date > Date.today) + if @course.is_end && (course_params[:end_date].blank? || course_params[:end_date].to_date > Date.today) extra_params[:is_end] = 0 elsif !@course.is_end && !course_params[:end_date].blank? && course_params[:end_date].to_date < Date.today extra_params[:is_end] = 1 From ce81fb2a3013ec2059ae703de3c8f0d783fa0df2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 14:46:31 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index e1d6fe0cb..7403cfc4d 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -90,7 +90,7 @@ class MyshixunsController < ApplicationController # params[:pics] = "a.png,b.png,c.png" def training_task_status - logger.info("##################training_task_status_start#{jsonTestDetails['buildID']}") + logger.info("##################training_task_status_start#{params[:jsonTestDetails]['buildID']}") ActiveRecord::Base.transaction do begin t1 = Time.now From 1bc1866b0fc9bb02c4dce07309824a7fd7586cf7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 14:49:48 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 7403cfc4d..169f689f6 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -90,7 +90,7 @@ class MyshixunsController < ApplicationController # params[:pics] = "a.png,b.png,c.png" def training_task_status - logger.info("##################training_task_status_start#{params[:jsonTestDetails]['buildID']}") + logger.info("##################training_task_status_start#{params[:jsonTestDetails][:buildID]}") ActiveRecord::Base.transaction do begin t1 = Time.now From 4568e0c0c0cb5191c4f23f08db655e808053346f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 24 Jul 2019 14:50:16 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/ExerciseReviewAndAnswer.js | 2 +- .../exercise/Exercisestatisticalresult.js | 1 + .../courses/exercise/Exercisetablesmubu.js | 41 ++++++++++++++----- .../courses/exercise/new/SingleDisplay.js | 4 +- .../modules/courses/exercise/new/common.css | 4 ++ .../courses/exercise/question/multiple.js | 15 ++++--- .../courses/exercise/question/single.js | 14 ++++--- 7 files changed, 56 insertions(+), 25 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index b9f0f67f9..eb8143c03 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -20,7 +20,7 @@ import ShixunAnswer from './question/shixunAnswer' import update from 'immutability-helper' import axios from 'axios'; - +import './new/common.css' const Textarea =Input.TextArea const tagArray = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', diff --git a/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js b/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js index f6389613b..6e7b52715 100644 --- a/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js +++ b/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js @@ -222,6 +222,7 @@ class Exercisestatisticalresult extends Component { ) }): { datas.push({ - commit_percent:{num:item.choice_position,value:type===4||type===5?choicetype[item.choice_text-1]:item.choice_text,type:item.choice_right_boolean}, + commit_percent:{ + num:item.choice_position, + value:type===4||type===5?choicetype[item.choice_text-1]:item.choice_text, + type:item.choice_right_boolean, + _type: type + }, min_score:{value:item.choice_users_count,type:item.choice_right_boolean}, max_score:item.choice_percent, }) @@ -40,13 +51,23 @@ class Exercisetablesmubus extends Component { title: '选项', dataIndex: 'commit_percent', key: 'commit_percent', - render: (text, record) => ( - - {text.value!="有效填写量"&&text.value!="wrong"?text.value:false} - {text.value==="wrong"?"填写了错误答案":false} - {text.value==="有效填写量"?"有效填写量":false} - - ), + render: (text, record, index) => { + const _content = + {text.value!="有效填写量"&&text.value!="wrong" && + + } + {text.value==="wrong" && "填写了错误答案" } + {text.value==="有效填写量" && "有效填写量" } + + return ( + + (text._type === 0 || text._type === 1) ?
+ {{tagArray[index]}.} + {_content} +
: {_content} + ) + + }, }, { title: '小计', dataIndex: 'min_score', diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js index b7a1905fc..13d1e838c 100644 --- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js +++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js @@ -93,9 +93,9 @@ class SingleDisplay extends Component{
{ question_choices.map((item, optionIndex) => { let prefix = undefined - if (!isPreviewPage) { + // if (!isPreviewPage) { prefix = `${tagArray[optionIndex]}.` - } + // } if (question_type == 0) { // 单选 return (
diff --git a/public/react/src/modules/courses/exercise/new/common.css b/public/react/src/modules/courses/exercise/new/common.css index 0fef369e3..7e1e2530f 100644 --- a/public/react/src/modules/courses/exercise/new/common.css +++ b/public/react/src/modules/courses/exercise/new/common.css @@ -33,4 +33,8 @@ .singleDisplay .options .markdown-body { max-width: 1116px; +} +.singleDisplay .ant-radio-wrapper span:last-child + , .singleDisplay .ant-checkbox-wrapper span:last-child { + padding-right: 0px; } \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/question/multiple.js b/public/react/src/modules/courses/exercise/question/multiple.js index 60dbc9ac9..3ef3d960f 100644 --- a/public/react/src/modules/courses/exercise/question/multiple.js +++ b/public/react/src/modules/courses/exercise/question/multiple.js @@ -4,9 +4,9 @@ import {markdownToHTML} from 'educoder' import axios from 'axios' const tagArray = [ - // 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', - // 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', - // 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', + 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] class Multiple extends Component{ constructor(props){ @@ -41,14 +41,17 @@ class Multiple extends Component{ let isStudent =this.props.isStudent(); console.log(questionType); return( -
+
{ questionType.question_choices && questionType.question_choices.map((item,key)=>{ + let prefix = `${tagArray[key]}.` + return(

- - + {prefix} + {/* */} +

) }) diff --git a/public/react/src/modules/courses/exercise/question/single.js b/public/react/src/modules/courses/exercise/question/single.js index 5f514581a..aa23aa3d9 100644 --- a/public/react/src/modules/courses/exercise/question/single.js +++ b/public/react/src/modules/courses/exercise/question/single.js @@ -4,9 +4,9 @@ import {Checkbox,Radio, Input} from "antd"; import {markdownToHTML} from 'educoder' import axios from 'axios' const tagArray = [ - // 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', - // 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', - // 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', + 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] class single extends Component{ constructor(props){ @@ -36,14 +36,16 @@ class single extends Component{ let isStudent =this.props.isStudent(); return( -
+
{ questionType.question_choices && questionType.question_choices.map((item,key)=>{ + let prefix = `${tagArray[key]}.` return(

- - + {prefix} + {/* */} +

) }) From b2c011e7f6e6a6f8e6ab8a561e5466df9903cf5d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 14:54:30 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8A=A5=E9=94=99'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 169f689f6..649516a03 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -90,7 +90,6 @@ class MyshixunsController < ApplicationController # params[:pics] = "a.png,b.png,c.png" def training_task_status - logger.info("##################training_task_status_start#{params[:jsonTestDetails][:buildID]}") ActiveRecord::Base.transaction do begin t1 = Time.now From 5eea22fa635ea0c15cae306613d8e6627f89d1ae Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 14:58:56 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5eca6ccf9..91d53833b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -325,6 +325,7 @@ class ApplicationController < ActionController::Base unless file_content.present? raise("获取文件代码异常") end + console.info("#######game_id:#{game_id}, file_content:#{file_content}") game_code = GameCode.where(:game_id => game_id, :path => path).first if game_code.nil? GameCode.create!(:game_id => game_id, :new_code => file_content, :path => path) From 25574c841f1c6edee2f3709ede6701d6d2a3133e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 15:00:49 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 91d53833b..cccea9aed 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -325,7 +325,7 @@ class ApplicationController < ActionController::Base unless file_content.present? raise("获取文件代码异常") end - console.info("#######game_id:#{game_id}, file_content:#{file_content}") + logger.info("#######game_id:#{game_id}, file_content:#{file_content}") game_code = GameCode.where(:game_id => game_id, :path => path).first if game_code.nil? GameCode.create!(:game_id => game_id, :new_code => file_content, :path => path) From e8554171029b0a8e862135a92545641d1aaa074e Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 24 Jul 2019 15:05:07 +0800 Subject: [PATCH 12/13] debugType --- public/react/src/AppConfig.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 02d8c2be5..97637dc4c 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -2,7 +2,7 @@ import React from "react"; import axios from 'axios'; import { requestProxy } from "./indexEduplus2RequestProxy"; -import { broadcastChannelOnmessage ,SetAppModel} from 'educoder'; +import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; import { notification } from 'antd'; import './index.css' broadcastChannelOnmessage('refreshPage', () => { @@ -18,10 +18,18 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType ="" -// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : -// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' -// window._debugType = debugType; +let debugType ="" +if (isDev) { + const _search = window.location.search; + let parsed = {}; + if (_search) { + parsed = queryString.parse(_search); + } + debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : + window.location.search.indexOf('debug=s') != -1 ? 'student' : + window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || '' +} +window._debugType = debugType; export function initAxiosInterceptors(props) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation From 788c710ee0a6ed43872eddfa1d43889f386f3aab Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 15:16:00 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=B8=87=E8=83=BD=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 47349e219..324e5bde3 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -32,8 +32,11 @@ class AccountsController < ApplicationController end uid_logger("start register: verifi_code is #{verifi_code}, code is #{code}, time is #{Time.now.to_i - verifi_code.try(:created_at).to_i}") # check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60) - return normal_status(-2, "验证码不正确") if verifi_code.try(:code) != code.strip - return normal_status(-2, "验证码已失效") if !verifi_code&.effective? + # todo 上线前请删除万能验证码"513231" + if code != "513231" + return normal_status(-2, "验证码不正确") if verifi_code.try(:code) != code.strip + return normal_status(-2, "验证码已失效") if !verifi_code&.effective? + end code = generate_identifier User, 8 login = pre + code