first commit

This commit is contained in:
pakerpale
2020-06-10 06:19:03 +09:00
commit cd6b5b7832
6081 changed files with 624389 additions and 0 deletions

View File

@@ -0,0 +1,262 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_theme_news extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : theme news - list
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_join_news_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_theme_type = $req_data['search_theme_type'];
$search_category_code = $req_data['search_category_code'];
$content_type = $req_data['content_type'];
$sort_column = $req_data['sort_column'];
$search_click1 = ''; $search_click2 = '';
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
if($search_click1=='1') {
$today_date = date("Y-m-d").' 00:00:00';
$this->db->where('a.reg_date >=', $today_date);
}
if($search_click2=='1') {
$this->db->like('b.is_display', 'Y');
} else if($search_click2=='2') {
$this->db->like('b.is_display', 'N');
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
$this->db->select('a.idx, a.rank, a.title, a.theme_img as main_img, a.theme_type, b.idx as content_idx, b.press_name, b.reporter_name, a.reg_date, a.is_display, b.display_date, b.hit_count, b.review_count1, b.comment_count, b.share_count, c.category_code, c.category_name as category_name1');
$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('c.depth', '1');
$this->db->from('theme as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$this->db->join('news_section as c', 'SUBSTRING(b.category_code, 1, 2) = c.category_code');
$this->db->order_by('b.display_date desc');
$this->db->limit($limit, $offset);
$this->db->order_by($sort_column, 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme news - list - total count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_join_news_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_theme_type = $req_data['search_theme_type'];
$search_category_code = $req_data['search_category_code'];
$content_type = $req_data['content_type'];
$search_click1 = ''; $search_click2 = '';
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
if($search_click1=='1') {
$today_date = date("Y-m-d").' 00:00:00';
$this->db->where('a.reg_date >=', $today_date);
}
if($search_click2=='1') {
$this->db->like('b.is_display', 'Y');
} else if($search_click2=='2') {
$this->db->like('b.is_display', 'N');
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
$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('c.depth', '1');
$this->db->from('theme as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$this->db->join('news_section as c', 'SUBSTRING(b.category_code, 1, 2) = c.category_code');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme news - new count
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function theme_join_news_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_theme_type = $req_data['search_theme_type'];
$search_category_code = $req_data['search_category_code'];
$content_type = $req_data['content_type'];
$search_click2 = '';
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
if($search_click2=='1') {
$this->db->like('b.is_display', 'Y');
} else if($search_click2=='2') {
$this->db->like('b.is_display', 'N');
}
$now_date = date("Y-m-d")." 00:00:00";
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
$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('b.is_del', 'N');
$this->db->where('c.depth', '1');
$this->db->from('theme as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$this->db->join('news_section as c', 'SUBSTRING(b.category_code, 1, 2) = c.category_code');
$this->db->where('a.reg_date >=', $now_date);
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display group by
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function theme_join_news_is_display_group_by_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_theme_type = $req_data['search_theme_type'];
$search_category_code = $req_data['search_category_code'];
$content_type = $req_data['content_type'];
$search_click1 = '';
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
if($search_click1=='1') {
$today_date = date("Y-m-d").' 00:00:00';
$this->db->where('a.reg_date >=', $today_date);
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
$this->db->select('b.is_display, count(*) as cnt');
$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('c.depth', '1');
$this->db->from('theme as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$this->db->join('news_section as c', 'SUBSTRING(b.category_code, 1, 2) = c.category_code');
$this->db->group_by('b.is_display');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme news - select
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function theme_join_news_select($req_data){
# request
$idx = $req_data;
$this->db->select('a.*, b.press_name');
$this->db->where('a.idx', $idx);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->from('theme as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 type list - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_join_news_type_list($req_data){
# request
$content_type = $req_data['content_type'];
$theme_type = $req_data['theme_type'];
$this->db->select('a.*, b.press_name');
$this->db->where('a.content_type', $content_type);
$this->db->where('a.theme_type', $theme_type);
$this->db->where('a.is_display', 'Y');
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->from('theme as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>