|
|
|
@ -8,6 +8,7 @@ use app\Controllers\QueueController;
|
|
|
|
|
use app\Models\Agent; |
|
|
|
|
use app\Models\Atendimento; |
|
|
|
|
use app\Models\Evento; |
|
|
|
|
use app\Models\ListaNegraPalavras; |
|
|
|
|
use app\Models\Message; |
|
|
|
|
use app\Models\Parametros; |
|
|
|
|
use app\Models\Pause; |
|
|
|
@ -255,7 +256,11 @@ class ApiAgente
|
|
|
|
|
{ |
|
|
|
|
$queue = new QueueController(); |
|
|
|
|
$search = $queue->listaAllFilas(); |
|
|
|
|
echo json_encode($search); |
|
|
|
|
$this->retorno( |
|
|
|
|
$search ? "Sucesso" : "Erro", |
|
|
|
|
$search ? $search : null, |
|
|
|
|
$search ? $search : null |
|
|
|
|
); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -317,7 +322,10 @@ class ApiAgente
|
|
|
|
|
$modelMensagem = new Message(); |
|
|
|
|
if ($mensagem['type'] == 'text') { |
|
|
|
|
// logger('enviaMsg')->info(print_r($mensagem, true)); |
|
|
|
|
$retuno = $provider->enviarMsg($mensagem['dst'], $mensagem['content']); |
|
|
|
|
$retuno = $provider->enviarMsg( |
|
|
|
|
$mensagem['dst'], |
|
|
|
|
$this->validaPalavroes($mensagem['content']) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$anmeArquivo = __DIR__ . "/../../storage/files/" . $mensagem['id_provedor']; |
|
|
|
|
$texto = base64_decode($mensagem['content']); |
|
|
|
@ -598,4 +606,19 @@ class ApiAgente
|
|
|
|
|
logger('monitora')->info($th->getMessage(), debug_backtrace()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function validaPalavroes($msg) |
|
|
|
|
{ |
|
|
|
|
try { |
|
|
|
|
$palavroes = new ListaNegraPalavras(); |
|
|
|
|
$palavras = $palavroes->getAll(); |
|
|
|
|
foreach ($palavras as $key => $value) { |
|
|
|
|
$pattern = "/\b($value->palavra)\b/i"; |
|
|
|
|
$msg = preg_replace($pattern, '*' . str_repeat('*', strlen($value->palavra)) . '*', $msg); |
|
|
|
|
} |
|
|
|
|
} catch (\Throwable $th) { |
|
|
|
|
logger('telegram')->info(print_r($th, true), true); |
|
|
|
|
} |
|
|
|
|
return $msg; |
|
|
|
|
} |
|
|
|
|
} |