删除的调整

dev_cs
cxt 5 years ago
parent 8242a058ab
commit 7493d79862

@ -493,15 +493,16 @@ class StudentWorksController < ApplicationController
# 删除实训作品评阅 # 删除实训作品评阅
def destroy_work_comment def destroy_work_comment
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
tip_exception("visible_comment参数有误") if params[:visible_comment].nil? # tip_exception("visible_comment参数有误") if params[:visible_comment].nil?
comment = @work.shixun_work_comments.find_by!(id: params[:comment_id]) comment = @work.shixun_work_comments.find_by!(id: params[:comment_id])
params[:visible_comment] ? comment.comment = nil : comment.hidden_comment = nil comment.destroy!
if comment.comment.nil? && comment.hidden_comment.nil? # params[:visible_comment] ? comment.comment = nil : comment.hidden_comment = nil
comment.destroy! # if comment.comment.nil? && comment.hidden_comment.nil?
else # comment.destroy!
comment.save! # else
end # comment.save!
# end
normal_status("删除成功") normal_status("删除成功")
end end
end end

Loading…
Cancel
Save