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