|
|
|
@ -11,7 +11,7 @@ class CourseMessage < ApplicationRecord
|
|
|
|
|
|
|
|
|
|
def pass!
|
|
|
|
|
update!(status: :PASSED)
|
|
|
|
|
send_deal_tiding
|
|
|
|
|
send_deal_tiding(1)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def application_user
|
|
|
|
@ -20,16 +20,16 @@ class CourseMessage < ApplicationRecord
|
|
|
|
|
|
|
|
|
|
def reject!
|
|
|
|
|
update!(status: :REJECTED)
|
|
|
|
|
send_deal_tiding
|
|
|
|
|
send_deal_tiding(2)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def send_deal_tiding
|
|
|
|
|
def send_deal_tiding deal_status
|
|
|
|
|
# 发送申请处理结果消息
|
|
|
|
|
Tiding.create!(
|
|
|
|
|
user_id: course_message_id, trigger_user: User.current, container_id: course_id, container_type: 'DealCourse',
|
|
|
|
|
belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: status == :PASSED ? 1 : 2
|
|
|
|
|
belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status
|
|
|
|
|
)
|
|
|
|
|
# 将申请消息置为已处理
|
|
|
|
|
Tiding.where(trigger_user_id: user_id, container_id: course_id, container_type: 'JoinCourse', status: 0).update_all(status: 1)
|
|
|
|
|