Commit 4efdb171fd602e28beb550c2c747ad9ce584423b

Authored by lanrion
1 parent 4ee2d32b
Exists in master

fixed cache_store and logger config when config is nil

lib/qy_wechat_api.rb
... ... @@ -52,7 +52,7 @@ module QyWechatApi
52 52 end
53 53  
54 54 def cache
55   - if config.cache_store
  55 + if config.try(:cache_store)
56 56 config.cache_store
57 57 elsif on_rails?
58 58 Rails.cache
... ... @@ -62,7 +62,7 @@ module QyWechatApi
62 62 end
63 63  
64 64 def logger
65   - if config.logger
  65 + if config.try(:logger)
66 66 config.logger
67 67 elsif on_rails?
68 68 Rails.logger
... ...
lib/qy_wechat_api/storage/storage.rb
... ... @@ -67,5 +67,9 @@ module QyWechatApi
67 67 raise Errors::ValidAccessTokenException, result_handler.full_error_message
68 68 end
69 69 end
  70 +
  71 + def weixin_redis
  72 + QyWechatApi.weixin_redis
  73 + end
70 74 end
71 75 end
... ...