|
|
|
@ -1,14 +1,16 @@
|
|
|
|
|
class ProjectPackages::WinBiddingService < ApplicationService
|
|
|
|
|
Error = Class.new(StandardError)
|
|
|
|
|
|
|
|
|
|
attr_reader :package, :params
|
|
|
|
|
attr_reader :package, :user, :params
|
|
|
|
|
|
|
|
|
|
def initialize(package, params)
|
|
|
|
|
def initialize(package, user, params)
|
|
|
|
|
@package = package
|
|
|
|
|
@user = user
|
|
|
|
|
@params = params
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def call
|
|
|
|
|
raise Error, '没有权限' unless package.creator_id == user.id || user.admin_or_business?
|
|
|
|
|
raise Error, '竞标报名还未结束' unless package.bidding_end?
|
|
|
|
|
raise Error, '该状态下不能选择中标者' unless package.may_finish_bidding?
|
|
|
|
|
|
|
|
|
|