diff --git a/src/views/accounts/WAIQRCode.jsx b/src/views/accounts/WAIQRCode.jsx index 685353b..5a7273b 100644 --- a/src/views/accounts/WAIQRCode.jsx +++ b/src/views/accounts/WAIQRCode.jsx @@ -31,6 +31,11 @@ const WAIQRCode = ({ ...props }) => { .catch((ex) => { setQRStatus('expired') console.error(ex) + notification.warning({ + placement: 'top', + message: ex.message, + // description: ex.message, + }) }) }, []) diff --git a/wai-server/api/channels/channel.controller.js b/wai-server/api/channels/channel.controller.js index 8d7aa79..a174535 100644 --- a/wai-server/api/channels/channel.controller.js +++ b/wai-server/api/channels/channel.controller.js @@ -7,12 +7,13 @@ const { objectMapper, isEmpty } = require('../../utils/commons.util'); const { domain, name: domainName } = require('../../config').server; 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 { - 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); ctx.assert(whatsApp1, 503, 'No available connections'); whatsApp1.start();