first commit
This commit is contained in:
96
application/models/web/m_search_keyword_relation.php
Executable file
96
application/models/web/m_search_keyword_relation.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_search_keyword_relation extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where keyword, relation_keyword select
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
function search_keyword_relation_where_keyword_relation_keyword_select($req_data){
|
||||
# request
|
||||
$keyword = $req_data['keyword'];
|
||||
$relation_keyword = $req_data['relation_keyword'];
|
||||
|
||||
$this->db->where('keyword', $keyword);
|
||||
$this->db->where('relation_keyword', $relation_keyword);
|
||||
$this->db->from('search_keyword_relation');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : search_count +1 update
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
function search_keyword_relation_search_count_update($idx){
|
||||
|
||||
$sql = "update search_keyword_relation
|
||||
set search_count = search_count + 1
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
function search_keyword_relation_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_relation', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
function search_keyword_relation_list($req_data){
|
||||
# request
|
||||
$keyword = $req_data['keyword'];
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
|
||||
$this->db->where('keyword', $keyword);
|
||||
$this->db->from('search_keyword_relation');
|
||||
$this->db->order_by('search_count', 'desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user