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
Rails.logger.info("66666 #{params}")
if params[:client_key].present?
Rails.logger.info("111111 #{params[:client_key]}")
Rails.logger.info("00000 #{params[:timestamp]}")
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)
timestamp = params[:timestamp]
sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}")
randomcode = params[:randomcode]
tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
Rails.logger.info("2222 #{sign}")
tip_exception(501, "请求不合理") if sign != params[:client_key]
else

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

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

Loading…
Cancel
Save