消息接口的调整

pay_subject
cxt 5 years ago
parent d667d82e5c
commit 4d2f30f39e

@ -19,9 +19,9 @@ class TidingsController < ApplicationController
end
tidings = tidings.where(tiding_type: tiding_types) if tiding_types.present?
# coures_message_id = current_user.manage_courses.not_deleted.course_messages.join_course_requests.unhandled
tidings = tidings.where(container_type: 'JoinCourse') if params[:type] == 'course_apply'
@course_apply_count = tidings.where("created_at > '#{@onclick_time}'").where(container_type: 'JoinCourse').count
tidings = tidings.where(container_type: 'JoinCourse', status: 0) if params[:type] == 'course_apply'
# @course_apply_count = tidings.where("created_at > '#{@onclick_time}'").where(container_type: 'JoinCourse', status: 0).count
@course_apply_count = tidings.where("created_at > '#{@onclick_time}'").where(container_type: 'JoinCourse', status: 0).count
tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package'

@ -0,0 +1,7 @@
class MigrateDefalutToTiding < ActiveRecord::Migration[5.2]
def change
change_column_default :tidings, :status, from: nil, to: 0
Tiding.where(status: nil).update_all(status: 0)
end
end

@ -0,0 +1,9 @@
class MigrateTidingStatus < ActiveRecord::Migration[5.2]
def change
Tiding.where(container_type: "JoinCourse", status: 0).each do |tiding|
unless CourseMessage.where(course_message_id: tiding.trigger_user_id, course_id: tiding.container_id, course_message_type: "JoinCourseRequest", status: 0).exists?
tiding.update!(status: 1)
end
end
end
end
Loading…
Cancel
Save