perf: 请求登录qrcode: 已连接

dev/supplier-email-drawer
Lei OT 9 months ago
parent 75fddcf3f8
commit 086683f782

@ -31,6 +31,11 @@ const WAIQRCode = ({ ...props }) => {
.catch((ex) => { .catch((ex) => {
setQRStatus('expired') setQRStatus('expired')
console.error(ex) console.error(ex)
notification.warning({
placement: 'top',
message: ex.message,
// description: ex.message,
})
}) })
}, []) }, [])

@ -7,12 +7,13 @@ const { objectMapper, isEmpty } = require('../../utils/commons.util');
const { domain, name: domainName } = require('../../config').server; const { domain, name: domainName } = require('../../config').server;
exports.newConnect = async ctx => { exports.newConnect = async ctx => {
const { phone } = ctx.query;
const existsSession = sessionStore.getSession(phone);
if (!isEmpty(existsSession)) {
ctx.assert(null, 400, `WhatsApp ${phone} 已连接`);
// return { phone, session_id: phone, ...existsSession, stauts: 'open', wai_server: domain };
}
try { try {
const { phone } = ctx.query;
const existsSession = sessionStore.getSession(phone);
if (!isEmpty(existsSession)) {
return { phone, session_id: phone, ...existsSession, stauts: 'open', wai_server: domain };
}
const whatsApp1 = await createWhatsApp(phone); const whatsApp1 = await createWhatsApp(phone);
ctx.assert(whatsApp1, 503, 'No available connections'); ctx.assert(whatsApp1, 503, 'No available connections');
whatsApp1.start(); whatsApp1.start();

Loading…
Cancel
Save