|
|
|
@ -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
|
|
|
|
|