Ajustes do sos para o omnihit da hit

pull/20/head
adriano 2023-06-21 17:04:12 -03:00
parent 47cb2904af
commit 6c7bba5a38
2 changed files with 113 additions and 53 deletions

View File

@ -21,12 +21,31 @@ const hitPortalMonitoring = async (centro_de_custo: string) => {
let data = '' let data = ''
let sub_data = '*Atualizações:*\n\n' let sub_data = '*Atualizações:*\n\n'
const properties: any = Object.entries(response2[i]); let properties: any = Object.entries(response2[i]);
for (let x = 0; x < properties.length; x++) { for (let x = 0; x < properties.length; x++) {
if (typeof (properties[x][1]) != 'object') { if (typeof (properties[x][1]) != 'object') {
if (properties[x][0] === 'n_chamado_web') {
properties[x][0] = 'Protocolo'
}
else if (properties[x][0] === 'nome_cliente') {
properties[x][0] = 'Nome do cliente'
}
else if (properties[x][0] === 'quando_inicio') {
properties[x][0] = 'Data de abertura'
}
else if (properties[x][0] === 'nome_filial') {
properties[x][0] = 'Nome da filial'
}
else if (properties[x][0] === 'cod_web') {
properties[x][0] = 'Codigo do cliente'
}
else if (properties[x][0] === 'id' || properties[x][0] === 'cliente_id') {
continue
}
data += `*${properties[x][0]}*: ${properties[x][1].replace(/(\r\n|\n|\r)/gm, "")}\n` data += `*${properties[x][0]}*: ${properties[x][1].replace(/(\r\n|\n|\r)/gm, "")}\n`
} }
@ -40,6 +59,16 @@ const hitPortalMonitoring = async (centro_de_custo: string) => {
for (let y = 0; y < inner_properties.length; y++) { for (let y = 0; y < inner_properties.length; y++) {
if (inner_properties[y][0] === 'texto') {
inner_properties[y][0] = 'Informação'
}
else if (inner_properties[y][0] === 'quando') {
inner_properties[y][0] = 'Data da Informação'
}
else if (inner_properties[y][0] === 'login') {
continue
}
sub_data += `*${inner_properties[y][0]}*: ${inner_properties[y][1].replace(/(\r\n|\n|\r)/gm, "")}\n` sub_data += `*${inner_properties[y][0]}*: ${inner_properties[y][1].replace(/(\r\n|\n|\r)/gm, "")}\n`
} }

View File

@ -227,17 +227,38 @@ const queryEndPointHit = async (centro_de_custo: string) => {
response2 = response2.data.result; response2 = response2.data.result;
for (let i = 0; i < response2.length; i++) { for (let i = 0; i < response2.length; i++) {
let data = '' let data = ''
let sub_data = '*Atualizações:*\n\n' let sub_data = '*Atualizações:*\n\n'
const properties: any = Object.entries(response2[i]); let properties: any = Object.entries(response2[i]);
for (let x = 0; x < properties.length; x++) { for (let x = 0; x < properties.length; x++) {
if (typeof (properties[x][1]) != 'object') { if (typeof (properties[x][1]) != 'object') {
if (properties[x][0] === 'n_chamado_web') {
properties[x][0] = 'Protocolo'
}
else if (properties[x][0] === 'nome_cliente') {
properties[x][0] = 'Nome do cliente'
}
else if (properties[x][0] === 'quando_inicio') {
properties[x][0] = 'Data de abertura'
}
else if (properties[x][0] === 'nome_filial') {
properties[x][0] = 'Nome da filial'
}
else if (properties[x][0] === 'cod_web') {
properties[x][0] = 'Codigo do cliente'
}
else if (properties[x][0] === 'id' || properties[x][0] === 'cliente_id') {
continue
}
data += `*${properties[x][0]}*: ${properties[x][1].replace(/(\r\n|\n|\r)/gm, "")}\n` data += `*${properties[x][0]}*: ${properties[x][1].replace(/(\r\n|\n|\r)/gm, "")}\n`
} }
@ -247,10 +268,20 @@ const queryEndPointHit = async (centro_de_custo: string) => {
for (let k = 0; k < sub_properties.length; k++) { for (let k = 0; k < sub_properties.length; k++) {
const inner_properties: any = Object.entries(sub_properties[k]); let inner_properties: any = Object.entries(sub_properties[k]);
for (let y = 0; y < inner_properties.length; y++) { for (let y = 0; y < inner_properties.length; y++) {
if (inner_properties[y][0] === 'texto') {
inner_properties[y][0] = 'Informação'
}
else if (inner_properties[y][0] === 'quando') {
inner_properties[y][0] = 'Data da Informação'
}
else if (inner_properties[y][0] === 'login') {
continue
}
sub_data += `*${inner_properties[y][0]}*: ${inner_properties[y][1].replace(/(\r\n|\n|\r)/gm, "")}\n` sub_data += `*${inner_properties[y][0]}*: ${inner_properties[y][1].replace(/(\r\n|\n|\r)/gm, "")}\n`
} }
@ -987,7 +1018,7 @@ const handleMessage = async (
console.log('ticket_message.length ', ticket_message.length) console.log('ticket_message.length ', ticket_message.length)
if (ticket_message.length > 10) { if (ticket_message.length > 5) {
const { queues, } = await ShowWhatsAppService(wbot.id!); const { queues, } = await ShowWhatsAppService(wbot.id!);