diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 155e75976..9d5b3cc5a 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -103,9 +103,10 @@ class AttachmentsController < ApplicationController direct_download_history end else - direct_download_history # 记录用户行为 - record_user_actions + record_user_actions(params[:id]) + # 直接下载历史版本 + direct_download_history end end else @@ -115,8 +116,12 @@ class AttachmentsController < ApplicationController redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html" end - def record_user_actions - UserActions.create(:action_id => id, :action_type => "AttachmentHistory", :user_id => User.current.id) + def record_user_actions id + if params[:action] == "download_history" + UserActions.create(:action_id => id, :action_type => "AttachmentHistory", :user_id => User.current.id) unless id.nil? + elsif params[:action] == "download" + UserActions.create(:action_id => id, :action_type => "Attachment", :user_id => User.current.id) + end end def download @@ -141,6 +146,8 @@ class AttachmentsController < ApplicationController direct_download end else + # 记录用户行为 + record_user_actions(params[:id]) direct_download end end