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,642 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_news extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : news - list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function 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_news_type = $req_data['search_news_type'];
$search_category_code = $req_data['search_category_code'];
$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('a.is_display', 'Y');
} else if($search_click2=='2') {
$this->db->like('a.is_display', 'N');
}
if($search_type!='' && $search_keyword!=''){
if($search_type == 'tag') {
$this->db->where("match(tag) against('".$search_keyword."' in boolean mode)");
} else {
$this->db->like($search_type, $search_keyword);
}
}
if($search_news_type!='') $this->db->where('a.news_type', $search_news_type);
if($search_category_code!='') $this->db->like('a.category_code', $search_category_code, 'after');
$this->db->select('a.*, b.category_name as category_name1');
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('b.depth', '1');
$this->db->from('news as a');
$this->db->join('news_section as b', 'SUBSTRING(a.category_code, 1, 2) = b.category_code');
$this->db->limit($limit, $offset);
//$this->db->order_by($sort_column, 'desc');
$this->db->order_by('a.idx desc');
$res = $this->db->get();
$row = $res->result_array();
if($_SERVER['REMOTE_ADDR']=='24.44.89.197') {
//echo $this->db->last_query();
}
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : news - list - total count
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function news_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_news_type = $req_data['search_news_type'];
$search_category_code = $req_data['search_category_code'];
$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('a.is_display', 'Y');
} else if($search_click2=='2') {
$this->db->like('a.is_display', 'N');
}
if($search_type!='' && $search_keyword!=''){
if($search_type == 'tag') {
$this->db->where("match(tag) against('".$search_keyword."' in boolean mode)");
} else {
$this->db->like($search_type, $search_keyword);
}
}
if($search_news_type!='') $this->db->where('a.news_type', $search_news_type);
if($search_category_code!='') $this->db->like('a.category_code', $search_category_code, 'after');
$this->db->select('a.*, b.category_name as category_name1');
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('b.depth', '1');
$this->db->from('news as a');
$this->db->join('news_section as b', 'SUBSTRING(a.category_code, 1, 2) = b.category_code');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : news - new count
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function news_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$now_date = date("Y-m-d")." 00:00:00";
$search_click2 = '';
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
if($search_click2=='1') {
$this->db->like('is_display', 'Y');
} else if($search_click2=='2') {
$this->db->like('is_display', 'N');
}
if($search_type!='' && $search_keyword!=''){
if($search_type == 'tag') {
$this->db->where("match(tag) against('".$search_keyword."' in boolean mode)");
} else {
$this->db->like($search_type, $search_keyword);
}
}
$this->db->where('is_del', 'N');
$this->db->where('reg_date >=', $now_date);
$this->db->from('news');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display group by
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function news_is_display_group_by_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_news_type = $req_data['search_news_type'];
$search_category_code = $req_data['search_category_code'];
$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!=''){
if($search_type == 'tag') {
$this->db->where("match(tag) against('".$search_keyword."' in boolean mode)");
} else {
$this->db->like($search_type, $search_keyword);
}
}
if($search_news_type!='') $this->db->where('a.news_type', $search_news_type);
if($search_category_code!='') $this->db->like('a.category_code', $search_category_code, 'after');
$this->db->select('a.is_display, count(*) as cnt');
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('b.depth', '1');
$this->db->from('news as a');
$this->db->join('news_section as b', 'SUBSTRING(a.category_code, 1, 2) = b.category_code');
$this->db->group_by('a.is_display');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : news - section_code count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_code_count($req_data){
# request
$category_code = $req_data['category_code'];
$display_date = '';
if(isset($req_data['display_date'])==true) $display_date = $req_data['display_date'];
if($display_date!='') $this->db->where('display_date>=', $display_date);
$this->db->like('category_code', $category_code, 'after');
$this->db->where('is_del', 'N');
$this->db->from('news');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : news category_code update
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_category_code_update($req_data){
# request
$org_category_code = $req_data['org_category_code'];
$category_code = $req_data['category_code'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$update_data['category_code'] = $category_code;
$this->db->where('category_code', $org_category_code);
$row = $this->db->update('news', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 - insert
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['reg_id'] = $user_id;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date']= $now_date;
$this->db->insert('news', $req_data);
$row = $this->db->insert_id();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 - select
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function news_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('news');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 - update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function news_update($req_data){
# request
$idx = $req_data['idx'];
unset($req_data['idx']);
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update('news', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 is_del update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function news_is_del_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$arr_update_data = array();
foreach($req_data as $key=>$val) {
$arr_update_data[$key]['idx'] = $val;
$arr_update_data[$key]['is_del'] = 'Y';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$this->db->update_batch('news', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 - select in idx
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function news_select_in_idx($req_data){
# request
$arr_idx = $req_data;
$this->db->where_in('idx', $arr_idx);
$this->db->where('is_del', 'N');
$this->db->from('news');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 is_display update
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function news_is_display_update($req_data){
# request
$idx = $req_data['idx'];
$is_display = $req_data['is_display'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
if($is_display=='Y') $display_date = $now_date;
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$update_data['display_date'] = $display_date;
$update_data['is_display'] = $is_display;
$this->db->where('idx', $idx);
$row = $this->db->update('news', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : news - list limit 100
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function news_list_limit100($req_data){
# request
$article_keyword = $req_data['article_keyword'];
$sort_column = $req_data['sort_column'];
$sort_type = $req_data['sort_type'];
$this->db->where('(title like "%'.$article_keyword.'%" or content like "%'.$article_keyword.'%" or tag like "%'.$article_keyword.'%")');
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$this->db->from('news');
$this->db->order_by($sort_column, $sort_type);
$this->db->limit(100, 0);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 hit_count update
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function news_hit_count_update($req_data){
# request
$idx = $req_data['idx'];
$hit_count = $req_data['hit_count'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$update_data['hit_count'] = $hit_count;
$this->db->where('idx', $idx);
$row = $this->db->update('news', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 review_count update
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function news_review_count1_update($req_data){
# request
$idx = $req_data['idx'];
$review_count1 = $req_data['review_count1'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$update_data['review_count1'] = $review_count1;
$this->db->where('idx', $idx);
$row = $this->db->update('news', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 관련기사 - list
# CREATE : 2018-03-11
#---------------------------------------------------------------------------
function relation_article_join_news_list($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$this->db->select('a.*, b.title');
$this->db->where('a.content_idx', $content_idx);
$this->db->where('a.content_type', $content_type);
$this->db->where('b.is_del', 'N');
$this->db->from('relation_article as a');
$this->db->join('news as b', 'a.relation_article_idx=b.idx');
$this->db->order_by('a.content_idx', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : tag - select
# CREATE : 2018-03-11
#---------------------------------------------------------------------------
function news_tag_select($req_data){
# request
$content_idx = $req_data['content_idx'];
$tag = $req_data['tag'];
$sql = "select * from `news` where is_del = 'N' and idx!= ".$content_idx." and match(tag, title) against('".$tag."' in boolean mode) order by rand() limit 5";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : group by press_idx
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function news_group_by_press_idx(){
$this->db->select('press_idx, count(press_idx) as cnt');
$this->db->where('is_del', 'N');
$this->db->group_by("press_idx");
$this->db->from('news');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : news 노춯여부에 따른 리스트 - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function news_reservation_article_list(){
$now_date = date("Y-m-d H:i:s");
$this->db->select('idx');
$this->db->where('display_date <=', $now_date);
$this->db->where('display_date !=', '0000-00-00 00:00:00');
$this->db->where('is_display', 'N');
$this->db->where('is_del', 'N');
$this->db->from('news');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 is_display update batch - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function news_is_display_update_batch($req_data){
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$arr_update_data = array();
foreach($req_data as $key=>$val) {
$arr_update_data[$key]['idx'] = $val['idx'];
$arr_update_data[$key]['is_display'] = 'Y';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$row = $this->db->update_batch('news', $arr_update_data, 'idx');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 리스트 - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function news_rank_list($req_data){
# request
$order_by = $req_data['order_by'];
$this->db->where('is_display', 'Y');
$this->db->where('is_del', 'N');
$this->db->from('news');
$this->db->limit(50, 0);
$this->db->order_by($order_by, 'desc');
$this->db->order_by('display_date', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : video_url update
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function news_video_url_update($req_data){
# request
$idx = $req_data['content_idx'];
$video_url = $req_data['video_url'];
$video_playtime = $req_data['video_playtime'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('video_url' => $video_url,
'video_playtime' => $video_playtime,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('news', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스 - 스케쥴 인기순 초기화
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function news_popular_count_where_display_date_update($delete_date){
$start_date = $delete_date.' 00:00:00';
$end_date = $delete_date.' 23:59:59';
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('popular_count' => 0,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('display_date>=', $start_date);
$this->db->where('display_date<=', $end_date);
$row = $this->db->update('news', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function news_where_display_date_list($start_date){
$this->db->select('idx, hit_count, review_count1 as like_count, comment_count');
$this->db->where('display_date >=', $start_date);
$this->db->where('is_display', 'Y');
$this->db->where('is_del', 'N');
$this->db->from('news');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,283 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_news_comment extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list - total count
# CREATE : 2018-03-12
#---------------------------------------------------------------------------
function news_comment_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_news_type = $req_data['search_news_type'];
$search_comment_type = $req_data['search_comment_type'];
$search_category_code = $req_data['search_category_code'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$search_today = $req_data['search_today'];
$search_today_best = $req_data['search_today_best'];
$now_date = date("Y-m-d")." 00:00:00";
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and a.".$search_type." like '%".$search_keyword."%'";
}
if($search_news_type!='') $where_query.=" and c.news_type = '".$search_news_type."'";
if($search_comment_type!='') $where_query.=" and a.is_best = '".$search_comment_type."'";
if($search_category_code!='') $where_query.=" and c.category_code = '".$search_category_code."'";
if($search_today!='') $where_query.=" and a.reg_date >= '".$now_date."'";
if($search_today_best!='') $where_query.=" and a.reg_date >= '".$now_date."' and a.is_best = 'Y'";
if($search_theme_type!='') {
$sql = "select * from (select *, (select GROUP_CONCAT(DISTINCT theme_type ORDER BY theme_type DESC SEPARATOR ',') from theme where is_del='N' and content_idx=content_idx and content_type='".$content_type."') as theme_types
from comment
where is_del = 'N' and content_type='".$content_type."') as a
join news as c on (a.content_idx = c.idx)
where a.theme_types like '%".$search_theme_type."%' ".$where_query;
} else {
$sql = "select *
from comment as a
join news as c on (a.content_idx = c.idx)
where a.is_del = 'N' and a.content_type='".$content_type."' ".$where_query;
}
$res = $this->db->query($sql);
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function news_comment_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_news_type = $req_data['search_news_type'];
$search_comment_type = $req_data['search_comment_type'];
$search_category_code = $req_data['search_category_code'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$search_today = $req_data['search_today'];
$search_today_best = $req_data['search_today_best'];
$now_date = date("Y-m-d")." 00:00:00";
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and a.".$search_type." like '%".$search_keyword."%'";
}
if($search_news_type!='') $where_query.=" and c.news_type = '".$search_news_type."'";
if($search_comment_type!='') $where_query.=" and a.is_best = '".$search_comment_type."'";
if($search_category_code!='') $where_query.=" and c.category_code = '".$search_category_code."'";
if($search_today!='') $where_query.=" and a.reg_date >= '".$now_date."'";
if($search_today_best!='') $where_query.=" and a.reg_date >= '".$now_date."' and a.is_best = 'Y'";
if($search_theme_type!='') {
$sql = "select a.*, c.title, c.press_name, c.reporter_name, c.news_type, a.theme_types, (select category_name from news_section where category_code = SUBSTRING(c.category_code, 1, 2)) as category_name1, (select category_name from news_section where category_code = SUBSTRING(c.category_code, 3, 2)) as category_name2, (select category_name from news_section where category_code = SUBSTRING(c.category_code, 5, 2)) as category_name3, (select comment from comment where is_del='N' and idx=a.p_idx and s_idx > 1) as p_comment, d.member_img
from (select *, (select GROUP_CONCAT(DISTINCT theme_type ORDER BY theme_type DESC SEPARATOR ',') from theme where is_del='N' and content_idx=content_idx and content_type='".$content_type."') as theme_types
from comment
where is_del = 'N' and content_type='".$content_type."') as a
join news as c on (a.content_idx = c.idx)
join member as d on (d.member_id = a.write_id)
where a.theme_types like '%".$search_theme_type."%' ".$where_query." order by a.reg_date desc limit $offset, $limit ";
} else {
$sql = "select a.*, c.title, c.press_name, c.reporter_name, c.news_type, (select GROUP_CONCAT(DISTINCT theme_type ORDER BY theme_type DESC SEPARATOR ',') from theme where is_del='N' and content_idx=content_idx and content_type='".$content_type."') as theme_types, (select category_name from news_section where category_code = SUBSTRING(c.category_code, 1, 2)) as category_name1, (select category_name from news_section where category_code = SUBSTRING(c.category_code, 3, 2)) as category_name2, (select category_name from news_section where category_code = SUBSTRING(c.category_code, 5, 2)) as category_name3, (select comment from comment where is_del='N' and idx=a.p_idx and s_idx > 1) as p_comment, d.member_img
from comment as a
join news as c on (a.content_idx = c.idx)
join member as d on (d.member_id = a.write_id)
where a.is_del = 'N' and a.content_type='".$content_type."' ".$where_query." order by a.reg_date desc limit $offset, $limit ";
}
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : new count
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function news_comment_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_news_type = $req_data['search_news_type'];
$search_comment_type = $req_data['search_comment_type'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$search_category_code = $req_data['search_category_code'];
$now_date = date("Y-m-d")." 00:00:00";
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and a.".$search_type." like '%".$search_keyword."%'";
}
if($search_news_type!='') $where_query.=" and c.news_type = '".$search_news_type."'";
if($search_comment_type!='') $where_query.=" and a.is_best = '".$search_comment_type."'";
if($search_category_code!='') $where_query.=" and c.category_code = '".$search_category_code."'";
if($search_theme_type!='') {
$sql = "select * from (select *, (select GROUP_CONCAT(DISTINCT theme_type ORDER BY theme_type DESC SEPARATOR ',') from theme where is_del='N' and content_idx=content_idx and content_type='".$content_type."') as theme_types
from comment
where is_del = 'N' and content_type='".$content_type."') as a
join `news` as c on (a.content_idx = c.idx)
where a.theme_types like '%".$search_theme_type."%'
and a.reg_date >='".$now_date."' ".$where_query;
} else {
$sql = "select *
from comment as a
join `news` as c on (a.content_idx = c.idx)
where a.is_del = 'N'
and a.content_type='".$content_type."'
and a.reg_date >='".$now_date."' ".$where_query;
}
$res = $this->db->query($sql);
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_best_count
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function news_comment_is_best_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_news_type = $req_data['search_news_type'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$search_category_code = $req_data['search_category_code'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and a.".$search_type." like '%".$search_keyword."%'";
}
if($search_news_type!='') $where_query.=" and c.news_type = '".$search_news_type."'";
if($search_category_code!='') $where_query.=" and c.category_code = '".$search_category_code."'";
if($search_theme_type!='') {
$sql = "select * from (select *, (select GROUP_CONCAT(DISTINCT theme_type ORDER BY theme_type DESC SEPARATOR ',') from theme where is_del='N' and content_idx=content_idx and content_type='".$content_type."') as theme_types
from comment
where is_del = 'N' and content_type='".$content_type."') as a
join `news` as c on (a.content_idx = c.idx)
where a.theme_types like '%".$search_theme_type."%'
and a.is_best ='Y' ".$where_query;
} else {
$sql = "select *
from comment as a
join `news` as c on (a.content_idx = c.idx)
where a.is_del = 'N'
and a.content_type='".$content_type."'
and a.is_best ='Y' ".$where_query;
}
$res = $this->db->query($sql);
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_best new count
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function news_comment_is_best_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_news_type = $req_data['search_news_type'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$search_category_code = $req_data['search_category_code'];
$now_date = date("Y-m-d")." 00:00:00";
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and a.".$search_type." like '%".$search_keyword."%'";
}
if($search_news_type!='') $where_query.=" and c.news_type = '".$search_news_type."'";
if($search_category_code!='') $where_query.=" and c.category_code = '".$search_category_code."'";
if($search_theme_type!='') {
$sql = "select * from (select *, (select GROUP_CONCAT(DISTINCT theme_type ORDER BY theme_type DESC SEPARATOR ',') from theme where is_del='N' and content_idx=content_idx and content_type='".$content_type."') as theme_types
from comment
where is_del = 'N' and content_type='".$content_type."') as a
join `news` as c on (a.content_idx = c.idx)
where a.theme_types like '%".$search_theme_type."%'
and a.is_best ='Y'
and a.reg_date >='".$now_date."' ".$where_query;
} else {
$sql = "select *
from comment as a
join `news` as c on (a.content_idx = c.idx)
where a.is_del = 'N'
and a.is_best ='Y'
and a.content_type='".$content_type."'
and a.reg_date >='".$now_date."' ".$where_query;
}
$res = $this->db->query($sql);
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-09
#---------------------------------------------------------------------------
function news_comment_is_del_update($req_data){
# request
$idx = $req_data['idx'];
$comment_status = $req_data['comment_status'];
$comment = $req_data['comment'];
$user_id = $this->session->userdata('Adm_Id');
$sql = "update comment
set comment_org = comment
, comment = '".$comment."'
, is_del = 'Y'
, comment_status = '".$comment_status."'
, update_id= '".$user_id."'
, update_date= now()
where idx= '".$idx."'";
$row = $this->db->query($sql);
return $row;
}
}
?>

View File

@@ -0,0 +1,294 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_news_section extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 - list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_list($req_data){
# request
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$cateogory_code1 = $req_data['cateogory_code'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
if($cateogory_code1!=''){
$this->db->where('p_category_code', $cateogory_code1);
$this->db->where('depth', '1');
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('news_section');
$this->db->order_by('p_category_code asc, depth asc, display_sort asc, category_code asc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 - list - total count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_list_total_count($req_data){
# request
$cateogory_code1 = $req_data['cateogory_code'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
if($cateogory_code1!=''){
$this->db->where('p_category_code', $cateogory_code1);
$this->db->where('depth', '1');
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('news_section');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 총 글 count
# CREATE : 2018-04-13
#---------------------------------------------------------------------------
function news_section_article_count($req_data){
# request
$cateogory_code1 = $req_data['cateogory_code'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$this->db->select('sum(total_count) as article_count');
if($cateogory_code1!=''){
$this->db->where('p_category_code', $cateogory_code1);
$this->db->where('depth', '1');
}
if($search_type!='' && $search_keyword!='') $this->db->like($search_type, $search_keyword);
$this->db->where('is_del', 'N');
$this->db->from('news_section');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의 글 count
# CREATE : 2018-04-13
#---------------------------------------------------------------------------
function news_section_today_article_count($req_data){
# request
$cateogory_code1 = $req_data['cateogory_code'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$this->db->select('sum(today_count) as today_article_count');
if($cateogory_code1!=''){
$this->db->where('p_category_code', $cateogory_code1);
$this->db->where('depth', '1');
}
if($search_type!='' && $search_keyword!='') $this->db->like($search_type, $search_keyword);
$this->db->where('is_del', 'N');
$this->db->from('news_section');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 - all list
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function news_section_all_list(){
$this->db->where('is_del', 'N');
$this->db->from('news_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : group by depth
# CREATE : 2018-04-13
#---------------------------------------------------------------------------
function news_section_group_by_depth_count(){
$this->db->select('depth, count(depth) as cnt');
$this->db->where('is_del', 'N');
$this->db->group_by("depth");
$this->db->from('news_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 - insert
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_insert($req_data){
# request
$category_name = $req_data['category_name'];
$depth = $req_data['depth'];
$p_category_code = $req_data['p_category_code'];
$display_sort = $req_data['display_sort'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$this->db->select('max(category_code) + 1 as category_code');
$this->db->where('depth', $depth);
if($p_category_code!='') $this->db->where('p_category_code', $p_category_code);
$this->db->from('news_section');
$res1 = $this->db->get();
$row1 = $res1->result_array();
$category_code = $row1[0]['category_code'];
if($depth=='1') {
if($category_code == '') $category_code = '10';
$p_category_code = $category_code;
} else {
if($category_code == '') $category_code = $p_category_code.$category_code = '01';
}
$category_code = sprintf('%02d',$category_code);
$insert_data['category_code'] = $category_code;
$insert_data['category_name'] = $category_name;
$insert_data['display_sort'] = $display_sort;
$insert_data['depth'] = $depth;
$insert_data['p_category_code']= $p_category_code;
$insert_data['reg_id'] = $user_id;
$insert_data['reg_date'] = $now_date;
$insert_data['update_id'] = $user_id;
$insert_data['update_date'] = $now_date;
$row = $this->db->insert('news_section', $insert_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 - update
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_update($req_data){
# request
$idx = $req_data['idx'];
unset($req_data['idx']);
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update('news_section', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 is_del update for category_code
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_is_del_where_category_code_update($req_data){
# request
$p_category_code= $req_data['p_category_code'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('category_code', $p_category_code);
$row = $this->db->update('news_section', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스섹션 is_del update for p_category_code
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function news_section_is_del_where_p_category_code_update($req_data){
# request
$p_category_code= $req_data['p_category_code'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->like('p_category_code', $p_category_code, 'after');
$row = $this->db->update('news_section', $update_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,193 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_ranking extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : ranking news - list
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function ranking_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_ranking_type = $req_data['search_ranking_type'];
$search_category_code = $req_data['search_category_code'];
$content_type = $req_data['content_type'];
$sort_column = $req_data['sort_column'];
$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('b.'.$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');
$this->db->select('a.idx, a.rank, a.title, a.main_img, a.ranking_type, a.content_idx, b.press_name, b.reporter_name, b.reg_date, b.is_display, b.display_date, b.hit_count, b.review_count1 as like_count, 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('ranking 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('b.'.$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_join_news_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'];
$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('b.'.$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');
$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('ranking 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 : ranking news - new count
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function ranking_join_news_new_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'];
$content_type = $req_data['content_type'];
$now_date = date("Y-m-d")." 00:00:00";
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_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('ranking 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 : 랭킹 type list - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_join_news_type_list($req_data){
# request
$content_type = $req_data['content_type'];
$ranking_type = $req_data['ranking_type'];
$this->db->select('a.*, b.hit_count, b.review_count1, b.comment_count, b.press_name');
$this->db->where('a.content_type', $content_type);
$this->db->where('a.ranking_type', $ranking_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('b.is_display', 'Y');
$this->db->from('ranking as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - select
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function ranking_join_news_select($req_data){
# request
$idx = $req_data;
$this->db->select('a.*, b.hit_count, b.review_count1, b.comment_count, 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('ranking as a');
$this->db->join('news as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

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;
}
}
?>