diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d3f70fad2..5abb3d69a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,7 +27,7 @@ class ApplicationController < ActionController::Base if params[:client_key].present? Rails.logger.info("111111 #{params[:client_key]}") Rails.logger.info("00000 #{params[:timestamp]}") - tip_exception(501, "请求不合理") if Time.now - params[:timestamp].to_i > 5 + tip_exception(501, "请求不合理") unless (Time.now.to_i - params[:timestamp].to_i).between?(0,5) timestamp = params[:timestamp] sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") Rails.logger.info("2222 #{sign}") diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 29e7461ec..9350001e4 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -7,8 +7,6 @@ import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educ import { notification } from 'antd'; import './index.css'; const opens ="79e33abd4b6588941ab7622aed1e67e8"; -let timestamp = Date.parse(new Date()); -const newopens=md5(opens+timestamp) broadcastChannelOnmessage('refreshPage', () => { window.location.reload() }) @@ -94,6 +92,8 @@ export function initAxiosInterceptors(props) { } } if(`${config[0]}`!=`true`){ + let timestamp = Date.parse(new Date())/1000; + let newopens=md5(opens+timestamp) if (window.location.port === "3007") { config.url = `${proxy}${url}`; if (config.url.indexOf('?') == -1) {