You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
567 B
19 lines
567 B
5 years ago
|
class Competitions::SavePrizeTeamAccountService < ApplicationService
|
||
|
attr_reader :competition, :user, :params
|
||
|
|
||
|
def initialize(competition, user, params)
|
||
|
@competition = competition
|
||
|
@user = user
|
||
|
@params = params
|
||
|
end
|
||
|
|
||
|
def call
|
||
|
Competitions::SavePrizeTeamAccountForm.new(params).validate!
|
||
|
|
||
|
prize_leaders = competition.competition_prize_users.where(competition.competition_prize_users)
|
||
|
|
||
|
raise Error, '审批通过后不能修改' if prize_leaders.exists?(status: :approved)
|
||
|
|
||
|
prize_leaders.update_all(extra: params)
|
||
|
end
|
||
|
end
|