first commit
This commit is contained in:
182
application/models/admin/comm/m_ranking_log.php
Executable file
182
application/models/admin/comm/m_ranking_log.php
Executable file
@@ -0,0 +1,182 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_ranking_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking log - list
|
||||
# CREATE : 2018-03-07
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code = $req_data['search_category_code'];
|
||||
$search_date = $req_data['search_date'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('a.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
|
||||
if($search_date!='') $this->db->where('a.ranking_date', $search_date);
|
||||
|
||||
$this->db->select('a.*, c.category_name as category_name1');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('c.depth', '1');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('news_section as c', 'SUBSTRING(c.category_code, 1, 2) = c.category_code');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.'.$sort_column, 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking news - list - total count
|
||||
# CREATE : 2018-03-07
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code = $req_data['search_category_code'];
|
||||
$search_date = $req_data['search_date'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('a.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
|
||||
if($search_date!='') $this->db->where('a.ranking_date', $search_date);
|
||||
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('c.depth', '1');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('news_section as c', 'SUBSTRING(c.category_code, 1, 2) = c.category_code');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking life - list
|
||||
# CREATE : 2018-03-21
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_join_life_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code1 = $req_data['search_category_code1'];
|
||||
$search_category_code2 = $req_data['search_category_code2'];
|
||||
$search_life_type = $req_data['search_life_type'];
|
||||
$search_theme_type = $req_data['search_theme_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('b.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1);
|
||||
if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2);
|
||||
if($search_life_type!='') $this->db->where('b.life_type', $search_life_type);
|
||||
if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type);
|
||||
|
||||
$this->db->select('a.idx, a.rank, a.title, a.main_img, a.ranking_type, a.reg_date, a.content_idx, b.life_type, b.editor_name, b.hit_count, b.like_count, b.comment_count, b.share_count, c.category_name as category_name1, d.channel_name as category_name2');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('life as b', 'a.content_idx = b.idx');
|
||||
$this->db->join('category as c', 'c.idx = b.category_idx');
|
||||
$this->db->join('channel as d', 'd.idx = b.channel_idx');
|
||||
$this->db->order_by('a.reg_date desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking life - list - total count
|
||||
# CREATE : 2018-03-21
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_join_life_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code1 = $req_data['search_category_code1'];
|
||||
$search_category_code2 = $req_data['search_category_code2'];
|
||||
$search_life_type = $req_data['search_life_type'];
|
||||
$search_theme_type = $req_data['search_theme_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('b.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1);
|
||||
if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2);
|
||||
if($search_life_type!='') $this->db->where('b.life_type', $search_life_type);
|
||||
if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type);
|
||||
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('life as b', 'a.content_idx = b.idx');
|
||||
$this->db->join('category as c', 'c.idx = b.category_idx');
|
||||
$this->db->join('channel as d', 'd.idx = b.channel_idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user