测试测试

This commit is contained in:
yuanke 2016-08-14 12:13:04 +08:00
parent ba0d32bd09
commit 962a62577b
1 changed files with 15 additions and 1 deletions

View File

@ -23,7 +23,21 @@ module Mobile
refresh_token = session[:refresh_token]
if access_token.present? && refresh_token.present?
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
begin
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
rescue
info = wechat.web_access_token(session[:wechat_code])
openid =info["openid"]
access_token =info["access_token"]
if access_token
session[:access_token] = access_token
end
refresh_token = info["refresh_token"]
if refresh_token
session[:refresh_token] = refresh_token
end
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
end
access_token = refreshinfo["access_token"]
refresh_token = refreshinfo["refresh_token"]