mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
整理下载文件跳转
This commit is contained in:
parent
457efa1c79
commit
ce03296078
@ -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
|
||||
|
||||
1
resources/assets/js/store/actions.js
vendored
1
resources/assets/js/store/actions.js
vendored
@ -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}, () => {
|
||||
// 成功
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user