Merge branches 'dev_video' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

pay_subject
杨树明 5 years ago
commit c133508568

@ -4,7 +4,7 @@ module ControllerRescueHandler
included do
rescue_from Exception do |e|
Util.logger_error e
render json: {status: -1, message: "接口异常"}
render json: {status: -1, message: e.message}
end
rescue_from Mysql2::Error do |e|
Util.logger_error e
@ -24,8 +24,9 @@ module ControllerRescueHandler
rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(','))
end
rescue_from StandardError do |ex|
render_error(ex.message)
end
# rescue_from RuntimeError do |ex|
# Util.logger_error "#######ex:#{ex}"
# render_error(ex.message)
# end
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'

@ -6,7 +6,7 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController
Users::ApplyAuthenticationService.call(observed_user, create_params)
render_ok
rescue ApplicationService::Error => ex
tip_exception(ex.message)
render_error(ex.message)
end
def destroy

@ -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
Loading…
Cancel
Save