dev_cxt
jingquan huang 5 years ago
commit 33c67a0544

@ -23,10 +23,12 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名 # 所有请求必须合法签名
def check_sign def check_sign
Rails.logger.info("####111111#{request.content_type}, timestamp is #{params[:timestamp]}") unless Rails.env.development?
timestamp = params[:timestamp] Rails.logger.info("####111111#{request.content_type}, timestamp is #{params[:timestamp]}")
sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") timestamp = params[:timestamp]
tip_exception(501, "请求不合理") if sign != params[:client_key] sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}")
tip_exception(501, "请求不合理") if sign != params[:client_key]
end
end end
# 全局配置参数 # 全局配置参数

@ -153,7 +153,7 @@ class HackUserLastestCodesController < ApplicationController
when 'Java' when 'Java'
content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min
when 'C', 'C++' 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' when 'Python'
content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min
end end

@ -3,6 +3,7 @@ class MyshixunsController < ApplicationController
before_action :find_myshixun, :except => [:training_task_status, :code_runinng_message] before_action :find_myshixun, :except => [:training_task_status, :code_runinng_message]
before_action :find_repo_name, :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 :verify_authenticity_token, :only => [:html_content]
skip_before_action :check_sign, only: [:training_task_status, :code_runinng_message]
## TPI关卡列表 ## TPI关卡列表
def challenges def challenges

@ -1,10 +1,14 @@
import React from "react"; import React from "react";
import axios from 'axios'; import axios from 'axios';
import md5 from 'md5';
import { requestProxy } from "./indexEduplus2RequestProxy"; import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder';
import { notification } from 'antd'; 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', () => { broadcastChannelOnmessage('refreshPage', () => {
window.location.reload() window.location.reload()
}) })
@ -91,20 +95,20 @@ export function initAxiosInterceptors(props) {
} }
if(`${config[0]}`!=`true`){ if(`${config[0]}`!=`true`){
if (window.location.port === "3007") { if (window.location.port === "3007") {
// if (url.indexOf('.json') == -1) {
//
// alert('开发提示:请给接口加.json:' + url)
//
// }
config.url = `${proxy}${url}`; config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) { if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?debug=${debugType}`; config.url = `${config.url}?debug=${debugType}&openkey=${newopens}`;
} else { } else {
config.url = `${config.url}&debug=${debugType}`; config.url = `${config.url}&debug=${debugType}&openkey=${newopens}`;
} }
} else { } else {
// 加api前缀 // 加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'); locationurl('/500');
} }
if (response.data.status === 501) {
notification.warning({
description:response.data.message || '访问异常,请求不合理',
})
}
// if (response.data.status === 402) { // if (response.data.status === 402) {

@ -285,10 +285,10 @@ class Bullsubdirectory extends Component{
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
// console.log("Bullsubdirectory"); // console.log("Bullsubdirectory");
// console.log(this.props.isAdmin()); // console.log(this.props.isAdmin());
console.log(this.props); // console.log(this.props);
console.log(whethertoeditysl); // console.log(whethertoeditysl);
console.log(this.state.eduintits); // console.log(this.state.eduintits);
console.log(this.state.description); // console.log(this.state.description);
return( return(
<React.Fragment key={this.props.index} id={this.props.id}> <React.Fragment key={this.props.index} id={this.props.id}>

Loading…
Cancel
Save