|
|
@ -13,6 +13,7 @@ class Oauth::CreateOrFindWechatAccountService < ApplicationService
|
|
|
|
raise Error, 'Code不能为空' if code.blank?
|
|
|
|
raise Error, 'Code不能为空' if code.blank?
|
|
|
|
|
|
|
|
|
|
|
|
result = WechatOauth::Service.access_token(code)
|
|
|
|
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'])
|
|
|
|
open_user = OpenUsers::Wechat.find_by(uid: result['unionid'])
|
|
|
|