|
@@ -4,10 +4,15 @@
|
|
|
package wework
|
|
|
|
|
|
import (
|
|
|
+ "bytes"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
- "github.com/silenceper/wechat/v2/work/msgaudit"
|
|
|
"hongze/hongze_open_api/utils"
|
|
|
+ "io/ioutil"
|
|
|
+ "os"
|
|
|
+ "path"
|
|
|
+
|
|
|
+ "github.com/silenceper/wechat/v2/work/msgaudit"
|
|
|
)
|
|
|
|
|
|
func (w *WeWorkMsgAuditClient) GetMsgAuditContent(seq, limit uint64, timeout int) (list []msgaudit.TextMessage, seqRes uint64, errMsg error) {
|
|
@@ -53,7 +58,7 @@ func (w *WeWorkMsgAuditClient) GetMsgAuditContent(seq, limit uint64, timeout int
|
|
|
indexBuf = mediaData.OutIndexBuf
|
|
|
}
|
|
|
filePath, _ := os.Getwd()
|
|
|
- filePath = path.Join(filePath, image.Image.FileName)
|
|
|
+ filePath = path.Join(filePath, image.Image.Md5Sum)
|
|
|
err := ioutil.WriteFile(filePath, buffer.Bytes(), 0666)
|
|
|
if err != nil {
|
|
|
utils.FileLog.Info(fmt.Sprintf("文件存储失败:%v \n", err))
|
|
@@ -61,16 +66,17 @@ func (w *WeWorkMsgAuditClient) GetMsgAuditContent(seq, limit uint64, timeout int
|
|
|
return
|
|
|
}
|
|
|
utils.FileLog.Info(fmt.Sprintf("文件存储成功:%s \n", filePath))
|
|
|
- list = append(list, msgaudit.TextMessage{
|
|
|
- MsgId: image.MsgID,
|
|
|
- Action: image.Action,
|
|
|
- From: image.From,
|
|
|
- ToList: image.ToList,
|
|
|
- RoomId: image.RoomID,
|
|
|
- MsgTime: image.MsgTime,
|
|
|
- MsgType: image.MsgType,
|
|
|
- Content: filePath,
|
|
|
- })
|
|
|
+ var textMsg msgaudit.TextMessage
|
|
|
+ textMsg.MsgID = image.BaseMessage.MsgID
|
|
|
+ textMsg.Action = image.BaseMessage.Action
|
|
|
+ textMsg.From = image.BaseMessage.From
|
|
|
+ textMsg.ToList = image.BaseMessage.ToList
|
|
|
+ textMsg.RoomID = image.BaseMessage.RoomID
|
|
|
+ textMsg.MsgTime = image.BaseMessage.MsgTime
|
|
|
+ textMsg.Text.Content = filePath
|
|
|
+ list = append(list, textMsg)
|
|
|
+
|
|
|
+
|
|
|
continue
|
|
|
}else if chatInfo.Type == "text" {
|
|
|
msg, err := chatInfo.GetTextMessage()
|