Parser_model.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. defined('BASEPATH') or exit('No direct script access allowed');
  3. /**
  4. *
  5. * Model Parser_model
  6. *
  7. * This Model for ...
  8. *
  9. * @package CodeIgniter
  10. * @category Model
  11. * @author Setiawan Jodi <jodisetiawan@fisip-untirta.ac.id>
  12. * @link https://github.com/setdjod/myci-extension/
  13. * @param ...
  14. * @return ...
  15. *
  16. */
  17. class Parser_model extends CI_Model
  18. {
  19. // ------------------------------------------------------------------------
  20. public function __construct()
  21. {
  22. parent::__construct();
  23. }
  24. public function inicioParser()
  25. {
  26. $data = array(
  27. 'cron_ejecucion' => 1,
  28. "fecha_ejecucion" => date("Y-m-d h:i:s"),
  29. );
  30. $this->db->where('id', 0);
  31. $this->db->update('parametros_cron', $data);
  32. }
  33. public function stopParser()
  34. {
  35. $data = array(
  36. 'cron_ejecucion' => 0,
  37. "fecha_ejecucion" => date("Y-m-d h:i:s"),
  38. );
  39. $this->db->where('id', 0);
  40. $this->db->update('parametros_cron', $data);
  41. }
  42. public function existCronRun()
  43. {
  44. $sql = "SELECT * FROM parametros_cron";
  45. $result = $this->db->query($sql);
  46. $datos['datos'] = $result->row();
  47. $datos['num_rows'] = $result->num_rows();
  48. return $datos;
  49. }
  50. public function getUrlArchivos()
  51. {
  52. $sql = "SELECT * FROM tipo_licitacion_tablas";
  53. $result = $this->db->query($sql);
  54. $datos['datos'] = $result->result();
  55. $datos['num_rows'] = $result->num_rows();
  56. return $datos;
  57. }
  58. public function setInicioLicitacion($licitacionArr)
  59. {
  60. $this->db->insert('BRUTO_datos_iniciales', $licitacionArr);
  61. return $this->db->insert_id();
  62. }
  63. public function getMapaTablas()
  64. {
  65. $sql = "SELECT * FROM mapa_tablas_parser ORDER BY orden ASC";
  66. $result = $this->db->query($sql);
  67. $datos['datos'] = $result->result();
  68. $datos['num_rows'] = $result->num_rows();
  69. return $datos;
  70. }
  71. public function getDatosBrutos($tabla)
  72. {
  73. $sql = "SELECT * FROM $tabla";
  74. $result = $this->db->query($sql);
  75. $datos['datos'] = $result->result();
  76. $datos['num_rows'] = $result->num_rows();
  77. return $datos;
  78. }
  79. }
  80. /* End of file Parser_model.php */
  81. /* Location: ./application/models/Parser_model.php */