mirror of
https://gitee.com/zhangsken/aliyunpan.git
synced 2026-10-16 02:23:49 +08:00
add downloadActionId for download JS plugin
This commit is contained in:
@@ -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