forgeplus/app/controllers/notices_controller.rb

22 lines
801 B
Ruby
Raw Normal View History

2022-02-17 18:28:32 +08:00
class NoticesController < ApplicationController
def create
tip_exception("参数有误") if params["source"].blank?
user_id = params[:user_id]
if params["source"] == "CompetitionBegin"
competition_id = params[:competition_id]
SendTemplateMessageJob.perform_later('CompetitionBegin', user_id, competition_id)
elsif params["source"] == "CompetitionResult"
competition_id = params[:competition_id]
SendTemplateMessageJob.perform_later('CompetitionResult', user_id, competition_id)
2022-02-21 16:46:40 +08:00
elsif params["source"] == "CompetitionReview"
2022-02-17 18:28:32 +08:00
competition_id = params[:competition_id]
2022-02-21 16:46:40 +08:00
SendTemplateMessageJob.perform_later('CompetitionReview', user_id, competition_id)
2022-02-17 18:28:32 +08:00
else
tip_exception("#{params["source"]}未配置")
end
render_ok
end
end