Commit b71cbb48 by lanrion

添加 获取js sdk 签名包 接口

parent 4681dd2d
...@@ -44,6 +44,25 @@ module WeixinAuthorize ...@@ -44,6 +44,25 @@ module WeixinAuthorize
@jsticket.result["ticket"] @jsticket.result["ticket"]
end end
# 获取js sdk 签名包
def get_jssign_package(url)
timestamp = Time.now.to_i
noncestr = SecureRandom.hex(16)
string = {
jsapi_ticket: js_ticket,
noncestr: noncestr,
timestamp: timestamp,
url: url
}.to_param
signature = Digest::SHA1.hexdigest(string)
{
"appId" => app_id, "nonceStr" => noncestr,
"timestamp" => timestamp, "url" => url,
"signature" => signature, "rawString" => string
}
end
private private
def get_jsticket def get_jsticket
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment