From e4e7b6e26d9818c4f3dbacebb36a53e86d67a01c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 30 Dec 2019 10:27:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B7=B3=E8=BF=87=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hack_user_lastest_codes_controller.rb | 2 +- app/controllers/myshixuns_controller.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 641dcae2d..38238fea7 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -153,7 +153,7 @@ class HackUserLastestCodesController < ApplicationController when 'Java' content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min when 'C', 'C++' - content.scan(/\d:\d+:/).map{|s| s.match(/\d+/)[0]}.min + content.scan(/\d:\d+:/).map{|s| s.match(/\d+/)[0].to_i}.min when 'Python' content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min end diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 255c0f42e..67bec877b 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -3,6 +3,7 @@ class MyshixunsController < ApplicationController before_action :find_myshixun, :except => [:training_task_status, :code_runinng_message] before_action :find_repo_name, :except => [:training_task_status, :code_runinng_message] skip_before_action :verify_authenticity_token, :only => [:html_content] + skip_before_action :check_sign, only: [:training_task_status, :code_runinng_message] ## TPI关卡列表 def challenges From f17b642f3b21b5bca5678876de4073efb2b0e7c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 30 Dec 2019 10:28:35 +0800 Subject: [PATCH 2/4] =?UTF-8?q?md5=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 27 ++++++++++++------- .../courses/gradinforms/Bullsubdirectory.js | 8 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index c75389419..683f840c8 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -1,10 +1,14 @@ import React from "react"; import axios from 'axios'; +import md5 from 'md5'; import { requestProxy } from "./indexEduplus2RequestProxy"; import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; import { notification } from 'antd'; -import './index.css' +import './index.css'; +const opens ="79e33abd4b6588941ab7622aed1e67e8"; +let timestamp = Date.parse(new Date()); +const newopens=md5(opens+timestamp) broadcastChannelOnmessage('refreshPage', () => { window.location.reload() }) @@ -91,20 +95,20 @@ export function initAxiosInterceptors(props) { } if(`${config[0]}`!=`true`){ if (window.location.port === "3007") { - // if (url.indexOf('.json') == -1) { - // - // alert('开发提示:请给接口加.json:' + url) - // - // } config.url = `${proxy}${url}`; if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?debug=${debugType}`; + config.url = `${config.url}?debug=${debugType}&openkey=${newopens}`; } else { - config.url = `${config.url}&debug=${debugType}`; + config.url = `${config.url}&debug=${debugType}&openkey=${newopens}`; } } else { // 加api前缀 - config.url = url; + config.url = url; + if (config.url.indexOf('?') == -1) { + config.url = `${config.url}?openkey=${newopens}`; + } else { + config.url = `${config.url}&openkey=${newopens}`; + } } } // @@ -191,6 +195,11 @@ export function initAxiosInterceptors(props) { locationurl('/500'); } + if (response.data.status === 501) { + notification.warning({ + description:response.data.message, + }) + } // if (response.data.status === 402) { diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js index d1859e135..8c5561b02 100644 --- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js +++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js @@ -285,10 +285,10 @@ class Bullsubdirectory extends Component{ const {getFieldDecorator} = this.props.form; // console.log("Bullsubdirectory"); // console.log(this.props.isAdmin()); - console.log(this.props); - console.log(whethertoeditysl); - console.log(this.state.eduintits); - console.log(this.state.description); + // console.log(this.props); + // console.log(whethertoeditysl); + // console.log(this.state.eduintits); + // console.log(this.state.description); return( From caf8a33adb1a2ec99effd478b1aa17b45baec31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 30 Dec 2019 10:33:18 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 683f840c8..29b857475 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -197,7 +197,7 @@ export function initAxiosInterceptors(props) { if (response.data.status === 501) { notification.warning({ - description:response.data.message, + description:response.data.message || '访问异常,请求不合理', }) } From 95d07f7ca90376084eaaf622b4ca407b6ca09cd4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 30 Dec 2019 10:35:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 905b2c41d..23fb0227b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,9 +23,11 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign - timestamp = params[:timestamp] - sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") - tip_exception(501, "请求不合理") if sign != params[:client_key] + unless Rails.env.development? + timestamp = params[:timestamp] + sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") + tip_exception(501, "请求不合理") if sign != params[:client_key] + end end # 全局配置参数