diff --git a/baileys-server/main.js b/baileys-server/main.js index 8d3bd46..98d5119 100644 --- a/baileys-server/main.js +++ b/baileys-server/main.js @@ -41,11 +41,12 @@ const startSock = async () => { sock.sendMessage(whatsAppNo + '@s.whatsapp.net', { text: content }) } - const sendMediaMessage = (whatsAppNo, content) => { + const sendImageMessage = (whatsAppNo, content) => { sock.sendMessage(whatsAppNo + '@s.whatsapp.net', { - video: fs.readFileSync("d:\\Workspace\\1.jpg"), - caption: "hello!", - gifPlayback: true + image: { url: 'https://images.chinahighlights.com/allpicture/2024/09/4e2099ca48384c3c84cde6a44e47ee84_cut_1140x360_241_1726745163.webp'},//fs.readFileSync("d:\\Workspace\\1.jpg"), + caption: "我是图片", + gifPlayback: true, + ptv: false }) } @@ -90,12 +91,10 @@ const startSock = async () => { if (msg.message?.conversation || msg.message?.extendedTextMessage?.text) { const text = msg.message?.conversation || msg.message?.extendedTextMessage?.text - if (text.indexOf('图片')){ - sendMediaMessage('8617607730395', 'ddddd') - } else if (text.indexOf('文本')){ - sendMediaMessage('8617607730395', 'ddddd') - - sendTextMessage('8617607730395', '发送文本:' + new Date().toString()) + if (text.indexOf('图片') > -1){ + sendImageMessage('8617607730395', '文本消息' + new Date().toString()) + } else if (text.indexOf('文本') > -1){ + sendTextMessage('8617607730395', '文本消息' + new Date().toString()) } } } @@ -128,7 +127,7 @@ const startSock = async () => { // 扫码成功,可以发送消息 if (update.connection === 'open') { - await sock.sendMessage('8617607730395' + '@s.whatsapp.net', { text: 'oh ' + new Date().toDateString() }) + await sock.sendMessage('8617607730395' + '@s.whatsapp.net', { text: 'OPEN: ' + new Date().toString() }) } // WebSocket 创建成功等待扫码,如果没有扫码会更新 qr diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index fce1e0d..fe6802d 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -143,7 +143,7 @@ const useAuthStore = create(devtools((set, get) => ({ }, loadUserSession: () => { - let sessionData = window.localStorage.getItem('GLOBAL_SALES_LOGIN_USER') + let sessionData = window.sessionStorage.getItem('GLOBAL_SALES_LOGIN_USER') // if (window.location.hostname === '202.103.68.93' && window.location.port === '4173' && isEmpty(sessionData)) { // sessionData = `{"userId":"383","userIdStr":"383,609","emailList":[{"opi_sn":383,"mat_sn":760,"email":"lyj@asiahighlights.com","default":false,"backup":false},{"opi_sn":383,"mat_sn":759,"email":"lyj@chinahighlights.com","default":true,"backup":false},{"opi_sn":383,"mat_sn":758,"email":"lyj@hainatravel.com","default":false,"backup":false}],"username":"廖一军","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png","mobile":"+86-18777396951","email":"lyj@hainatravel.com","whatsAppBusiness":"8617458471254","openId":"iioljiPmZ4RPoOYpkFiSn7IKAiEiE","accountList":[{"OPI_SN":383,"OPI_Code":"LYJ","OPI_NameCN":"廖一军","OPI_DEI_SN":7,"OPI_NameEN":"Jimmy Liow"},{"OPI_SN":609,"OPI_Code":"LYJAH","OPI_NameCN":"廖一军(ah)","OPI_DEI_SN":28,"OPI_NameEN":"Jimmy Liow"}]}`