完成下载行为记录

This commit is contained in:
huang 2016-03-18 09:58:47 +08:00
parent 79767f4bae
commit b262e1b432
1 changed files with 11 additions and 4 deletions

View File

@ -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