Skip to content

Commit

Permalink
corp external users
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Oct 18, 2023
1 parent f92ccc0 commit 5bc2dd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/wechat/model/corp_external_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ module Model::CorpExternalUser
attribute :unionid, :string, index: true
attribute :external_userid, :string, index: true
attribute :pending_id, :string
attribute :corp_id, :string, index: true
attribute :corpid, :string, index: true

enum subject_type: {
oneself: '0',
provider: '1'
}

has_one :corp, primary_key: :corp_id, foreign_key: :corpid
has_one :corp, primary_key: :corpid, foreign_key: :corpid
belongs_to :wechat_user, foreign_key: :uid, primary_key: :uid, optional: true

before_validation :init_subject_type, if: -> { uid.present? && uid_changed? }
Expand Down
2 changes: 1 addition & 1 deletion app/models/wechat/model/oauth_user/wechat_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def init_corp_external_user
elsif app
corp = Corp.where(organ_id: app.organ.self_and_ancestor_ids).take
return unless corp
corp_external_users.present? || corp_external_users.create(corp_id: corp.corp_id)
corp_external_users.present? || corp_external_users.create(corpid: corp.corpid)
end
end

Expand Down

0 comments on commit 5bc2dd8

Please sign in to comment.