update user info api add professional logical && fix bug

dev_forum
p31729568 5 years ago
parent 7df20dfa79
commit 9cf393acb0

@ -6,4 +6,5 @@ class ApplyUserAuthentication < ApplicationRecord
scope :real_name_auth, -> { where(auth_type: 1) }
scope :professional_auth, -> { where(auth_type: 2) }
scope :processing, -> { where(status: 0) }
scope :passed, -> { where(status: 1) }
end

@ -58,7 +58,7 @@ class User < ApplicationRecord
has_many :tidings, :dependent => :destroy
has_many :games, :dependent => :destroy
has_many :created_subjects
has_many :created_subjects, foreign_key: :user_id, class_name: 'Subject'
has_many :subjects, :through => :subject_members
has_many :subject_members, :dependent => :destroy
has_many :grades, :dependent => :destroy

@ -35,6 +35,13 @@ class Users::UpdateAccountService < ApplicationService
extension.technical_title = params[:technical_title]
end
# 职业、学校变动需要重新进行职业认证
if extension.identity_changed? || extension.school_id_changed?
user.professional_certification = false
# 撤销之前的职业认证
user.apply_user_authentication.professional_auth.passed.update_all(status: 3)
end
# 表示资料完整
user.profile_completed = true

Loading…
Cancel
Save