diff --git a/app/services/oauth/create_or_find_wechat_account_service.rb b/app/services/oauth/create_or_find_wechat_account_service.rb index c9402a91f..bb03c9f9c 100644 --- a/app/services/oauth/create_or_find_wechat_account_service.rb +++ b/app/services/oauth/create_or_find_wechat_account_service.rb @@ -13,6 +13,7 @@ class Oauth::CreateOrFindWechatAccountService < ApplicationService raise Error, 'Code不能为空' if code.blank? result = WechatOauth::Service.access_token(code) + result = WechatOauth::Service.user_info(result['access_token'], result['openid']) # 存在该用户 open_user = OpenUsers::Wechat.find_by(uid: result['unionid']) diff --git a/config/routes.rb b/config/routes.rb index c83fddffa..f3e2ece62 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,7 @@ Rails.application.routes.draw do get 'attachments/download/:id/:filename', to: 'attachments#show' get '/auth/qq/callback', to: 'oauth/qq#create' + get '/auth/wechat/callback', to: 'oauth/wechat#create' resources :edu_settings scope '/api' do