소스 검색

Estadisticas para emails

Nermosis 3 년 전
부모
커밋
a61d8aabb3
2개의 변경된 파일12개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 6
      application/libraries/ParserFile.php
  2. 3 2
      application/libraries/Parserdatabaselimpio.php

+ 9 - 6
application/libraries/ParserFile.php 파일 보기

33
     {
33
     {
34
     }
34
     }
35
 
35
 
36
-    public function index($rutaDiariaDownloader, $fechaInicioParser, $datosPerfil)
36
+    public function index($rutaDiariaDownloader, $fechaInicioParser, $datosPerfil, $idUltimaImportacion)
37
     {
37
     {
38
         $this->rutaDiaria = $rutaDiariaDownloader . "/format";
38
         $this->rutaDiaria = $rutaDiariaDownloader . "/format";
39
         $this->fechaInicioParser = $fechaInicioParser;
39
         $this->fechaInicioParser = $fechaInicioParser;
46
         $resultEntries = array();
46
         $resultEntries = array();
47
         $contador = 0;
47
         $contador = 0;
48
 
48
 
49
+        $stats = array();
50
+
49
         foreach ($files as $file) {
51
         foreach ($files as $file) {
50
             $filename = basename($file);
52
             $filename = basename($file);
51
             $contador++;
53
             $contador++;
70
                 if (!$existLicitacionActualizada) {
72
                 if (!$existLicitacionActualizada) {
71
                     //$arrayDeletedEntries = $xml->children('at', true);
73
                     //$arrayDeletedEntries = $xml->children('at', true);
72
 
74
 
73
-                    $resultEntries[$filename]['general'][$aux] = $this->nodoEntry($row, $xml->entry[$clave], $datosPerfil->id);
75
+                    $resultEntries[$filename]['general'][$aux] = $this->nodoEntry($row, $xml->entry[$clave], $datosPerfil->id, $idUltimaImportacion);
74
 
76
 
75
                     $contractFolder = $this->nodoContractFolderStatus($row, $xml->entry[$clave]);
77
                     $contractFolder = $this->nodoContractFolderStatus($row, $xml->entry[$clave]);
76
 
78
 
113
             unset($xml);
115
             unset($xml);
114
             unset($array);
116
             unset($array);
115
             unset($tablasTruncate);
117
             unset($tablasTruncate);
116
-            $this->CI->parserdatabaselimpio->index($fechaInicioParser, $filename);
118
+            $stats[$filename] = $this->CI->parserdatabaselimpio->index($fechaInicioParser, $filename);
117
 
119
 
118
             gc_mem_caches();
120
             gc_mem_caches();
119
             gc_collect_cycles();
121
             gc_collect_cycles();
177
         return $result;
179
         return $result;
178
     }
180
     }
179
 
181
 
180
-    private function nodoEntry($xml, $xmlPrimitivo, $tipoPerfil)
182
+    private function nodoEntry($xml, $xmlPrimitivo, $tipoPerfil, $idUltimaImportacion)
181
     {
183
     {
182
         $resultEntries = array();
184
         $resultEntries = array();
183
         $id_licitacion = (string) substr($xml['id'], strrpos($xml['id'], '/') + 1);
185
         $id_licitacion = (string) substr($xml['id'], strrpos($xml['id'], '/') + 1);
190
         $resultEntries['updated'] = (string) $xml['updated'];
192
         $resultEntries['updated'] = (string) $xml['updated'];
191
         $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
193
         $resultEntries['tipo_perfil_licitacion'] = $tipoPerfil;
192
         $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
194
         $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
195
+        $resultEntries['id_importacion'] = $idUltimaImportacion;
193
         return $resultEntries;
196
         return $resultEntries;
194
     }
197
     }
195
 
198
 
423
                 $resultEntries[$i]['startDate'] = $this->existNodo($tenderResult[$i], 'StartDate', 'string');
426
                 $resultEntries[$i]['startDate'] = $this->existNodo($tenderResult[$i], 'StartDate', 'string');
424
                 $resultEntries[$i]['smeawardedIndicator'] = $this->existNodo($tenderResult[$i], 'SMEAwardedIndicator', 'string');
427
                 $resultEntries[$i]['smeawardedIndicator'] = $this->existNodo($tenderResult[$i], 'SMEAwardedIndicator', 'string');
425
                 //AwardedTenderedProject
428
                 //AwardedTenderedProject
426
-                $resultEntries[$i]['contract_id'] = $this->existNodo($tenderResult[$i]->Contract, 'ID', 'string');
427
-                $resultEntries[$i]['contract_issueDate'] = $this->existNodo($tenderResult[$i]->Contract, 'IssueDate', 'string');
429
+                $resultEntries[$i]['contract_id'] = $this->existNodo($tenderResult[$i]['Contract'], 'ID', 'string');
430
+                $resultEntries[$i]['contract_issueDate'] = $this->existNodo($tenderResult[$i]['Contract'], 'IssueDate', 'string');
428
 
431
 
429
                 if (array_key_exists("WinningParty", $tenderResult[$i])) {
432
                 if (array_key_exists("WinningParty", $tenderResult[$i])) {
430
                     $winningParty = $tenderResult[$i]['WinningParty'];
433
                     $winningParty = $tenderResult[$i]['WinningParty'];

+ 3 - 2
application/libraries/Parserdatabaselimpio.php 파일 보기

16
     public function index($fechaInicioParser, $filename)
16
     public function index($fechaInicioParser, $filename)
17
     {
17
     {
18
         $tablasInsert = $this->CI->Parser_model->getMapaTablas();
18
         $tablasInsert = $this->CI->Parser_model->getMapaTablas();
19
-
19
+        $totalInserted = array();
20
         if ($tablasInsert['num_rows'] > 0) {
20
         if ($tablasInsert['num_rows'] > 0) {
21
 
21
 
22
             //$licitacionDeleteCascada = $this->CI->Parser_model->getLicitacionesNuevasBruto();
22
             //$licitacionDeleteCascada = $this->CI->Parser_model->getLicitacionesNuevasBruto();
30
 
30
 
31
                 if ($datosTablaToInsert['num_rows'] > 0) {
31
                 if ($datosTablaToInsert['num_rows'] > 0) {
32
                     guardar_log("brutoToMaestro_" . $fechaInicioParser, "ARCHIVO--" . $row->tabla_maestra . "_" . $fechaInicioParser . " - " . $filename);
32
                     guardar_log("brutoToMaestro_" . $fechaInicioParser, "ARCHIVO--" . $row->tabla_maestra . "_" . $fechaInicioParser . " - " . $filename);
33
-                    insertBucle($datosTablaToInsert['datos'], $row->tabla_maestra, "brutoToMaestro_" . $fechaInicioParser);
33
+                    $totalInserted[$row->tabla_maestra] = insertBucle($datosTablaToInsert['datos'], $row->tabla_maestra, "brutoToMaestro_" . $fechaInicioParser);
34
 
34
 
35
                 }
35
                 }
36
             }
36
             }
37
 
37
 
38
             //}
38
             //}
39
+            return $totalInserted;
39
 
40
 
40
         }
41
         }
41
     }
42
     }