|
|
|
@ -127,12 +127,14 @@ class ResourceDirService extends Service |
|
|
|
*/ |
|
|
|
public function copyTo($ids, $to_id) |
|
|
|
{ |
|
|
|
|
|
|
|
// 更新 新的文件夹资源 以及所有父文件夹资源 大小和数量
|
|
|
|
foreach ($ids as $resource_id) { |
|
|
|
$resource = Resource::find($resource_id); |
|
|
|
(new ResourceDirService())->changeDirSizeAndCount($resource, $to_id, '+'); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//递归复制
|
|
|
|
$this->copyFolderRecursively($ids, $to_id); |
|
|
|
return dataReturn($this->sucCode, $this->copyMsg); |
|
|
|
@ -147,14 +149,14 @@ class ResourceDirService extends Service |
|
|
|
{ |
|
|
|
|
|
|
|
foreach ($ids as $resource_id) { |
|
|
|
// 复制源文件夹
|
|
|
|
//获取源文件 和子文件
|
|
|
|
$resource = Resource::find($resource_id); |
|
|
|
$children = Resource::with(['files', 'accredit_files'])->where('parent_id', $resource->id)->select(); |
|
|
|
|
|
|
|
// 复制源文件夹
|
|
|
|
$new_resource_dir = $this->copyResourceDir($resource->toArray(), $to_id); |
|
|
|
$new_resource_dir_id = $new_resource_dir['data']; |
|
|
|
|
|
|
|
// 复制子文件和子文件夹
|
|
|
|
$children = Resource::with(['files', 'accredit_files'])->where('parent_id', $resource->id)->select(); |
|
|
|
|
|
|
|
if ($children) { |
|
|
|
foreach ($children as $child) { |
|
|
|
|