|
|
@ -11,8 +11,6 @@ class AttachmentsController < ApplicationController
|
|
|
|
def show
|
|
|
|
def show
|
|
|
|
# 1. 优先跳到cdn
|
|
|
|
# 1. 优先跳到cdn
|
|
|
|
# 2. 如果没有cdn,send_file
|
|
|
|
# 2. 如果没有cdn,send_file
|
|
|
|
# candown = attachment_candown @file
|
|
|
|
|
|
|
|
# tip_exception(403,"您没有权限下载该附件") if !candown
|
|
|
|
|
|
|
|
if @file.cloud_url.present?
|
|
|
|
if @file.cloud_url.present?
|
|
|
|
update_downloads(@file)
|
|
|
|
update_downloads(@file)
|
|
|
|
redirect_to @file.cloud_url and return
|
|
|
|
redirect_to @file.cloud_url and return
|
|
|
@ -185,7 +183,7 @@ class AttachmentsController < ApplicationController
|
|
|
|
course = @file.container&.graduation_work&.graduation_task&.course
|
|
|
|
course = @file.container&.graduation_work&.graduation_task&.course
|
|
|
|
candown = current_user.member_of_course?(course)
|
|
|
|
candown = current_user.member_of_course?(course)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tip_exception(409, "您没有权限进入") if course.present? && !candown
|
|
|
|
tip_exception(403, "您没有权限进入") if course.present? && !candown
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|