fixed qq命名调整,方便封装

This commit is contained in:
xxq250 2022-12-06 10:24:48 +08:00
parent 534ee80523
commit ee27c90205
4 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@
# index_open_users_on_user_id (user_id)
#
class OpenUsers::QQ < OpenUser
class OpenUsers::Qq < OpenUser
def nickname
extra&.[]('nickname')
end

View File

@ -119,7 +119,7 @@ class User < Owner
has_one :user_extension, dependent: :destroy
has_many :open_users, dependent: :destroy
has_one :wechat_open_user, class_name: 'OpenUsers::Wechat'
has_one :qq_open_user, class_name: 'OpenUsers::QQ'
has_one :qq_open_user, class_name: 'OpenUsers::Qq'
accepts_nested_attributes_for :user_extension, update_only: true
has_many :fork_users, dependent: :destroy

View File

@ -10,7 +10,7 @@ class Oauth::CreateOrFindQqAccountService < ApplicationService
def call
new_user = false
# 存在该用户
open_user = OpenUsers::QQ.find_by(uid: params['uid'])
open_user = OpenUsers::Qq.find_by(uid: params['uid'])
return [open_user.user, new_user] if open_user.present?
if user.blank? || !user.logged?
@ -32,7 +32,7 @@ class Oauth::CreateOrFindQqAccountService < ApplicationService
Util.download_file(params.dig('info', 'image'), avatar_path)
end
new_open_user = OpenUsers::QQ.create!(user: user, uid: params['uid'])
new_open_user = OpenUsers::Qq.create!(user: user, uid: params['uid'])
Rails.cache.write(new_open_user.can_bind_cache_key, 1, expires_in: 1.hours) if new_user # 方便后面进行账号绑定
end

View File

@ -20,7 +20,7 @@ Rails.application.routes.draw do
get 'attachments/download/:id', to: 'attachments#show'
get 'attachments/download/:id/:filename', to: 'attachments#show'
get 'auth/qq/callback', to: 'oauth/qq#create'
# get 'auth/qq/callback', to: 'oauth/qq#create'
get 'auth/failure', to: 'oauth/base#auth_failure'
get 'auth/cas/callback', to: 'oauth/cas#create'
get 'auth/:provider/callback', to: 'oauth/callbacks#create'