This commit is contained in:
parent
be0dd6c110
commit
bd12ea169d
|
@ -15,6 +15,22 @@ module Mobile
|
|||
end
|
||||
post ':id' do
|
||||
# authenticate!
|
||||
# userinfo = Wechat.api.web_userinfo("BjSzmH9GDgTwIjpv5wgWm2UQlOuaOMrTDS_rbmNaYtPT0FJrm3cNcG5y8_NT8J7i5JI6z40RBZ3p0tCf2OhFpy72-W5VuSA61NPxOTgw4JY","oCnvgv0Bf_6a_wFV3O6XyqXt-sgg")
|
||||
|
||||
require "open-uri"
|
||||
|
||||
#如果有GET请求参数直接写在URI地址中
|
||||
uri = 'https://api.weixin.qq.com/sns/userinfo?access_token=BjSzmH9GDgTwIjpv5wgWm2UQlOuaOMrTDS_rbmNaYtPT0FJrm3cNcG5y8_NT8J7i5JI6z40RBZ3p0tCf2OhFpy72-W5VuSA61NPxOTgw4JY&openid=oCnvgv0Bf_6a_wFV3O6XyqXt-sgg&lang=zh_CN'
|
||||
html_response = nil
|
||||
open(uri) do |http|
|
||||
html_response = http.read
|
||||
end
|
||||
|
||||
html_response
|
||||
|
||||
Rails.logger.info "html_response!!!!!!!!!"
|
||||
Rails.logger.info html_response
|
||||
|
||||
unless current_user
|
||||
#如果当前用户不存在
|
||||
openid = session[:wechat_openid]
|
||||
|
|
|
@ -130,9 +130,7 @@ module Wechat
|
|||
}
|
||||
|
||||
# get 'https://api.weixin.qq.com/sns/userinfo',params: params
|
||||
# get 'userinfo', params: params, base: OAUTH2_USERINFO
|
||||
|
||||
@client.get 'https://api.weixin.qq.com/sns/userinfo',params
|
||||
get 'userinfo', params: params, base: OAUTH2_USERINFO
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue