Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_tpm_ui
杨树明 5 years ago
commit 61ccc059c7

@ -25,12 +25,10 @@ class ApplicationController < ActionController::Base
def check_sign def check_sign
Rails.logger.info("66666 #{params}") Rails.logger.info("66666 #{params}")
if params[:client_key].present? if params[:client_key].present?
Rails.logger.info("111111 #{params[:client_key]}") randomcode = params[:randomcode]
Rails.logger.info("00000 #{params[:timestamp]}") tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
Rails.logger.info("Time.now - params[:timestamp].to_i: #{Time.now.to_i - params[:timestamp].to_i}")
tip_exception(501, "请求超时") unless (Time.now.to_i - params[:timestamp].to_i).between?(0,5) sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
timestamp = params[:timestamp]
sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}")
Rails.logger.info("2222 #{sign}") Rails.logger.info("2222 #{sign}")
tip_exception(501, "请求不合理") if sign != params[:client_key] tip_exception(501, "请求不合理") if sign != params[:client_key]
else else

@ -1,6 +1,10 @@
class MainController < ApplicationController class MainController < ApplicationController
skip_before_action :check_sign skip_before_action :check_sign
def first_stamp
render :json => { status: 0, message: Time.now.to_i }
end
def index def index
render file: 'public/react/build/index.html', :layout => false render file: 'public/react/build/index.html', :layout => false
end end

@ -15,6 +15,7 @@ Rails.application.routes.draw do
scope '/api' do scope '/api' do
get 'home/index' get 'home/index'
get 'home/search' get 'home/search'
get 'main/first_stamp'
get 'search', to: 'searchs#index' get 'search', to: 'searchs#index'
@ -1336,6 +1337,7 @@ Rails.application.routes.draw do
root 'main#index' root 'main#index'
## react用 ## react用
get '*path', to: 'main#index', constraints: ReactConstraint.new get '*path', to: 'main#index', constraints: ReactConstraint.new
end end

Loading…
Cancel
Save