Merge branch 'dev_aliyun' into dev_tj

merge aliyun
dev_new_shixunsrepository
tangjiang 5 years ago
commit cc6ce5b5da

@ -25,11 +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]}")
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

@ -3,10 +3,6 @@ class Ecs::HomesController < Ecs::BaseController
@school_managers = current_school.users
end
def first_stamp
render :json => { status: 0, message: Time.now.to_i }
end
private
def current_school

@ -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,7 +15,7 @@ Rails.application.routes.draw do
scope '/api' do
get 'home/index'
get 'home/search'
get 'home/first_stamp'
get 'main/first_stamp'
get 'search', to: 'searchs#index'

Loading…
Cancel
Save