From 8d3f00119a9cfeab0728827e78741af1e083cff5 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 27 Feb 2024 15:20:55 +0800 Subject: [PATCH] conf: --- import saleSmartly contacts.sql | 50 +++++++++++++++++++ src/actions/ConversationActions.js | 3 +- src/config.js | 1 + src/lib/msgUtils.js | 3 +- src/stores/ConversationStore.js | 2 +- .../Components/Input/Template.jsx | 4 +- 6 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 import saleSmartly contacts.sql diff --git a/import saleSmartly contacts.sql b/import saleSmartly contacts.sql new file mode 100644 index 0000000..387ebb8 --- /dev/null +++ b/import saleSmartly contacts.sql @@ -0,0 +1,50 @@ + +-- 601 王露加(AH) Ann Wang +UPDATE WhatsApp_Session +SET opi_sn =601 +WHERE opi_sn is null and whatsapp_phone_number IN ('600123021806', '919421671750', '61438817779', '393406100983', '12032531996', '60197799795', '447788271298', '6598239020', '4407788271298', '6584686731', '60123075151', '60194903126', '13238286927', '6596966465', '6598267067', '14048496022', '6598809877', '628111663399', '60166268901', '19376202088', '62811907069', '61402445619', '393343998897', '6589475894', '41768308393', '1919324583030', '6598410895', '6593838816', '610402445619', '6592707262', '610431280050', '62811265987', '447702101254', '4407702101254', '85295012200', '10438012756', '15127570944', '13038837142', '6594890344', '13053353222'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =601 +WHERE froms IN ('600123021806', '919421671750', '61438817779', '393406100983', '12032531996', '60197799795', '447788271298', '6598239020', '4407788271298', '6584686731', '60123075151', '60194903126', '13238286927', '6596966465', '6598267067', '14048496022', '6598809877', '628111663399', '60166268901', '19376202088', '62811907069', '61402445619', '393343998897', '6589475894', '41768308393', '1919324583030', '6598410895', '6593838816', '610402445619', '6592707262', '610431280050', '62811265987', '447702101254', '4407702101254', '85295012200', '10438012756', '15127570944', '13038837142', '6594890344', '13053353222'); + + +-- 487 杨新玲(AH) COCO +UPDATE WhatsApp_Session +SET opi_sn =487 +WHERE opi_sn is null and whatsapp_phone_number IN ( +'12103817205','17758484963','60149483183','6281510103434','628119782869','447752219225','12084122282','15083266574','14402632632','918178744977','12106891804','573206915405','12035084239','6591793713','6596303740','16507507777','13146235967','610402933421','19738008090','16025109980','14156139002','85569570025','23052514484','16135487944','18052166879','972522554653','270824611177','34651307209','41796154103','393421384738','19084563966','971568748804','84979380502','491785727904','4901785727904','6598227132','16179352409','4915122297678','15163772972','447539174554','447539174554','16025109980','19166276277','610415682199','447766318643','4407766318643','8201068091987','41796154103','918587901086','918587901086'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =487 +WHERE froms IN ( +'12103817205','17758484963','60149483183','6281510103434','628119782869','447752219225','12084122282','15083266574','14402632632','918178744977','12106891804','573206915405','12035084239','6591793713','6596303740','16507507777','13146235967','610402933421','19738008090','16025109980','14156139002','85569570025','23052514484','16135487944','18052166879','972522554653','270824611177','34651307209','41796154103','393421384738','19084563966','971568748804','84979380502','491785727904','4901785727904','6598227132','16179352409','4915122297678','15163772972','447539174554','447539174554','16025109980','19166276277','610415682199','447766318643','4407766318643','8201068091987','41796154103','918587901086','918587901086'); + +-- 603 秦雯萱(AH) Dora +UPDATE WhatsApp_Session +SET opi_sn =603 +WHERE opi_sn is null and whatsapp_phone_number IN ('19013561781','6285811111175','62889692159816','60162185779','6287888722293','60126518499','60126183248','17789950848','610455289205','60123152286','6060126518499','15185983270','6594319127','19013561781','14104266170','16174120590','6597969282','6591714969','18476483195','6592976545','6590095741','66818890118','447545084704','6596921770','447917350605','4407917350605'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =603 +WHERE froms IN ('19013561781','6285811111175','62889692159816','60162185779','6287888722293','60126518499','60126183248','17789950848','610455289205','60123152286','6060126518499','15185983270','6594319127','19013561781','14104266170','16174120590','6597969282','6591714969','18476483195','6592976545','6590095741','66818890118','447545084704','6596921770','447917350605','4407917350605'); + + +-- 606 莫梦瑶 Glory +UPDATE WhatsApp_Session +SET opi_sn =606 +WHERE opi_sn is null and whatsapp_phone_number IN ('6285762428379'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =606 +WHERE froms IN ('6285762428379'); + +-- 586 秦宇尘 Jimmy +UPDATE WhatsApp_Session +SET opi_sn =606 +WHERE opi_sn is null and whatsapp_phone_number IN ('17736215303'); + +UPDATE WhatsApp_InboundMessage +SET opi_sn =606 +WHERE froms IN ('17736215303'); + diff --git a/src/actions/ConversationActions.js b/src/actions/ConversationActions.js index 2550cd4..1b8bd66 100644 --- a/src/actions/ConversationActions.js +++ b/src/actions/ConversationActions.js @@ -2,8 +2,7 @@ import { groupBy } from '@/utils/utils'; import { fetchJSON, postJSON } from '@/utils/request' import { parseRenderMessageList } from '@/lib/msgUtils'; - -const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; +import { API_HOST } from '@/config'; export const fetchTemplates = async () => { const data = await fetchJSON(`${API_HOST}/listtemplates`); diff --git a/src/config.js b/src/config.js index 0648149..cfb8723 100644 --- a/src/config.js +++ b/src/config.js @@ -1,2 +1,3 @@ export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server' +export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod: export const DATE_FORMAT = 'YYYY-MM-DD' diff --git a/src/lib/msgUtils.js b/src/lib/msgUtils.js index fa200dd..9f4eb48 100644 --- a/src/lib/msgUtils.js +++ b/src/lib/msgUtils.js @@ -14,7 +14,7 @@ export const replaceTemplateString = (str, replacements) => { return result; } -const autoLinkText = (text) => { +export const autoLinkText = (text) => { let regex = /(https?:\/\/[^\s]+)/g; let newText = text.replace(regex, '$1'); @@ -85,7 +85,6 @@ export const sentMsgTypeMapped = { whatsappTemplate: { contentToSend: (msg) => ({ action: 'message', actionId: msg.id, renderId: msg.id, to: msg.to, msgtype: 'template', msgcontent: msg.template }), contentToRender: (msg) => { - console.log(msg); const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({ ...r, [v.type]: v }), {}) : null; // const templateParam = (templateDataMapped?.body?.parameters || []).map(e => e.text); // const fillTemplate = templateParam.length ? replaceTemplateString(msg.template_origin.components.body?.[0]?.text || '', templateParam) : (msg.template_origin.components.body?.[0]?.text || ''); diff --git a/src/stores/ConversationStore.js b/src/stores/ConversationStore.js index aca1503..4bf89be 100644 --- a/src/stores/ConversationStore.js +++ b/src/stores/ConversationStore.js @@ -4,10 +4,10 @@ import { olog, isEmpty } from '@/utils/utils'; import { receivedMsgTypeMapped } from '@/lib/msgUtils'; import { fetchConversationsList, fetchTemplates } from '@/actions/ConversationActions'; import { devtools } from 'zustand/middleware'; +import { WS_URL } from '@/config'; // const WS_URL = 'ws://202.103.68.144:8888/whatever/'; // const WS_URL = 'ws://120.79.9.217:10022/whatever/'; -const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod: const initialConversationState = { // websocket: null, diff --git a/src/views/Conversations/Components/Input/Template.jsx b/src/views/Conversations/Components/Input/Template.jsx index 8db6f02..33f74f2 100644 --- a/src/views/Conversations/Components/Input/Template.jsx +++ b/src/views/Conversations/Components/Input/Template.jsx @@ -118,7 +118,7 @@ const InputTemplate = ({ disabled = false, invokeSendMessage }) => { }; return ( <> - @@ -134,7 +134,7 @@ const InputTemplate = ({ disabled = false, invokeSendMessage }) => { placeholder='搜索名称' />