整理下载文件跳转

This commit is contained in:
kuaifan 2022-03-31 13:55:57 +08:00
parent 457efa1c79
commit ce03296078
2 changed files with 0 additions and 34 deletions

View File

@ -7,12 +7,9 @@ use App\Tasks\AutoArchivedTask;
use App\Tasks\DeleteTmpTask;
use App\Tasks\OverdueRemindEmailTask;
use Arr;
use Cache;
use Carbon\Carbon;
use Hhxsv5\LaravelS\Swoole\Task\Task;
use Redirect;
use Request;
use Route;
/**
@ -77,36 +74,6 @@ class IndexController extends InvokeController
return $array;
}
/**
* 下载链接
* @return array|\Illuminate\Http\RedirectResponse|string
*/
public function download()
{
$id = Request::input('id');
if ($id) {
$url = Cache::get("Download::" . $id);
if ($url) {
sleep(1);
return Redirect::to($url, 301);
}
}
//
$action = Route::input('action');
if ($action) {
$url = Base::fillUrl('download?id=' . $action);
return "<script>setTimeout(function() { window.location.href = '{$url}'; }, 0)</script>";
}
//
$key = Request::input('key');
if ($key) {
$id = md5($key);
Cache::put("Download::" . $id, $key, Carbon::now()->addDay());
return Redirect::to(Base::fillUrl('download/' . $id), 301);
}
return Base::ajaxError("Timeout", [], 0, 403);
}
/**
* 接口文档
* @return \Illuminate\Http\RedirectResponse

View File

@ -157,7 +157,6 @@ export default {
params = data.params || {};
}
url = $A.urlAddParams(url, params);
url = $A.apiUrl(`../download?key=${encodeURIComponent(url)}`)
if ($A.Electron) {
$A.Electron.request({action: 'openExternal', url}, () => {
// 成功