pre_develop
daiao 6 years ago
parent cdeba2855b
commit 338e7aea69

@ -57,7 +57,18 @@ module Mobile
## 签名 ## 签名
accessKeyId = 'LTAISM4HFWpQHh3g'.freeze accessKeyId = 'LTAISM4HFWpQHh3g'.freeze
accessKeySecret = '9NMU8ushmFu8SN1EKHOhvo9jmv1qp0'.freeze accessKeySecret = '9NMU8ushmFu8SN1EKHOhvo9jmv1qp0'.freeze
sign = Digest::MD5.hexdigest("AccessKeyId=#{accessKeyId}AccessKeySecret=#{accessKeySecret}").upcase str = []
params.each do |key, value|
if key != "sign"
str << "#{key}=#{value}"
end
end
sign_str = "#{str.join("&")}&sk=#{accessKeySecret}"
Rails.logger.info("#####sign_str: #{sign_str}")
sign = Digest::MD5.hexdigest("#{sign_str}").upcase
Rails.logger.info("#####sign: #{sign}")
Rails.logger.info("#####params[:sign]: #{params[:sign]}")
if params[:sign] != sign if params[:sign] != sign
error!('401 Unauthorized', 401) error!('401 Unauthorized', 401)
end end

Loading…
Cancel
Save