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.
26 lines
679 B
26 lines
679 B
class Admins::ApproveCompetitionPrizeUserService < ApplicationService
|
|
attr_reader :prize_user, :approver
|
|
|
|
def initialize(prize_user, approver)
|
|
@prize_user = prize_user
|
|
@approver = approver
|
|
end
|
|
|
|
def call
|
|
raise Error, '请勿重复审批' if prize_user.approved?
|
|
raise Error, '该用户未认证完成' unless prize_user.user_certified?
|
|
|
|
ActiveRecord::Base.transaction do
|
|
prize_user.approve
|
|
prize_user.approver = approver
|
|
prize_user.approved_at = Time.now
|
|
prize_user.save!
|
|
|
|
if prize_user.competition_team.all_prize_approved?
|
|
# TODO: 生成团队证书
|
|
end
|
|
|
|
# TODO: 生成个人证书
|
|
end
|
|
end
|
|
end |