Files
cm-web-legacy/application/models/web/m_search_keyword.php
2020-06-10 06:19:03 +09:00

107 lines
2.8 KiB
PHP
Executable File

<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_search_keyword extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_list($req_data){
# request
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
if($search_type!='' && $search_keyword != '') $this->db->like($search_type, $search_keyword);
$this->db->where('is_del', 'N');
$this->db->from('search_keyword');
$this->db->limit($limit, $offset);
$this->db->order_by('search_count', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : where keyword select
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_where_keyword_select($req_data){
# request
$keyword = $req_data['keyword'];
$this->db->where('is_del', 'N');
$this->db->where('keyword', $keyword);
$this->db->from('search_keyword');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : search_count +1 update
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_search_count_update($idx){
$sql = "update search_keyword
set search_count = search_count + 1
where idx= ".$idx;
$row = $this->db->query($sql);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function search_keyword_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('search_keyword', $req_data);
return $row;
}
}
?>