✏️ 正在编辑: AcessoExternoController.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/controllers/AcessoExternoController.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php use Modules\Core\Service\InputService; use Modules\Contrato\Service\ImportacaoAsyncService; use Modules\Core\Exception\SemImportacaoPendenteException; use Modules\Relatorio\Model\DbTable\RelatorioSemanal; use Modules\Relatorio\Service\RelatorioSemanalService; use Modules\Callcenter\Service\ReprocessamentoService; use Modules\Automatizacao\Model\DbTable\AutomatizacaoTable; class AcessoExternoController extends Zend_Controller_Action { /** @var string */ public const IMPORTADO = 'Os arquivos foram importados com sucesso.'; /** @var Service_Sincronizacao_SincService */ private $service; /** @var Service_Corretor_TermoResponsabilidade */ private $termoService; /** @var Service_Relatorio_Gerador */ private $relatorioService; public function init() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); $this->service = service('sincronizacao'); $this->termoService = service('termo-responsabilidade'); $this->relatorioService = service('relatorio'); } public function importacaoDiretaAmazonAction() { $bancoNome = $this->getRequest()->getParam('banco'); $dataImportacao = $this->getRequest()->getParam('data'); $empresaId = $this->getRequest()->getParam('empresa_id', 0); if (!$bancoNome) { $this->_helper->json(array( 'alert' => "Banco não informado." )); } $model = (new Model_ImportarDireto()) ->setBancoNome($bancoNome) ->setDataImportacao($dataImportacao) ->setAws(true); if ($empresaId) { $model->setEmpresaId($empresaId); } try { $result = $model->importar(); } catch (Core_Exception $e) { $result = ['alert' => $e->getMessage()]; } catch (Yuppie_Exception $e) { $result = ['alert' => $e->getMessage()]; } catch (Throwable $e) { Yuppie_Log::write("Falha de execução na importação direta importacaoDiretaAmazonAction: " . print_r($e->getMessage() . $e->getTraceAsString(), true)); $result = ['alert' => "Falha de execução."]; } $this->_helper->json($result); } public function retornoSmsAction() { new Model_CallcenterMensagemRespostas($this->getRequest()->getPost()); } public function notificarQuedaProducaoAction() { $producao = (new Model_Contrato)->getProducaoCorretorNotificacao(); if( empty($producao) ){ return; } $supervisorId = 0; foreach( $producao as $key => $item ){ if( $supervisorId != $item['supervisor_id'] ){ $producaoSupervisor = []; $supervisorId = $item['supervisor_id']; } if( $supervisorId == $item['supervisor_id'] ){ $producaoSupervisor[] = $item; } if( (!empty($producao[$key+1]) && $supervisorId != $producao[$key+1]['supervisor_id']) || count($producao) == ($key+1) ){ $this->view->supervisor = $item['supervisor']; $this->view->result = $producaoSupervisor; $email = new Core_Mail(); $email->setFrom("no-reply@yuppietech.com.br", "Sistema Yuppie"); $email->enviarMensagemHtml( $item['supervisor'], $item['email'], 'Parceiros com Variação na Produção', $this->view->render('relatorio/notificar-queda-producao.phtml') ); } } } public function enviarNotificacaoCertificadoCorretorAction() { $dbTableCorretores = new Model_DbTable_Corretor(); $corretores = $dbTableCorretores->selectCorretorCertificadoAVencer(); $modelCorretor = new Model_Corretor(); $modelCorretor->enviarNotificacaoValidadeCertificado($corretores); } public function sincAction() { try { $result = $this->service->sincronizar(new Zend_File_Transfer_Adapter_Http()); return $this->_helper->json($result); } catch (Throwable $throwable) { return $this->_helper->json(['erro' => $throwable->getMessage()]); } } public function termoFromAutentiqueAction() { $this->termoService->receberDocumentoAssinado($this->getRequest()); } public function envioRelatorioDiarioAction() { try { if ((new AutomatizacaoTable())->first()->isRelatorioDiario()) { $this->relatorioService->sendRelatorioDiario($this->view); } } catch (Throwable $throwable) { echo $throwable->getMessage(); die(); } } public function reprocessarAtendimentosAction() { try { if ((new AutomatizacaoTable())->first()->isReprocessarAtendimentos()) { (new ReprocessamentoService())->reprocessarAtendimentos(); } } catch (Throwable $throwable) { echo $throwable->getMessage(); die(); } } public function gatilhoAntiFraudeAction() { $dataGatilhoAntifraude = $this->getRequest()->getParam('data_gatilho_antifraude'); try { $dataCadastro = new Zend_Date($dataGatilhoAntifraude); } catch (Zend_Date_Exception $e) { $this->_helper->json(['alert' => 'Data inválida']); } $tableContrato = new Model_DbTable_Contrato(); $contratos = $tableContrato->getContratosPorCadastro($dataCadastro->get('yyyy-MM-dd'), $dataCadastro->get('yyyy-MM-dd')); $result = [ 'tipo' => 'success', 'mensagem' => 'Contratos analisados com sucesso.' ]; try { $tableContrato->setarFraude($contratos); } catch (Exception $e) { $result = [ 'tipo' => 'alert', 'mensagem' => $e->getMessage() ]; } if ($this->getRequest()->isXmlHttpRequest()) { $this->_helper->json([$result['tipo'] => $result['mensagem']]); } } public function importacaoAsyncAction() { set_time_limit(0); try { $importacao = $this->getRequest()->getParam('importacao'); $result = (new ImportacaoAsyncService())->runImportacao($importacao); $this->_helper->json([ 'importacao' => $importacao, 'continuar' => true, 'importados' => $result->qtdImportados, 'nao_importados' => $result->qtdNaoImportados, 'restante' => $result->qtdPendentes, 'total' => $result->totalRegistros, 'percentualCompleto' => $result->percentualCompleto ]); } catch (SemImportacaoPendenteException $throwable) { $this->_helper->json(['concluido' => true]); } catch (Throwable $throwable) { $this->_helper->json(['alert' => $throwable->getMessage()]); } } public function validarInputAction() { try { $request = $this->getRequest(); InputService::validar($request->getParam('type'), $request->getParam('value')); $this->_helper->json([true]); } catch (Throwable $throwable) { $this->_helper->json(['erro' => $throwable->getMessage()]); } } public function limparNotificacoesAgendamentoAction() { try { $result = (new Model_DbTable_CallcenterBase())->limparTelefonesAgendadosLeads(); $this->_helper->json(['result' => $result]); } catch (Throwable $e) { $this->_helper->json(['erro' => $e->getMessage()]); } } }
💾 保存文件
← 返回文件管理器