add sample code for js plugin

This commit is contained in:
tickstep
2025-03-05 20:47:56 +08:00
parent fb07969bb1
commit 94c24ebf16
3 changed files with 25 additions and 13 deletions
+12 -12
View File
@@ -127,16 +127,16 @@ function downloadFilePrepareCallback(context, params) {
function downloadFileFinishCallback(context, params) { function downloadFileFinishCallback(context, params) {
console.log(params) console.log(params)
// 云盘文件成功下载到本地后,删除云盘的文件 // // 云盘文件成功下载到本地后,删除云盘的文件
if (params["downloadResult"] == "success") { // if (params["downloadResult"] == "success") {
if (params["driveFileType"] == "file") { // if (params["driveFileType"] == "file") {
// 文件下载成功,删除该云盘文件 // // 文件下载成功,删除该云盘文件
var userId = context["userId"] // var userId = context["userId"]
var driveId = params["driveId"] // var driveId = params["driveId"]
var driveFileId = params["driveFileId"] // var driveFileId = params["driveFileId"]
if (PluginUtil.PanFS.deleteFile(userId, driveId, driveFileId)) { // if (PluginUtil.PanFS.deleteFile(userId, driveId, driveFileId)) {
console.log("插件删除云盘文件成功:" + params["driveFilePath"]) // console.log("插件删除云盘文件成功:" + params["driveFilePath"])
} // }
} // }
} // }
} }
+12
View File
@@ -202,6 +202,18 @@ function syncScanPanFilePrepareCallback(context, params) {
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
function syncFileFinishCallback(context, params) { function syncFileFinishCallback(context, params) {
console.log(params) console.log(params)
// 云盘文件成功下载到本地后,删除云盘的文件
// if (params["action"] == "download") {
// if (params["actionResult"] == "success" && params["fileType"] == "file") {
// // 文件下载成功,删除该云盘文件
// var userId = context["userId"]
// var driveId = params["driveId"]
// var driveFileId = params["driveFileId"]
// if (PluginUtil.PanFS.deleteFile(userId, driveId, driveFileId)) {
// console.println("插件删除云盘文件成功:" + params["filePath"])
// }
// }
// }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
+1 -1
View File
@@ -84,8 +84,8 @@ func DeletePanFile(userId, driveId, panFileId string) bool {
return false return false
} else { } else {
logger.Verboseln("[Plugin] delete pan file success: ", panFileId) logger.Verboseln("[Plugin] delete pan file success: ", panFileId)
return true
} }
return false
} }
// SendTextMail 发送文本邮件 // SendTextMail 发送文本邮件