From 6e322a563078a965cc42cb84fbcf3d04a1b576eb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Sep 2019 09:34:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=AE=A1=E6=89=B9=E6=8A=A550?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index e4a51b26..c1cf4771 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1756,8 +1756,10 @@ end Tiding.where(:user_id => 1, :trigger_user_id => applied_department.user_id, :container_id => applied_department.id, :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(:status => 1) Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason]) # 删除学校的用户 - users = UserExtensions.where("department_id = #{applied_department.department_id}") - users.update_all(department_id: nil, profile_completed: false) + user_exs = UserExtensions.where("department_id = #{applied_department.department_id}") + users = User.where(id: user_exs.pluck(:user_id)) + user_exs.update_all(department_id: nil) + users.update_all(profile_completed: false) applied_department.department.destroy # 已审批删除 elsif params[:tip] == "applied"