@@ -6,10 +6,10 @@
# user_id :integer not null
# number :string(255) not null
# name :string(255) not null
# card_front :integer
# card_back :integer
# hold_card_front :integer
# hold_card_back :integer
# card_front :string(255)
# card_back :string(255)
# hold_card_front :string(255)
# hold_card_back :string(255)
# state :integer default("0")
# description :string(255)
# created_at :datetime not null
@@ -24,7 +24,7 @@ class IdentityVerification < ApplicationRecord
belongs_to :user
enum state: { "待审核": 0, "已通过": 1, "已拒绝": 2}
after_create do
Attachment.where(id:[card_front,card_back,hold_card_front,hold_card_back]).update_all(is_public:0)
Attachment.where(uu id:[card_front,card_back,hold_card_front,hold_card_back]).update_all(is_public:0)
end
after_save do
@@ -34,18 +34,18 @@ class IdentityVerification < ApplicationRecord
end
def card_front_attachment
Attachment.find_by_id card_fron t
Attachment.where_id_or_uuid(card_front).firs t
end
def card_back_attachment
Attachment.find_by_id card_back
Attachment.where_id_or_uuid(card_back).first
end
def hold_card_front_attachment
Attachment.find_by_id hold_card_fron t
Attachment.where_id_or_uuid(hold_card_front).firs t
end
def hold_card_back_attachment
Attachment.find_by_id hold_card_back
Attachment.where_id_or_uuid(hold_card_back).first
end
end