实名认证和职业认证的图片上传

issues25489
cxt 5 years ago
parent 533539c729
commit d2eeb28e42

@ -191,6 +191,7 @@ class AttachmentsController < ApplicationController
candown = current_user.member_of_course?(course)
end
tip_exception(403, "您没有权限进入") if course.present? && !candown
tip_exception(403, "您没有权限进入") if @file.container.is_a?(ApplyUserAuthentication)
end
end
end

@ -4,6 +4,7 @@ class ApplyUserAuthentication < ApplicationRecord
belongs_to :user
has_many :tidings, :as => :container, :dependent => :destroy
has_one :attachment, as: :container, dependent: :destroy
scope :real_name_auth, -> { where(auth_type: 1) }
scope :professional_auth, -> { where(auth_type: 2) }

@ -14,7 +14,8 @@ class Admins::IdentityAuths::AgreeApplyService < ApplicationService
RewardGradeService.call(user, container_id: user.id, container_type: 'Authentication', score: 500)
deal_tiding!
delete_auth_file!
apply.attachment&.destroy
# delete_auth_file!
end
end

@ -12,7 +12,8 @@ class Admins::IdentityAuths::RefuseApplyService < ApplicationService
apply.update!(status: 2, remarks: reason)
deal_tiding!
delete_auth_file!
apply.attachment&.destroy
# delete_auth_file!
end
end

@ -14,7 +14,8 @@ class Admins::ProfessionalAuths::AgreeApplyService < ApplicationService
RewardGradeService.call(user, container_id: user.id, container_type: 'Professional', score: 500)
deal_tiding!
delete_auth_file!
apply.attachment&.destroy
# delete_auth_file!
end
end

@ -12,7 +12,8 @@ class Admins::ProfessionalAuths::RefuseApplyService < ApplicationService
apply.update!(status: 2, remarks: reason)
deal_tiding!
delete_auth_file!
apply.attachment&.destroy
# delete_auth_file!
end
end

@ -22,9 +22,11 @@ class Users::ApplyAuthenticationService < ApplicationService
user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present?
user.apply_user_authentication.create!(auth_type: 1, status: 0)
apply = user.apply_user_authentication.create!(auth_type: 1, status: 0)
move_image_file! unless params[:upload_image].to_s == 'false'
Attachment.associate_container(params[:attachment_ids], apply.id, apply.class) if params[:attachment_ids]
# move_image_file! unless params[:upload_image].to_s == 'false'
end
# sms_notify_admin

@ -34,9 +34,11 @@ class Users::ApplyProfessionalAuthService < ApplicationService
user.save!
extension.save!
user.apply_user_authentication.create!(auth_type: 2, status: 0)
apply = user.apply_user_authentication.create!(auth_type: 2, status: 0)
move_image_file! unless params[:upload_image].to_s == 'false'
Attachment.associate_container(params[:attachment_ids], apply.id, apply.class) if params[:attachment_ids]
# move_image_file! unless params[:upload_image].to_s == 'false'
end
# sms_notify_admin

@ -51,8 +51,8 @@
<% unless is_processed %>
<td>
<% if File.exists?(disk_real_name_auth_filename(user.id)) %>
<%= image_tag(real_name_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
<% if apply.attachment %>
<%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
<% else %>
<%= content_tag(:span, '图片已删除', class: 'text-secondary') %>
<% end %>

@ -48,11 +48,11 @@
<% unless is_processed %>
<td>
<% if File.exists?(disk_professional_auth_filename(user.id)) %>
<%= image_tag(professional_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
<% else %>
<%= content_tag(:span, '图片已删除', class: 'text-secondary') %>
<% end %>
<%# if apply.attachment %>
<%= image_tag("/api/attachments/#{apply.attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
<%# else %>
<%#= content_tag(:span, '图片已删除', class: 'text-secondary') %>
<%# end %>
</td>
<% end %>

Loading…
Cancel
Save