From 624e5b150e5a76b5b24d60e4aff7117726c500fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Wed, 18 Oct 2023 13:27:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=9D=9Epublic=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=9F=A5=E7=9C=8B=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 1 + app/models/identity_verification.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 4949946c0..cedefd1fe 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -229,6 +229,7 @@ class AttachmentsController < ApplicationController end tip_exception(403, "您没有权限进入") if project.present? && !candown end + tip_exception(403, "您没有权限查看") if project.present? && !candown if @file.is_public == 0 && author_id != current_user.id end end diff --git a/app/models/identity_verification.rb b/app/models/identity_verification.rb index 3c8c88d9b..6ea6e0547 100644 --- a/app/models/identity_verification.rb +++ b/app/models/identity_verification.rb @@ -23,7 +23,10 @@ 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) + end + after_save do if state == "已通过" user.update(id_card_verify: true, website_permission: true)