<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Crawl_list model class
 */

class Crawl_list_model extends MY_Model
{

    /**
     * 테이블명
     */
    public $_table = 'crawl_list';

    /**
     * 사용되는 테이블의 프라이머리키
     */
    public $primary_key = 'crawl_id'; // 사용되는 테이블의 프라이머리키

    function __construct()
    {
        parent::__construct();
    }


    public function get_admin_list($limit = '', $offset = '', $where = '', $like = '', $findex = '', $forder = '', $sfield = '', $skeyword = '', $sop = 'OR')
    {
        $result = $this->_get_list_common('', '', $limit, $offset, $where, $like, $findex, $forder, $sfield, $skeyword, $sop);
		return $result;
    }

	public function get_by_site()
	{
		$this->db->select('crawl_title,site_key,site_type');
		$this->db->group_by('site_type');
		$this->db->group_by('site_key');
		$this->db->order_by('crawl_title');
		$qry = $this->db->get($this->_table);
		return $qry->result_array();
	}

	public function get_by_category()
	{
		$this->db->select('crawl_category_name');
		$this->db->where("crawl_category_name is not null AND crawl_category_name <> ''");
		$this->db->group_by('crawl_category_name');
		$this->db->order_by('crawl_category_name');
		$qry = $this->db->get($this->_table);
		return $qry->result_array();
	}
}