Skip to content

Commit 691bb86

Browse files
author
funcodingdev
committed
fix: 修复撤回应用消息BUG
1 parent 3a3e3d6 commit 691bb86

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

nodes/WeCom/resources/message/execute.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,35 @@ export async function executeMessage(
4040
const credentials = await this.getCredentials('weComApi');
4141
const agentId = credentials.agentId as string;
4242

43+
if (operation === 'recallMessage') {
44+
const msgid = this.getNodeParameter('msgid', i) as string;
45+
46+
const recallBody = {
47+
msgid,
48+
};
49+
50+
const response = await weComApiRequest.call(
51+
this,
52+
'POST',
53+
'/cgi-bin/message/recall',
54+
recallBody,
55+
);
56+
57+
returnData.push({
58+
json: response as IDataObject,
59+
pairedItem: { item: i },
60+
});
61+
continue;
62+
}
63+
4364
// 获取接收人信息(支持新旧两种方式)
4465
let touser = '';
4566
let toparty = '';
4667
let totag = '';
4768

4869
// 检查是否使用新的接收人选择方式
4970
const recipientType = this.getNodeParameter('recipientType', i, null) as string | null;
50-
71+
5172
if (recipientType !== null) {
5273
// 新方式:使用 recipientType 选择
5374
const touserArray = this.getNodeParameter('touser', i, []) as string[];
@@ -1126,26 +1147,6 @@ export async function executeMessage(
11261147
body,
11271148
);
11281149

1129-
returnData.push({
1130-
json: response as IDataObject,
1131-
pairedItem: { item: i },
1132-
});
1133-
continue;
1134-
} else if (operation === 'recallMessage') {
1135-
const msgid = this.getNodeParameter('msgid', i) as string;
1136-
1137-
const recallBody = {
1138-
msgid,
1139-
};
1140-
1141-
// 使用撤回消息接口
1142-
const response = await weComApiRequest.call(
1143-
this,
1144-
'POST',
1145-
'/cgi-bin/message/recall',
1146-
recallBody,
1147-
);
1148-
11491150
returnData.push({
11501151
json: response as IDataObject,
11511152
pairedItem: { item: i },

0 commit comments

Comments
 (0)