sendMessage: 不等待

dev/supplier-email-drawer
Lei OT 9 months ago
parent 2abdc6ccaf
commit 448693d304

@ -12,6 +12,7 @@
export const WAI_HOST = 'http://202.103.68.93:3031/api/v1';
export const EMAIL_ATTA_HOST = 'https://p9axztuwd7x8a7.mycht.cn/attatchment'; // 邮件附件
// prod:
// export const WAI_HOST = 'https://wai-server-qq4qmtq7wc9he4.mycht.cn/api/v1';
export const EMAIL_HOST = 'https://p9axztuwd7x8a7.mycht.cn/mail-server/service-mail';
export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server/v2';
export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod:

@ -7,14 +7,6 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
exports.sendText111 = async ctx => {
const { type } = ctx.params;
const body = ctx.request.body;
ctx.assert(null, 400, `debug: content: {${type}} {${body.content}}`);
ctx.assert(null, 400, 'The message info is malformed!');
return body;
};
exports.sendText = async ctx => {
const { from, to, content } = ctx.request.body;
if (!from || !content) {
@ -29,7 +21,7 @@ exports.sendText = async ctx => {
}
// return wsToSend;
try {
await wsToSend.sendTextMessage(to, content);
wsToSend.sendTextMessage(to, content);
return 'Message sent successfully'; // { wsToSend, ret: 'Message sent successfully' };
} catch (error) {
console.error('Error sending message:', error);

Loading…
Cancel
Save