From ec11d098c530b1425d496dc0ec2e3d79388bf5a3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Sep 2019 17:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=9C=E5=83=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 3009152c0..490b9e970 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -474,11 +474,10 @@ class ShixunsController < ApplicationController ShixunSchool.create!(arr) end # 超级管理员和运营人员才能保存 中间层服务器pod信息的配置 - # - logger.info("-------#shixun_service_configs:##{@shixun.shixun_service_configs.map(&:mirror_repository_id).sort}}") - logger.info("-------###{params[:shixun_service_configs].map{|c| c[:mirror_repository_id]}.sort}") - - if current_user.admin? || current_user.business? + # 如果镜像改动了,则也需要更改 + mirror = @shixun.shixun_service_configs.map(&:mirror_repository_id).sort + new_mirror = params[:shixun_service_configs].map{|c| c[:mirror_repository_id]}.sort + if current_user.admin? || current_user.business? || (mirror != new_mirror) @shixun.shixun_service_configs.destroy_all service_config_params[:shixun_service_configs].each do |config| name = MirrorRepository.find_by_id(config[:mirror_repository_id])&.name