|
|
|
@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
|
|
|
|
|
protect_from_forgery prepend: true, unless: -> { request.format.json? }
|
|
|
|
|
|
|
|
|
|
before_action :check_sign
|
|
|
|
|
before_action :user_setup
|
|
|
|
|
#before_action :check_account
|
|
|
|
|
|
|
|
|
@ -20,6 +21,13 @@ class ApplicationController < ActionController::Base
|
|
|
|
|
|
|
|
|
|
helper_method :current_user
|
|
|
|
|
|
|
|
|
|
# 所有请求必须合法签名
|
|
|
|
|
def check_sign
|
|
|
|
|
timestamp = params[:timestamp]
|
|
|
|
|
sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}")
|
|
|
|
|
tip_exception(501, "请求不合理") if sign != params[:client_key]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 全局配置参数
|
|
|
|
|
# 返回name对应的value
|
|
|
|
|
def edu_setting(name)
|
|
|
|
|