Merge branch 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

dev_jupyter
杨树林 5 years ago
commit d6a386dd8e

@ -23,10 +23,16 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名
def check_sign
if params[:client_key]
Rails.logger.info("66666 #{params}")
if params[:client_key].present?
Rails.logger.info("111111 #{params[:client_key]}")
Rails.logger.info("00000 #{params[:timestamp]}")
timestamp = params[:timestamp]
sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}")
Rails.logger.info("2222 #{sign}")
tip_exception(501, "请求不合理") if sign != params[:client_key]
else
tip_exception(501, "请求不合理")
end
end

@ -1,4 +1,6 @@
class MainController < ApplicationController
skip_before_action :check_sign
def index
render file: 'public/react/build/index.html', :layout => false
end

@ -97,17 +97,17 @@ export function initAxiosInterceptors(props) {
if (window.location.port === "3007") {
config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?debug=${debugType}&openkey=${newopens}`;
config.url = `${config.url}?debug=${debugType}&timestamp=${timestamp}&client_key=${newopens}`;
} else {
config.url = `${config.url}&debug=${debugType}&openkey=${newopens}`;
config.url = `${config.url}&debug=${debugType}&timestamp=${timestamp}&client_key=${newopens}`;
}
} else {
// 加api前缀
config.url = url;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?openkey=${newopens}`;
config.url = `${config.url}?&timestamp=${timestamp}&client_key=${newopens}`;
} else {
config.url = `${config.url}&openkey=${newopens}`;
config.url = `${config.url}&timestamp=${timestamp}&client_key=${newopens}`;
}
}
}

Loading…
Cancel
Save