def on_merge_files_and_zip(self, command):
     files = command["filesPath"]
     zipPath = command["zipPath"]
     success = True
     message = "成功!"
     try:
         # 在zipPath所在目录下,创建临时文件夹
         dir = os.path.split(zipPath)[0]
         dir = dir + "/" + str(int(time.time()))
         FileUtil.validate_folder_exists(dir, True)
         # 把源文件列表复制到临时文件下
         for file in files:
             dst = dir + "/" + os.path.split(file)[1]
             if os.path.isfile(file):
                 FileUtil.copy_file(file, dst)
             else:
                 FileUtil.copy_folder(file, dst)
         # 压缩文件夹
         FileUtil.zip_dir(dir, zipPath)
         # 删除文件夹
         FileUtil.remove_file(dir)
     except Exception as e:
         success = False
         message = str(e)
     finally:
         return {"success": success, "message": message}
 def on_copy_file_to_dir(self, command):
     originPath = command["originPath"]
     destPath = command["destPath"]
     success = True
     message = "成功!"
     try:
         # 判断文件是否存在
         FileUtil.validate_file_exists(originPath)
         # 判断文件夹是否存在
         FileUtil.validate_folder_exists(os.path.dirname(destPath), True)
         # 复制文件到指定目录
         FileUtil.copy_file(originPath, destPath)
     except Exception as e:
         success = False
         message = str(e)
     finally:
         return {"success": success, "message": message}