|
|
|
@ -406,11 +406,12 @@ class InitializationDataController < ApplicationController
|
|
|
|
|
attachment_attrs = %i[id container_id container_type filename disk_filename filesize content_type digest downloads author_id
|
|
|
|
|
created_on description disk_directory attachtype is_public copy_from quotes is_publish publish_time resource_bank_id unified_setting
|
|
|
|
|
cloud_url course_second_category_id]
|
|
|
|
|
att_ids = Attachment.pluck(:id)
|
|
|
|
|
Attachment.bulk_insert(*attachment_attrs) do |worker|
|
|
|
|
|
@attachments.each do |att|
|
|
|
|
|
@attachments.select{|a| !att_ids.include?(a.id) }.each do |att|
|
|
|
|
|
logger.info("###attachment_id: #{att.id}")
|
|
|
|
|
base_attr = att.attributes.dup.except("author_id", "disk_directory", "copy_from")
|
|
|
|
|
# 本地版将过关任务的图片迁移到files/localshixuns 目录下, copy_from记录的是他原来的目录结构
|
|
|
|
|
logger.info("########att.disk_directory: #{att.disk_directory}")
|
|
|
|
|
worker.add(base_attr.merge(author_id: 1, disk_directory: "localshixuns", copy_from: "#{att.disk_directory}"))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|