You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/wechats/js_sdk_signatures_controlle...

11 lines
419 B

class Wechats::JsSdkSignaturesController < ApplicationController
def create
timestamp = Time.now.to_i
noncestr = ('A'..'z').to_a.sample(8).join
signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp)
render_ok(appid: Util::Wechat.appid, timestamp: timestamp, noncestr: noncestr, signature: signature)
rescue Util::WechatStore::Error => ex
render_error(ex.message)
end
end