From 03eda207450f3fbf37c7c5666cb4173b633a77bc Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 15:02:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=BA=93=E7=9A=84=E5=8F=8D?= =?UTF-8?q?=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/examination_banks_controller.rb | 11 ++++++++--- config/routes.rb | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index bf3bb7a3a..cc34d9fea 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -1,9 +1,9 @@ class ExaminationBanksController < ApplicationController include PaginateHelper before_action :require_login - before_action :certi_identity_auth, only: [:create, :edit, :update, :destroy, :set_public, :revoke_item] - before_action :find_exam, except: [:index, :create] - before_action :edit_auth, only: [:update, :destroy, :set_public, :revoke_item] + before_action :certi_identity_auth, only: [:create, :edit, :update, :destroy, :set_public, :revoke_item, :cancel_items] + before_action :find_exam, except: [:index, :create, :cancel_items] + before_action :edit_auth, only: [:update, :destroy, :set_public, :revoke_item, :cancel_items] before_action :identity_auth, only: [:index] def index @@ -76,6 +76,11 @@ class ExaminationBanksController < ApplicationController render_ok end + def cancel_items + current_user.item_baskets.where(item_bank_id: params[:item_ids]).destroy_all + render_ok + end + private def form_params diff --git a/config/routes.rb b/config/routes.rb index e2b8f33a6..2bbdd6c3c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,6 +85,7 @@ Rails.application.routes.draw do post :set_public delete :revoke_item end + post :cancel_items, on: :collection end resources :examination_items do