Commit 7b649ffd by lanrion

synchronize get_access_token

parent 042497e8
# encoding: utf-8 # encoding: utf-8
require "monitor"
require "redis" require "redis"
require 'digest/md5' require 'digest/md5'
module WeixinAuthorize module WeixinAuthorize
class Client class Client
include MonitorMixin
include Api::User include Api::User
include Api::Menu include Api::Menu
include Api::Custom include Api::Custom
...@@ -26,12 +30,13 @@ module WeixinAuthorize ...@@ -26,12 +30,13 @@ module WeixinAuthorize
@redis_key = security_redis_key(options[:redis_key] || "weixin_#{app_id}") @redis_key = security_redis_key(options[:redis_key] || "weixin_#{app_id}")
@jsticket_redis_key = security_redis_key("js_sdk_#{app_id}") @jsticket_redis_key = security_redis_key("js_sdk_#{app_id}")
@custom_access_token = options[:custom_access_token] @custom_access_token = options[:custom_access_token]
super() # Monitor#initialize
end end
# return token # return token
def get_access_token def get_access_token
return custom_access_token if !custom_access_token.nil? return custom_access_token if !custom_access_token.nil?
token_store.access_token synchronize{ token_store.access_token }
end end
# 检查appid和app_secret是否有效。 # 检查appid和app_secret是否有效。
......
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