From 1fe7be12c6e7fb83ae2fd13847a7b7ba5af59ecb Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Thu, 30 Aug 2018 20:02:59 +0800 Subject: [PATCH] Fix: #67 --- application/index/model/Aria2.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/index/model/Aria2.php b/application/index/model/Aria2.php index 547ebae9..1340b9a1 100644 --- a/application/index/model/Aria2.php +++ b/application/index/model/Aria2.php @@ -138,7 +138,7 @@ class Aria2 extends Model{ break; } if(($respondData["result"]["files"][$downloadInfo["file_index"]]["completedLength"] == $respondData["result"]["files"][$downloadInfo["file_index"]]["length"] && ($respondData["result"]["files"][$downloadInfo["file_index"]]["length"] !=0 )) && $respondData["result"]["status"]=="active"){ - $this->setComplete($respondData["result"],$downloadInfo); + $this->setComplete($respondData["result"],$downloadInfo,$downloadInfo["file_index"]); Db::name("download")->where("id",$id) ->update([ "status" => "complete", @@ -203,12 +203,14 @@ class Aria2 extends Model{ Db::name("download")->where("id",$sqlData["id"])->delete(); } - private function setComplete($quenInfo,$sqlData){ + private function setComplete($quenInfo,$sqlData,$fileIndex=null){ if($this->policy["policy_type"] != "local"){ $this->setError($quenInfo,$sqlData,"您当前的上传策略无法使用离线下载"); return false; } - $this->forceRemove($sqlData["pid"]); + if($fileIndex==null){ + $this->forceRemove($sqlData["pid"]); + } $suffixTmp = explode('.', $quenInfo["dir"]); $fileSuffix = array_pop($suffixTmp); $uploadHandller = new UploadHandler($this->policy["id"],$this->uid);