认证图片调整

issues25489
cxt 5 years ago
parent 981296b093
commit d1b449b8af

@ -5,7 +5,7 @@ class Users::ApplyAuthenticationForm
validates :name, presence: true
validate :validate_ID_number
validates :attachment_ids, presence: true
validates :validate_attachment_ids
def validate_ID_number
@ -13,4 +13,10 @@ class Users::ApplyAuthenticationForm
raise("身份证格式不对")
end
end
def validate_attachment_ids
unless attachment_ids.is_a?(Array) || attachment_ids.length != 1
raise("图片参数不对")
end
end
end

@ -7,5 +7,11 @@ class Users::ApplyProfessionalAuthForm
validates :department_id, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true
validates :identity, presence: true, inclusion: { in: %w(student teacher professional) }
validates :extra, presence: true
validates :attachment_ids, presence: true
validates :validate_attachment_ids
def validate_attachment_ids
unless attachment_ids.is_a?(Array) || attachment_ids.length != 1
raise("图片参数不对")
end
end
end
Loading…
Cancel
Save