Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

issues25489
daiao 5 years ago
commit 04eae4d51e

@ -1,10 +1,11 @@
class Users::ApplyAuthenticationForm
include ActiveModel::Model
attr_accessor :name, :id_number, :gender, :upload_image
attr_accessor :name, :id_number, :gender, :upload_image, :attachment_ids
validates :name, presence: true
validate :validate_ID_number
validate :validate_attachment_ids
def validate_ID_number
@ -12,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

@ -1,10 +1,17 @@
class Users::ApplyProfessionalAuthForm
include ActiveModel::Model
attr_accessor :school_id, :department_id, :identity, :extra, :upload_image
attr_accessor :school_id, :department_id, :identity, :extra, :upload_image, :attachment_ids
validates :school_id, presence: true, numericality: { only_integer: true, greater_than: 0 }
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
validate :validate_attachment_ids
def validate_attachment_ids
unless attachment_ids.is_a?(Array) || attachment_ids.length != 1
raise("图片参数不对")
end
end
end
Loading…
Cancel
Save