Bladeren bron

descargar archivos de la primera semana de febrero hasta el 27/01/22

Nermosis 3 jaren geleden
bovenliggende
commit
cf4ce93d59
2 gewijzigde bestanden met toevoegingen van 36 en 29 verwijderingen
  1. 33 28
      application/controllers/Parser.php
  2. 3 1
      application/libraries/Parserdatabaselimpio.php

+ 33 - 28
application/controllers/Parser.php Bestand weergeven

@@ -18,7 +18,7 @@ class Parser extends CI_Controller
18 18
         $this->load->helper('file');
19 19
         $this->load->helper('xml');
20 20
         $this->load->library('parserfile');
21
-        
21
+
22 22
         $this->load->model("Parser_model");
23 23
     }
24 24
 
@@ -62,38 +62,38 @@ class Parser extends CI_Controller
62 62
     private function downloadProcess($urlXML)
63 63
     {
64 64
         $fileName = basename($urlXML);
65
-        $downladedZip = $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
66
-
67
-        if ($downladedZip) {
68
-            $zip = new ZipArchive;
69
-            if ($zip->open($this->rutaDiariaFecha . $fileName)) {
70
-                $zip->extractTo($this->rutaDiariaFecha);
71
-                $zip->close();
72
-                unlink($this->rutaDiariaFecha . $fileName);
73
-                $archivosTotales = get_filenames($this->rutaDiariaFecha);
74
-
75
-                foreach ($archivosTotales as $file) {
76
-                    $this->getFile($this->rutaDiariaFecha . $file, $file);
77
-                }
78
-
79
-            }
65
+        //$downladedZip = $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
66
+
67
+        /* if ($downladedZip) {
68
+        $zip = new ZipArchive;
69
+        if ($zip->open($this->rutaDiariaFecha . $fileName)) {
70
+        $zip->extractTo($this->rutaDiariaFecha);
71
+        $zip->close();
72
+        unlink($this->rutaDiariaFecha . $fileName);
73
+        $archivosTotales = get_filenames($this->rutaDiariaFecha);
74
+
75
+        foreach ($archivosTotales as $file) {
76
+        $this->getFile($this->rutaDiariaFecha . $file, $file);
77
+        }
80 78
 
81 79
         }
82 80
 
83
-        /*$archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
84
-    $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
81
+        } */
82
+        $this->downloadFile($fileName, $urlXML, $this->rutaDiariaFecha);
83
+        $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
84
+        $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
85 85
 
86
-    while ($nuevoAtomAttrNext !== "") {
87
-    //$aux = 0;
88
-    //while ($aux <= 3) {
86
+        while ($nuevoAtomAttrNext !== "") {
87
+            //$aux = 0;
88
+            //while ($aux <= 3) {
89 89
 
90
-    $fileName = basename($nuevoAtomAttrNext);
91
-    $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiariaFecha);
92
-    $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
90
+            $fileName = basename($nuevoAtomAttrNext);
91
+            $this->downloadFile($fileName, $nuevoAtomAttrNext, $this->rutaDiariaFecha);
92
+            $archivoAtom = $this->getFile($this->rutaDiariaFecha . $fileName, $fileName);
93 93
 
94
-    $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
95
-    //$aux++;
96
-    }*/
94
+            $nuevoAtomAttrNext = $this->readNextAttribute($archivoAtom);
95
+            //$aux++;
96
+        }
97 97
     }
98 98
 
99 99
     private function getFile($url, $fileName)
@@ -134,7 +134,12 @@ class Parser extends CI_Controller
134 134
             $attrHref = $row['@attributes']['href'];
135 135
 
136 136
             if ($attrNext === "next") {
137
-                $enlace = $attrHref;
137
+                if (!strpos($attrHref, "20220127_")) {
138
+                    $enlace = $attrHref;
139
+                } else {
140
+                    $enlace = "";
141
+                }
142
+
138 143
             }
139 144
         }
140 145
 

+ 3 - 1
application/libraries/Parserdatabaselimpio.php Bestand weergeven

@@ -25,7 +25,9 @@ class Parserdatabaselimpio
25 25
 
26 26
                 if ($datosTablaToInsert['num_rows'] > 0) {
27 27
                     if ($row->tabla_maestra == "maestro_datos_iniciales_licitacion") {
28
-                        pretty_dump($datosTablaToInsert['datos']);
28
+                        foreach ($datosTablaToInsert['datos'] as $datos) {
29
+                            unset($datos->id);
30
+                        }
29 31
                     }
30 32
 
31 33
                     insertBucleDuplicateOnKey($datosTablaToInsert['datos'], $row->tabla_maestra, "brutoToMaestro_" . $now);