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
562 B
19 lines
562 B
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(user_id: user.id, leader: true)
|
|
|
|
raise Error, '审批通过后不能修改' if prize_leaders.exists?(status: :approved)
|
|
|
|
prize_leaders.update_all(extra: params)
|
|
end
|
|
end |