Browse Source

成功返回true字符串

master
xyiege 4 months ago
parent
commit
9c9b162cd8
  1. 10
      scagent/core/UpFile.go

10
scagent/core/UpFile.go

@ -37,21 +37,23 @@ func (f *UpFileService) SendFileInfo(info FileInfo, reply *string) error {
// }
// 提取路径 /www/wwwroot/bidemo.com/BIU_20250918_183144.zip
fmt.Printf("SendFileInfo fileName: %s\n", info.FileName)
// fmt.Printf("SendFileInfo fileName: %s\n", info.FileName)
dirPath := filepath.Dir(info.FileName)
logger.Info("SendFileInfo", zap.String("dirPath", dirPath))
// *reply = fmt.Sprintf("folder: %s is exists", dirPath)
// 检查文件夹是否存在
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
// 文件夹不存在,创建它
if err := os.MkdirAll(dirPath, 0755); err != nil {
logger.Error("SendFileInfo mkdir failed", zap.Error(err))
*reply = fmt.Sprintf("mkdir folder: %s failed", dirPath)
// *reply = fmt.Sprintf("mkdir folder: %s failed", dirPath)
// return err
}
}
*reply = fmt.Sprintf("folder: %s is exists", dirPath)
// *reply = true
// *reply = fmt.Sprintf("folder: %s is exists", dirPath)
// 返回true的字符串
*reply = "true"
return nil
}

Loading…
Cancel
Save