From d7c14c3501043cdf22456397a9aaad52f0709ae3 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 13 Jul 2019 11:09:47 +0800 Subject: [PATCH] project package deadline limit --- app/services/project_packages/save_service.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/project_packages/save_service.rb b/app/services/project_packages/save_service.rb index bb91f5d4..2a3c8b6c 100644 --- a/app/services/project_packages/save_service.rb +++ b/app/services/project_packages/save_service.rb @@ -15,6 +15,8 @@ class ProjectPackages::SaveService raise Error, '类型不存在' unless ProjectPackageCategory.where(id: params[:category_id]).exists? params[:project_package_category_id] = params[:category_id].to_i + raise Error, '竞标截止时间不能小于当前时间' if params[:deadline_at].present? && params[:deadline_at].to_time < Time.now + ActiveRecord::Base.transaction do package.assign_attributes(params) package.save!