CHOptimizedMethod2(
self
, void, DTMojoMessageService, didUpdatedNewMessagesWithCid,
id
, arg1, newMessages, NSArray <DTMessageImp
*
>
*
, arg2) {
CHSuper2(DTMojoMessageService, didUpdatedNewMessagesWithCid, arg1, newMessages, arg2);
DTMessageImp
*
message
=
arg2.firstObject;
/
/
@我并且是文本消息
YYLog(@
"atOpenIds=%@="
, message.atOpenIds);
/
/
从该日志里获取到自己的openid
if
([message.atOpenIds.allKeys containsObject:[NSNumber numberWithLongLong:
263527137
]] &&
message.messageType
=
=
1
) {
@try
{
id
<DTMessageContentText> messageContent
=
(
id
)message.messageContent;
NSString
*
content
=
[DingTalkRobot messageContent:messageContent.text];
NSString
*
nickName
=
[[DingTalkRobot contactService] getNickByUid:message.senderId];
/
/
0
内容,
1
消息
id
,
2
,发送人
id
,
3
发送人昵称,
4
会话
id
NSArray
*
messageInfo
=
@[content,[NSString stringWithFormat:@
"%lld"
, message.messageId], [NSString stringWithFormat:@
"%lld"
, message.senderId], nickName, message.conversationId];
NSString
*
messageString
=
[messageInfo componentsJoinedByString:@
"|"
];
YYLog(@
"redis rpush=%@="
, messageString);
[[[[DingTalkRobot shared].redis rpush:task_queue value:messageString] then:^
id
(
id
value) {
YYLog(@
"redis rpush result =%@="
, value);
return
nil;
}] catch:^
id
(NSError
*
err) {
YYLog(@
"redis rpush err =%@="
, err);
return
nil;
}];
} @catch (NSException
*
exception) {
} @
finally
{
}
}
}