Skip to content

Commit

Permalink
fix: move file while forget to change the parent folder ID
Browse files Browse the repository at this point in the history
  • Loading branch information
HFO4 committed Oct 20, 2018
1 parent 6dd49fc commit d9fa51a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions application/index/model/FileManage.php
Expand Up @@ -461,7 +461,8 @@ static function MoveHandler($file,$dir,$new,$uid){
if(in_array($new,$dir)){
die('{ "result": { "success": false, "error": "不能移动目录到自身" } }');
}
if(Db::name('folders')->where('owner',$uid)->where('position_absolute',$new)->find() == null){
$newFolder=Db::name('folders')->where('owner',$uid)->where('position_absolute',$new)->find();
if($newFolder== null){
die('{ "result": { "success": false, "error": "目录不存在" } }');
}
$moveName=[];
Expand Down Expand Up @@ -499,7 +500,10 @@ static function MoveHandler($file,$dir,$new,$uid){
'upload_user' => $uid,
'dir' => ["in",$movePath],
'orign_name' =>["in",$moveName],
])->setField('dir', $new);
])->update([
'dir'=> $new,
"parent_folder" => $newFolder["id"]
]);
echo ('{ "result": { "success": true} }');
}

Expand Down

0 comments on commit d9fa51a

Please sign in to comment.