Merge branch 'dev_aliyun' into develop

pay_subject
daiao 5 years ago
commit e98166d2ab

@ -24,7 +24,7 @@ module ControllerRescueHandler
rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(','))
end
rescue_from StandardError do |ex|
rescue_from RuntimeError do |ex|
render_error(ex.message)
end
end

@ -386,6 +386,7 @@ class CoursesController < ApplicationController
def destroy
if @course.is_delete == 0
@course.delete!
Tiding.where(belong_container: @course).update_all(is_delete: 1)
Tiding.create!(user_id: current_user.id, trigger_user_id: current_user.id, container_id: @course.id,
container_type: 'DeleteCourse', tiding_type: 'System', belong_container: @course, extra: @course.name)
normal_status(0, "成功")

@ -5,7 +5,7 @@ class TidingsController < ApplicationController
after_action :update_onclick_time!, only: [:index]
def index
tidings = current_user.tidings
tidings = current_user.tidings.visible
@onclick_time = current_user.click_time
tiding_types =
@ -21,7 +21,7 @@ class TidingsController < ApplicationController
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
@course_apply_count = tidings.where(container_type: 'JoinCourse', status: 0).count
tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package'

@ -7,6 +7,8 @@ class Tiding < ApplicationRecord
has_many :attachments, as: :container
scope :visible, -> { where(is_delete: 0) }
def identifier
value = nil

@ -0,0 +1,5 @@
class AddIsDeleteToTiding < ActiveRecord::Migration[5.2]
def change
add_column :tidings, :is_delete, :boolean, default: 0
end
end

@ -0,0 +1,5 @@
class UpdateTidingsDeleteStatus < ActiveRecord::Migration[5.2]
def change
Tiding.where.not(container_type: 'DeleteCourse').where(belong_container_type: "Course", belong_container_id: Course.where(is_delete: 1).pluck(:id)).update_all(is_delete: 1)
end
end

@ -0,0 +1,5 @@
class DeleteColumnTiding < ActiveRecord::Migration[5.2]
def change
remove_column :tidings, :delete
end
end
Loading…
Cancel
Save