Browse Source

fixed qq命名调整,方便封装

pull/313/head
xxq250 3 years ago
parent
commit
ee27c90205
4 changed files with 5 additions and 5 deletions
  1. +1
    -1
      app/models/open_users/qq.rb
  2. +1
    -1
      app/models/user.rb
  3. +2
    -2
      app/services/oauth/create_or_find_qq_account_service.rb
  4. +1
    -1
      config/routes.rb

+ 1
- 1
app/models/open_users/qq.rb 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


+ 1
- 1
app/models/user.rb 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



+ 2
- 2
app/services/oauth/create_or_find_qq_account_service.rb 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


+ 1
- 1
config/routes.rb 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'


Loading…
Cancel
Save