123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?php
- defined('BASEPATH') or exit('No direct script access allowed');
-
- /**
- *
- * Model Parser_model
- *
- * This Model for ...
- *
- * @package CodeIgniter
- * @category Model
- * @author Setiawan Jodi <jodisetiawan@fisip-untirta.ac.id>
- * @link https://github.com/setdjod/myci-extension/
- * @param ...
- * @return ...
- *
- */
-
- class Parser_model extends CI_Model
- {
-
- // ------------------------------------------------------------------------
-
- public function __construct()
- {
- parent::__construct();
- }
-
- public function inicioParser()
- {
- $data = array(
- 'cron_ejecucion' => 1,
- "fecha_ejecucion" => date("Y-m-d h:i:s"),
- );
-
- $this->db->where('id', 0);
- $this->db->update('parametros_cron', $data);
- }
-
- public function stopParser()
- {
- $data = array(
- 'cron_ejecucion' => 0,
- "fecha_ejecucion" => date("Y-m-d h:i:s"),
-
- );
-
- $this->db->where('id', 0);
- $this->db->update('parametros_cron', $data);
- }
-
- public function existCronRun()
- {
- $sql = "SELECT * FROM parametros_cron";
- $result = $this->db->query($sql);
- $datos['datos'] = $result->row();
- $datos['num_rows'] = $result->num_rows();
- return $datos;
- }
-
- public function getUrlArchivos()
- {
- $sql = "SELECT * FROM tipo_licitacion_tablas";
- $result = $this->db->query($sql);
- $datos['datos'] = $result->result();
- $datos['num_rows'] = $result->num_rows();
- return $datos;
- }
-
- public function setInicioLicitacion($licitacionArr)
- {
- $this->db->insert('BRUTO_datos_iniciales', $licitacionArr);
- return $this->db->insert_id();
- }
-
- public function getMapaTablas()
- {
- $sql = "SELECT * FROM mapa_tablas_parser ORDER BY orden ASC";
- $result = $this->db->query($sql);
- $datos['datos'] = $result->result();
- $datos['num_rows'] = $result->num_rows();
- return $datos;
- }
-
- public function getDatosBrutos($tabla)
- {
- $sql = "SELECT * FROM $tabla";
- $result = $this->db->query($sql);
- $datos['datos'] = $result->result();
- $datos['num_rows'] = $result->num_rows();
- return $datos;
- }
-
- public function getLicitacionesNuevasBruto()
- {
- $sql = "SELECT DISTINCT id_licitacion FROM bruto_datos_iniciales";
- $result = $this->db->query($sql);
- $datos['num_rows'] = $result->num_rows();
- return $datos;
- }
-
- public function deleteCascadaNuevasLicitaciones()
- {
- $sql = "DELETE
- FROM maestro_datos_iniciales_licitacion
- WHERE id_licitacion IN(
- SELECT DISTINCT id_licitacion FROM bruto_datos_iniciales
- )";
- $result = $this->db->query($sql);
- $datos['num_rows'] = $this->db->affected_rows();
- return $datos;
- }
-
- public function getMapaByTabla($tabla)
- {
- $sql = "SELECT * FROM $tabla";
- $result = $this->db->query($sql);
- $datos['datos'] = $result->result();
- $datos['num_rows'] = $result->num_rows();
- return $datos;
-
- }
-
- }
-
- /* End of file Parser_model.php */
- /* Location: ./application/models/Parser_model.php */
|