Update send-message-helper.js

This commit is contained in:
huxuejian 2026-03-05 11:00:32 +08:00
parent 92cf611395
commit 28405cd0fb

View File

@ -180,12 +180,6 @@ export async function sendArticleMessage(article, options = {}) {
url: article.url || '',
messageType: 'article',
};
// 发送自定义消息
const result = await globalTimChatManager.sendCustomMessage(customMessageData);
if (result?.success) {
// 记录文章发送记录(异步,不阻塞)
if (options.articleId && options.userId && options.customerId && options.corpId) {
const params = {
articleId: options.articleId,
@ -197,11 +191,18 @@ export async function sendArticleMessage(article, options = {}) {
if (options.teamId) {
params.teamId = options.teamId;
}
api('addArticleSendRecord', params).catch((err) => {
console.error('记录文章发送失败:', err);
});
const res = await api('addArticleSendRecord', params);
if (!res || !res.success) {
toast('发送文章失败');
return
}
customMessageData.sendId = res.data;
}
// 发送自定义消息
const result = await globalTimChatManager.sendCustomMessage(customMessageData);
if (result?.success) {
// 写入服务记录留痕(异步,不阻塞)
if (canWriteServiceRecord(options)) {
const base = normalizeServiceRecordBase(options);