资源的更新

dev_aliyun2
cxt 5 years ago committed by harry
parent e77e44b5de
commit 2ccafdbd63

@ -2,13 +2,13 @@ class FilesController < ApplicationController
include MessagesHelper
before_action :require_login, :check_auth, except: %i[index]
before_action :find_course, except: %i[public_with_course_and_project mine_with_course_and_project]
before_action :find_course, except: %i[public_with_course_and_project mine_with_course_and_project update_visits]
before_action :find_ids, only: %i[bulk_delete bulk_send bulk_move bulk_public bulk_publish]
before_action :file_validate_sort_type, only: :index
before_action :validate_send_message_to_course_params, only: :bulk_send
before_action :set_pagination, only: %i[index public_with_course_and_project mine_with_course_and_project]
before_action :validate_upload_params, only: %i[import]
before_action :find_file, only: %i[show setting update]
before_action :find_file, only: %i[show setting update update_visits]
before_action :publish_params, only: %i[upload import update]
SORT_TYPE = %w[created_on downloads quotes]
@ -355,6 +355,11 @@ class FilesController < ApplicationController
end
end
def update_visits
@file.increment!(:downloads)
render_ok
end
private
def find_file
@file = Attachment.find params[:id]

@ -464,6 +464,7 @@ Rails.application.routes.draw do
end
member do
get :histories
post :update_visits
end
end

Loading…
Cancel
Save