pull/95/head
HFO4 7 years ago
parent 72ab679dd5
commit 1fe7be12c6

@ -138,7 +138,7 @@ class Aria2 extends Model{
break; 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"){ 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) Db::name("download")->where("id",$id)
->update([ ->update([
"status" => "complete", "status" => "complete",
@ -203,12 +203,14 @@ class Aria2 extends Model{
Db::name("download")->where("id",$sqlData["id"])->delete(); 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"){ if($this->policy["policy_type"] != "local"){
$this->setError($quenInfo,$sqlData,"您当前的上传策略无法使用离线下载"); $this->setError($quenInfo,$sqlData,"您当前的上传策略无法使用离线下载");
return false; return false;
} }
if($fileIndex==null){
$this->forceRemove($sqlData["pid"]); $this->forceRemove($sqlData["pid"]);
}
$suffixTmp = explode('.', $quenInfo["dir"]); $suffixTmp = explode('.', $quenInfo["dir"]);
$fileSuffix = array_pop($suffixTmp); $fileSuffix = array_pop($suffixTmp);
$uploadHandller = new UploadHandler($this->policy["id"],$this->uid); $uploadHandller = new UploadHandler($this->policy["id"],$this->uid);

Loading…
Cancel
Save