From 2497f3711af5dd0d58d3f52907a2e7e16a4d8773 Mon Sep 17 00:00:00 2001 From: adriano Date: Mon, 17 Jul 2023 14:32:22 -0300 Subject: [PATCH] =?UTF-8?q?altera=C3=A7=C3=A3o=20para=20quando=20receber?= =?UTF-8?q?=20status=20atdfechou?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/controllers/HitController.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/backend/src/controllers/HitController.ts b/backend/src/controllers/HitController.ts index 7480237..f2df0a5 100644 --- a/backend/src/controllers/HitController.ts +++ b/backend/src/controllers/HitController.ts @@ -39,6 +39,7 @@ export const hit = async (req: Request, res: Response): Promise => { console.log("req.body['action']: ", req.body['action']) console.log("req.body['phone']: ", req.body['phone']) console.log("req.body['name']: ", req.body['name']) + console.log("req.body['mensagem']: ", req.body['mensagem']) if (req.headers["auth"] === '0424bd59b807674191e7d77572075f33') { @@ -89,10 +90,20 @@ export const hit = async (req: Request, res: Response): Promise => { // let response: any = `*Olá!*\r\n\r\n*Esperamos que esteja tudo bem com você. Somos o grupo HIT e estamos aqui para mantê-lo atualizado sobre o chamado referente à unidade 0001 - Hit World Teste. Queremos garantir que você esteja informado sobre o incidente e possa acompanhar tudo de perto.*\r\n\r\nPrezado cliente, se deseja adicionar alguma informação no protocolo 200-322442 digite 2\r\n\r\n\r\n*Protocolo:* 200-322442\r\n*Data de abertura:* 07/07/2023 16:51:29\r\n*Nome do cliente:* Hit World Teste\r\n*Nome da filial:* Hit World Teste\r\n*Código do cliente:* 0001\r\n\r\n*Informação de abertura:* teste de ativação Contato: Felipe Telefone: 11983534545\r\n*Data de abertura:* 07/07/2023 16:51:29\r\n\r\n` - let response: any = await hitPortalMonitoring({ - 'params[n_chamado_web]': req.body['n_chamado_web'], - 'method': 'omnihit.consultachamado', - }) + let response: any = '' + + if (['atdabriu', 'atdatualizou'].includes(req.body['action'])) { + response = await hitPortalMonitoring({ + 'params[n_chamado_web]': req.body['n_chamado_web'], + 'method': 'omnihit.consultachamado', + }) + } + else { + response = req.body['mensagem'] + } + + + if (!response || response.length == 0 || !contact) { console.log('Empty result from hit portal monitoring to n_chamado_web: ', req.body['n_chamado_web'])