✏️ 正在编辑: ImportacaoAutomatica.php
路径:
/srv/systems_dir/yuppiecred/library/Core/Banco/Service/ImportacaoAutomatica.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Core_Banco_Service_ImportacaoAutomatica { public static function importacaoDiretaAutomatica($bancoId){ $result = array(); try { $result = Core_Banco_Service_Scraping::factory($bancoId); } catch ( Exception $exc ) { return $exc->getMessage(); } return $result; } public static function importacaoBonsucessoAutomatica($bancoId){ $dbEmpresa = new Model_DbTable_EmpresaFtp(); $empresas = $dbEmpresa->fetchAll("banco_id = $bancoId"); foreach ( $empresas as $empresa ) { //baixar arquivos $qtdArquivosBaixados = 0; try { $ftp = Core_Banco_Service_Ftp::factory($empresa['empresa_id'], $bancoId); //Arquivos do diretório raiz $qtdArquivosBaixados = $ftp->baixarArquivos(null, $bancoId, false); //Arquivos da pasta NBC $qtdArquivosBaixadosNbc = $ftp->baixarArquivos('NBC', $bancoId); } catch ( Exception $ex ) { return $ex->getMessage(); } } //localizar arquivos $file = new Core_File(); $file->setPath($bancoId); $listaArquivos = $file->listFiles(); //importar arquivos $i = 0; if( !empty($listaArquivos) && $bancoId > 0 ){ $result = array(); foreach ( $listaArquivos as $arquivo){ $f = pathinfo($arquivo); if( strtolower($f['extension']) == "gz" && (strpos($f['filename'], "DadosProposta") || strpos($f['filename'], "SituacaoProposta") || strpos($f['filename'], "CreditoCliente")) ){ try { $banco = Core_Banco_Service_Ftp::factoryBanco($bancoId, $arquivo); $file->setPath(null); $retorno = $file->_readFile($arquivo, $bancoId); if($retorno != null){ $sheetData = Core_Banco_Planilha::arraySlice($retorno, 100); $banco->setArquivoOrigem($arquivo); $result[$arquivo] = $banco->importar($sheetData); } } catch ( Exception $ex ) { return $ex->getMessage(); } } } } return $result; } }
💾 保存文件
← 返回文件管理器