Skip to content

Commit

Permalink
docs:更新会话存档README.md文件内的示例代码 (silenceper#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
NICEXAI authored Jan 9, 2022
1 parent 172c4ab commit 0d915d2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions work/msgaudit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -79,6 +80,7 @@ func main() {
if mediaData.IsFinish {
isFinish = mediaData.IsFinish
}
indexBuf = mediaData.OutIndexBuf
}
filePath, _ := os.Getwd()
filePath = path.Join(filePath, "test.png")
Expand All @@ -90,11 +92,11 @@ func main() {
break
}
}

//释放SDK实例
client.Free()
}



```
```

0 comments on commit 0d915d2

Please sign in to comment.