mirror of
https://gitee.com/zhangsken/aliyunpan.git
synced 2026-10-16 10:29:42 +08:00
add downloadActionId for download JS plugin
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
//
|
||||
// params - 文件下载前参数
|
||||
// {
|
||||
// "downloadActionId": "20976308-a026-450d-92b8-16a969fed0c6",
|
||||
// "driveId": "19519221",
|
||||
// "driveFileName": "token.bat",
|
||||
// "driveFilePath": "/aliyunpan/Downloads/token.bat",
|
||||
@@ -37,6 +38,7 @@
|
||||
// "driveFileUpdatedAt": "2022-04-14 07:05:12",
|
||||
// "localFilePath": "aliyunpan\\Downloads\\token.bat"
|
||||
// }
|
||||
// downloadActionId - 下载动作ID。同一次下载动作(download命令)下载的文件,这个ID都是同一个值。注意这个ID不是永久的,每执行一次download命令对生成一个对应ID。
|
||||
// driveId - 网盘ID
|
||||
// driveFileName - 网盘文件名
|
||||
// driveFilePath - 网盘文件绝对完整路径
|
||||
@@ -99,6 +101,7 @@ function downloadFilePrepareCallback(context, params) {
|
||||
//
|
||||
// params - 文件下载结束参数
|
||||
// {
|
||||
// "downloadActionId": "20976308-a026-450d-92b8-16a969fed0c6",
|
||||
// "driveId": "19519221",
|
||||
// "driveFileId": "65ebb9396d66dfcd9f25414bbdd81594ecb9fcd6",
|
||||
// "driveFileName": "token.bat",
|
||||
@@ -110,6 +113,7 @@ function downloadFilePrepareCallback(context, params) {
|
||||
// "downloadResult": "success",
|
||||
// "localFilePath": "aliyunpan\\Downloads\\token.bat"
|
||||
// }
|
||||
// downloadActionId - 下载动作ID。同一次下载动作(download命令)下载的文件,这个ID都是同一个值。注意这个ID不是永久的,每执行一次download命令对生成一个对应ID。
|
||||
// driveId - 网盘ID
|
||||
// driveFileId - 网盘文件ID
|
||||
// driveFileName - 网盘文件名
|
||||
|
||||
@@ -38,6 +38,8 @@ import (
|
||||
type (
|
||||
//DownloadOptions 下载可选参数
|
||||
DownloadOptions struct {
|
||||
// DownloadActionId 下载动作ID,唯一标识一次下载动作的ID。这个ID每次下载任务启动的时候会自动生成,同一次下载任务下载的文件,这个ID都是同一个值。
|
||||
DownloadActionId string
|
||||
IsPrintStatus bool
|
||||
IsExecutedPermission bool
|
||||
IsOverwrite bool
|
||||
@@ -131,6 +133,7 @@ func CmdDownload() cli.Command {
|
||||
}
|
||||
|
||||
do := &DownloadOptions{
|
||||
DownloadActionId: utils.UuidStr(),
|
||||
IsPrintStatus: c.Bool("status"),
|
||||
IsExecutedPermission: c.Bool("x"),
|
||||
IsOverwrite: c.Bool("ow"),
|
||||
@@ -405,6 +408,7 @@ func RunDownload(paths []string, options *DownloadOptions) {
|
||||
|
||||
// 匹配的文件
|
||||
unit := pandownload.DownloadTaskUnit{
|
||||
DownloadActionId: options.DownloadActionId,
|
||||
Cfg: &newCfg, // 复制一份新的cfg
|
||||
PanClient: panClient,
|
||||
SubPanClientList: subPanClientList,
|
||||
|
||||
@@ -43,7 +43,9 @@ import (
|
||||
type (
|
||||
// DownloadTaskUnit 下载的任务单元
|
||||
DownloadTaskUnit struct {
|
||||
taskInfo *taskframework.TaskInfo // 任务信息
|
||||
// DownloadActionId 下载动作ID,唯一标识一次下载动作的ID。这个ID每次下载任务启动的时候会自动生成,同一次下载任务下载的文件,这个ID都是同一个值。
|
||||
DownloadActionId string
|
||||
taskInfo *taskframework.TaskInfo // 任务信息
|
||||
|
||||
Cfg *downloader.Config
|
||||
PanClient *config.PanClient
|
||||
@@ -402,6 +404,7 @@ func (dtu *DownloadTaskUnit) pluginCallback(result string) {
|
||||
pluginManger := plugins.NewPluginManager(config.GetPluginDir())
|
||||
plugin, _ := pluginManger.GetPlugin()
|
||||
pluginParam := &plugins.DownloadFileFinishParams{
|
||||
DownloadActionId: dtu.DownloadActionId,
|
||||
DriveId: dtu.fileInfo.DriveId,
|
||||
DriveFileId: dtu.fileInfo.FileId,
|
||||
DriveFilePath: dtu.fileInfo.Path,
|
||||
@@ -464,6 +467,7 @@ func (dtu *DownloadTaskUnit) Run() (result *taskframework.TaskUnitRunResult) {
|
||||
localFilePath := strings.TrimPrefix(dtu.SavePath, dtu.OriginSaveRootPath)
|
||||
localFilePath = strings.TrimPrefix(strings.TrimPrefix(localFilePath, "\\"), "/")
|
||||
pluginParam := &plugins.DownloadFilePrepareParams{
|
||||
DownloadActionId: dtu.DownloadActionId,
|
||||
DriveId: dtu.fileInfo.DriveId,
|
||||
DriveFilePath: dtu.fileInfo.Path,
|
||||
DriveFileName: dtu.fileInfo.FileName,
|
||||
|
||||
@@ -66,6 +66,7 @@ type (
|
||||
DriveFileType string `json:"driveFileType"`
|
||||
DriveFileUpdatedAt string `json:"driveFileUpdatedAt"`
|
||||
LocalFilePath string `json:"localFilePath"`
|
||||
DownloadActionId string `json:"downloadActionId"`
|
||||
}
|
||||
|
||||
// DownloadFilePrepareResult 上传文件前的回调函数-返回结果
|
||||
@@ -88,6 +89,7 @@ type (
|
||||
DriveFileUpdatedAt string `json:"driveFileUpdatedAt"`
|
||||
DownloadResult string `json:"downloadResult"`
|
||||
LocalFilePath string `json:"localFilePath"`
|
||||
DownloadActionId string `json:"downloadActionId"`
|
||||
}
|
||||
|
||||
// SyncScanLocalFilePrepareParams 同步备份-扫描本地文件前参数
|
||||
|
||||
Reference in New Issue
Block a user