离线下载添加URL交互界面

This commit is contained in:
HFO4 2018-04-09 22:04:56 +08:00
parent 1b87365b8a
commit b8b63662ea
5 changed files with 59 additions and 5 deletions

View file

@ -54,8 +54,9 @@ class RemoteDownload extends Controller{
$downloadStart = $aria2->addUrl(input("post.url"));
if($aria2->reqStatus){
$this->insertRecord($aria2,input("post.url"));
return json(["result"=>['success'=>true,'error'=>null]]);
}else{
return json(['error'=>1,'message'=>$aria2->reqMsg]);
return json(["result"=>['success'=>false,'error'=>$aria2->reqMsg]]);
}
}

View file

@ -129,6 +129,13 @@ class Aria2 extends Model{
# code...
break;
}
if(($respondData["result"]["files"][$downloadInfo["file_index"]]["completedLength"] == $respondData["result"]["files"][$downloadInfo["file_index"]]["length"]) && $respondData["result"]["status"]=="active"){
$this->setComplete($respondData["result"],$downloadInfo);
Db::name("download")->where("id",$id)
->update([
"status" => "complete",
]);
}
}else{
$this->reqStatus = 0;
$this->reqMsg = "空间容量不足";

View file

@ -28,6 +28,8 @@
allowSource : "{$policyData.origin_link}",
upUrl : "{$policyData.server}",
allowShare:"{$groupData.allow_share}",
allowRemoteDownload:"{:explode(",",$groupData.aria2)[0]}",
allowTorrentDownload:"{:explode(",",$groupData.aria2)[1]}",
};
</script>
<script src="/static/js/home.js"></script>

File diff suppressed because one or more lines are too long

View file

@ -49,6 +49,9 @@
changePermissions: false,
upload: false,
shareFile: uploadConfig.allowShare == "1" ? true : false,
allowRemoteDownload: uploadConfig.allowRemoteDownload,
allowTorrentDownload: uploadConfig.allowTorrentDownload,
}),
});
}]);