From d7dc0c8648f1f5a0e76ba1925cd840a91c15ced9 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 30 Dec 2019 17:24:51 +0800 Subject: [PATCH] first stamp --- app/controllers/application_controller.rb | 2 +- app/controllers/main_controller.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3d1fd642e..d3f70fad2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,7 +27,7 @@ class ApplicationController < ActionController::Base if params[:client_key].present? Rails.logger.info("111111 #{params[:client_key]}") Rails.logger.info("00000 #{params[:timestamp]}") - tip_exception(501, "请求超时") if Time.now - params[:timestamp].to_i > 5 + tip_exception(501, "请求不合理") if Time.now - params[:timestamp].to_i > 5 timestamp = params[:timestamp] sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") Rails.logger.info("2222 #{sign}") diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 395e536f4..bf18b2cda 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -4,4 +4,8 @@ class MainController < ApplicationController def index render file: 'public/react/build/index.html', :layout => false end + + def first_stamp + render :json => { status: 0, message: Time.now.to_i } + end end \ No newline at end of file