You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Global-sales/doc/运维语句.sql

182 lines
6.6 KiB
MySQL

## 查找出掉线的 WhatsApp
select *
from whatsapp_individual.connections
where status IN ('offline')
and wa_id not in ('8618777396951', '8613557032060','8613317835586')
and wa_id <> 'null'
//
SELECT group_concat(opi_sn separator ',') as 'sn_list' FROM (
SELECT
opi_sn,COUNT(*)
FROM whatsapp_session
where opi_sn is not null and opi_sn not in (29,383,404,227)
AND (last_send_time >= '2024-4-15' AND last_send_time <= '2024-4-21')
GROUP by opi_sn
) session_count
SELECT
OPI_SN, OPI_Code,OPI_Name,OPI_DEI_SN,OPI_FirstName,OPI_RealName
FROM
dbo.OperatorInfo
where
DeleteFlag = 0 and
OPI_SN in (162,31,32,33,34,599,600,353,352,350,351,35,606,495,293,525,114,587,585,519,522,476,354,451,216,143,586,539,370,512)
// HT
SELECT opi.OPI_Code,
opi.OPI_Name, tpa.* FROM dbo.ThirdPlatformAccount_Bind tpa
left join OperatorInfo opi
on opi.opi_sn = tpa.TPA_OPI_SN
where opi.DeleteFlag = 0
//
SELECT *
FROM whatsapp_session
WHERE coli_sn = 0 AND last_received_time IS NOT NULL ## AND opi_sn = 599
ORDER BY last_received_time DESC
// WA
SELECT *
FROM whatsapp_session
WHERE whatsapp_phone_number_bak IS not NULL
/**
* ---------------------------------------------------------
*
*/
-- title: query order info
SELECT cli.COLI_ID,cli.COLI_SN
,cli.COLI_GRI_SN
,mi.MEI_SN
-- ,cl.CUL_SN
,oi.OPI2_Name AS
,'#-------#'
,cli.COLI_OrderStartDate
,(mi.MEI_FirstName + ' | '+ mi.MEI_LastName) AS member_name
,cli.*
,'#-------#',cl.*
,'#-------#', mi.*
FROM ConfirmLineInfo AS cli
LEFT JOIN CUstomerList AS cl ON cli.COLI_SN = cl.CUL_COLI_SN
LEFT JOIN MEmberInfo AS mi ON mi.MEI_SN = cl.CUL_CUI_SN
LEFT JOIN OperatorInfo2 AS oi ON oi.opi2_opi_sn = cli.COLI_OPI_ID AND oi.OPI2_LGC =2
WHERE 1 = 1
-- AND mi.MEI_FirstName = 'CHEN WANG'
AND COLI_ID = 'Lib231120146'
-- AND CUL_COLI_SN = 1086888
--
;
UPDATE whatsapp_session
SET coli_sn = 1075451
WHERE sn = 57 AND whatsapp_phone_number = '14048496022';
UPDATE whatsapp_inboundmessage msg
INNER JOIN whatsapp_session s ON s.whatsapp_phone_number = msg.froms
AND msg.msg_direction = 'inbound'
SET msg.coli_sn = s.coli_sn
WHERE ifnull(msg.coli_sn, 0) = 0
AND msg.msg_direction = 'inbound'
AND msg.froms = '393343998897';
UPDATE whatsapp_inboundmessage msg
INNER JOIN whatsapp_session s ON s.whatsapp_phone_number = msg.tos
AND msg.msg_direction = 'outbound'
SET msg.coli_sn = s.coli_sn
WHERE ifnull(msg.coli_sn, 0) = 0
AND msg.msg_direction = 'outbound'
AND msg.tos = '393343998897';
/**
* end
* ---------------------------------------------------------
*/
/**
* ---------------------------------------------------------
*
*/
INSERT INTO sale_system.whatsapp_session (
whatsapp_phone_number,whatsapp_name, opi_sn,coli_sn,session_enable)
VALUES ('6282145142470','',162,0,1);
/**
* end
* ---------------------------------------------------------
*/
/**
* ---------------------------------------------------------
*
* , WhatsApp
* 1. coli_sn, coli_id, whatsapp_name
* 2. : tos, coli_sn
*/
UPDATE sale_system.whatsapp_session
SET whatsapp_name='Luiz Ribeiro', coli_sn=1092511, coli_id='L240509014'
WHERE whatsapp_phone_number='553499923993' AND opi_sn = 587;
UPDATE sale_system.whatsapp_inboundmessage
SET tos='553499923993', coli_sn=1092511
WHERE tos = '5534999923993' AND opi_sn = 587;
/**
* end
* ---------------------------------------------------------
*/
/**
WhatsApp
*/
select * from whatsapp_user
##where wau_opi_sn in (252, 261,264,265,330,360,376,413,421,453,605,620) ## 国际部
where wau_opi_sn in (495, 143, 370, 114, 513, 514, 517, 522, 550, 587,354, 414, 599, 606, 639, 648, 654, 662, 674, 676,391, 451, 476, 501, 512, 525, 528, 585, 586, 644) ## GH
-- 查找每个服务器在线的 WA 数量
select connect_name, count(*)
from whatsapp_individual.connections
where status IN ('open')
group by connect_name
set SESSION group_concat_max_len=4294967295;
-- 查找已经配置 WAI 服务的顾问
select group_concat(wau_whatsapp separator ''',''') as 'sn_list'
from sale_system.whatsapp_user
where wau_wai_server is not null
## 查找在线的 WhatsApp
SELECT group_concat(sesson_id separator ''',''') as 'sesson_list'
FROM whatsapp_individual.connections
where status = 'open'
-- 查找掉线的顾问
select group_concat(sesson_id separator ''',''') as 'sesson_list' from whatsapp_individual.connections
where status IN ('offline')
and wa_id not in ('8618777396951', '8613557032060','8613317835586')
## 查找 GH 没有扫码登录的顾问
select group_concat(wau_opi_sn separator ',') as 'sn_list'
from whatsapp_user
where wau_whatsapp not in ('8613317835586','8617607732272','8613978392676','8618378304803','8617607730629','8619107833371','8619107835971','8617607731491','8615080129281','8617607737720','8618777396951','8618078444860','8615778462307','8617774702925','8615078398450','8619178340224','8617607731153','8617607735120','8617607737646','8618877388203','8615778493040','8613617733956','8618290167273','8617776515283','8617607736381','8613557032060','8613667839691','8618378388403','8613635132972','8617607734598','8617607732512','8615878340720')
and wau_opi_sn in (495, 143, 370, 114, 513, 514, 517, 522, 550, 587,354, 414, 599, 606, 639, 648, 654, 662, 674, 676,391, 451, 476, 501, 512, 525, 528, 585, 586, 644)
-- 查找使用 WhatsApp 顾问信息
SELECT
OPI_SN, OPI_Code,OPI_Name,OPI_DEI_SN,OPI_FirstName,OPI_RealName, DeleteFlag
FROM
dbo.OperatorInfo WHERE
OPI_SN in (143,476,528,391)
--OPI_SN in (495, 143, 370, 114, 513, 514, 517, 522, 550, 587)
SELECT OPI_RealName + '(' + CAST(OPI_SN AS VARCHAR(100)) + ')',OPI_SN
FROM
dbo.OperatorInfo
where
--DeleteFlag = 0 and
OPI_SN in (79,85,114,119,135,143,155,162,178,210,216,222,225,252,261,264,265,273,293,296,311,330,343,347,348,354,360,370,376,387,391,412,413,414,421,441,444,451,453,456,466,468,476,495,497,501,509,512,513,514,517,519,522,525,527,528,539,550,573,585,586,587,592,599,600,605,606,611,617,620,639,644,648,654,656,659,662,663,674,676,690,691)
and OPI_RealName in ('兰芬','孙俊垚','王继伟','曾君','潘宏宇','郑美珍','张丽娟','张倩倩','赵泽菲','王影','陆力影','吕燕珍','何秋云','沈慧香')