|
|
@ -70,7 +70,11 @@ func (f *FileService) Compress(args *ZipBlock, reply *string) error { |
|
|
// 合并为实际路径
|
|
|
// 合并为实际路径
|
|
|
remotePath := path.Join("/www/wwwroot", args.RemotePath, zpFileName) |
|
|
remotePath := path.Join("/www/wwwroot", args.RemotePath, zpFileName) |
|
|
// 异步发送文件到远程服务器上
|
|
|
// 异步发送文件到远程服务器上
|
|
|
go clientUploadFile(args.RemoteAddr, ziprl, remotePath) |
|
|
|
|
|
|
|
|
go func() { |
|
|
|
|
|
clientUploadFile(args.RemoteAddr, ziprl, remotePath) |
|
|
|
|
|
taskId <- "upok" |
|
|
|
|
|
}() |
|
|
|
|
|
|
|
|
// 返回压缩包名称
|
|
|
// 返回压缩包名称
|
|
|
*reply = ziprl |
|
|
*reply = ziprl |
|
|
@ -103,7 +107,6 @@ func clientUploadFile(remote string, filePath string, uploadPath string) { |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
logger.Error("TransferFile failed", zap.Error(err)) |
|
|
logger.Error("TransferFile failed", zap.Error(err)) |
|
|
fmt.Printf("TransferFile failed: %v\n", err) |
|
|
fmt.Printf("TransferFile failed: %v\n", err) |
|
|
return |
|
|
|
|
|
} |
|
|
} |
|
|
fmt.Printf("TransferFile success\n") |
|
|
fmt.Printf("TransferFile success\n") |
|
|
|
|
|
|
|
|
@ -111,8 +114,9 @@ func clientUploadFile(remote string, filePath string, uploadPath string) { |
|
|
|
|
|
|
|
|
// 传输文件
|
|
|
// 传输文件
|
|
|
func (c *UpFileClient) TransferFile(filePath string, uploadPath string) error { |
|
|
func (c *UpFileClient) TransferFile(filePath string, uploadPath string) error { |
|
|
fmt.Printf("TransferFile filePath: %s, uploadPath: %s\n", filePath, uploadPath) |
|
|
|
|
|
// 发送文件信息
|
|
|
// 发送文件信息
|
|
|
|
|
|
fmt.Printf("TransferFile filePath: %s, uploadPath: %s\n", filePath, uploadPath) |
|
|
// 获取文件信息
|
|
|
// 获取文件信息
|
|
|
fileInfo, err := os.Stat(filePath) |
|
|
fileInfo, err := os.Stat(filePath) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
|