Ver Fonte

docs:更新会话存档README.md文件内的示例代码 (#527)

Afeyer há 4 anos atrás
pai
commit
0d915d203b
1 ficheiros alterados com 8 adições e 6 exclusões
  1. 8 6
      work/msgaudit/README.md

+ 8 - 6
work/msgaudit/README.md

@@ -34,13 +34,13 @@ import (
 func main() {
 	//初始化客户端
 	wechatClient := wechat.NewWechat()
-	
+
 	workClient := wechatClient.GetWork(&config.Config{
 		CorpID:        "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
 		CorpSecret:    "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
 		RasPrivateKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
 	})
-	
+
 	client, err := workClient.GetMsgAudit()
 	if err != nil {
 		fmt.Printf("SDK 初始化失败:%v \n", err)
@@ -64,13 +64,14 @@ func main() {
 
 		if chatInfo.Type == "image" {
 			image, _ := chatInfo.GetImageMessage()
-			sdkfileid := image.Image.SdkFileID
+			sdkFileID := image.Image.SdkFileID
 
 			isFinish := false
 			buffer := bytes.Buffer{}
+			indexBuf := ""
 			for !isFinish {
 				//获取媒体数据
-				mediaData, err := client.GetMediaData("", sdkfileid, "", "", 5)
+				mediaData, err := client.GetMediaData(indexBuf, sdkFileID, "", "", 5)
 				if err != nil {
 					fmt.Printf("媒体数据拉取失败:%v \n", err)
 					return
@@ -79,6 +80,7 @@ func main() {
 				if mediaData.IsFinish {
 					isFinish = mediaData.IsFinish
 				}
+				indexBuf = mediaData.OutIndexBuf
 			}
 			filePath, _ := os.Getwd()
 			filePath = path.Join(filePath, "test.png")
@@ -90,11 +92,11 @@ func main() {
 			break
 		}
 	}
-	
+
 	//释放SDK实例
 	client.Free()
 }
 
 
 
-```
+```