|
|
@ -7,7 +7,8 @@ module Util::Wechat
|
|
|
|
attr_accessor :appid, :secret
|
|
|
|
attr_accessor :appid, :secret
|
|
|
|
|
|
|
|
|
|
|
|
def js_sdk_signature(url, noncestr, timestamp)
|
|
|
|
def js_sdk_signature(url, noncestr, timestamp)
|
|
|
|
str = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }.to_query
|
|
|
|
data = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }
|
|
|
|
|
|
|
|
str = data.map { |k, v| "#{k}=#{v}" }.join('&')
|
|
|
|
Digest::SHA1.hexdigest(str)
|
|
|
|
Digest::SHA1.hexdigest(str)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|