Ver código fonte

企业微信聊天测试

xyxie 1 mês atrás
pai
commit
72750d750a
2 arquivos alterados com 14 adições e 4 exclusões
  1. 1 1
      services/day_new.go
  2. 13 3
      services/wework/wework_audit_linux.go

+ 1 - 1
services/day_new.go

@@ -81,7 +81,7 @@ func DayNewWeworkMsgRefresh() (err error) {
 			continue
 		}
 		if limitRoomId != "" {
-			if v.RoomID != limitRoomId {
+			if v.RoomID == "wrPhSiBwAAQcw_fTWXizaK3mIBMG9LAA" {
 				continue
 			}
 		}

+ 13 - 3
services/wework/wework_audit_linux.go

@@ -32,7 +32,7 @@ func (w *WeWorkMsgAuditClient) GetMsgAuditContent(seq, limit uint64, timeout int
 			return
 		}
 		if chatInfo.Type == "image" {
-			/*image, _ := chatInfo.GetImageMessage()
+			image, _ := chatInfo.GetImageMessage()
 			sdkFileID := image.Image.SdkFileID
 
 			isFinish := false
@@ -53,14 +53,24 @@ func (w *WeWorkMsgAuditClient) GetMsgAuditContent(seq, limit uint64, timeout int
 				indexBuf = mediaData.OutIndexBuf
 			}
 			filePath, _ := os.Getwd()
-			filePath = path.Join(filePath, "test.png")
+			filePath = path.Join(filePath, image.Image.FileName)
 			err := ioutil.WriteFile(filePath, buffer.Bytes(), 0666)
 			if err != nil {
 				utils.FileLog.Info(fmt.Sprintf("文件存储失败:%v \n", err))
 				errMsg = errors.New("企业微信 文件存储失败:"+err.Error())
 				return
 			}
-			break*/
+			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,
+			})
 			continue
 		}else if chatInfo.Type == "text" {
 			msg, err := chatInfo.GetTextMessage()