diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5abb3d69a..377230451 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/ecs/homes_controller.rb b/app/controllers/ecs/homes_controller.rb index 2202f6882..7edbd7d78 100644 --- a/app/controllers/ecs/homes_controller.rb +++ b/app/controllers/ecs/homes_controller.rb @@ -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 diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 395e536f4..e8554300c 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index c569596cc..c9da309d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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'