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,532 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_etc_section extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function etc_section_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_etc_section_type= $req_data['search_etc_section_type'];
$search_content_type = $req_data['search_content_type'];
$sort_column = $req_data['sort_column'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and ".$search_type." like '%".$search_keyword."%'";
}
if($search_etc_section_type!='') $where_query.=" and etc_section_type = '".$search_etc_section_type."'";
if($search_content_type!='') $where_query.=" and content_type = '".$search_content_type."'";
$sql = "select * from ((select a.*, b.display_date, b.write_id, b.write_name, b.hit_count, b.like_count, b.comment_count, b.share_count, b.popular_count
from etc_section as a
join news as b on (a.content_idx = b.idx)
where a.is_del='N' and a.content_type='1'
and b.is_del = 'N') union all
(select c.*, d.display_date, d.write_id, d.write_name, d.hit_count, d.like_count, d.comment_count, d.share_count, d.popular_count
from etc_section as c
join `column` as d on (c.content_idx = d.idx)
where c.is_del='N' and c.content_type='2'
and d.is_del = 'N')
union all
(select e.*, f.display_date, f.write_id, f.write_name, f.hit_count, f.like_count, f.comment_count, f.share_count, f.popular_count
from etc_section as e
join life as f on (e.content_idx = f.idx)
where e.is_del='N' and e.content_type='3'
and f.is_del = 'N')) a where 1".$where_query." order by ".$sort_column." desc limit $offset, $limit ";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function etc_section_join_vw_content_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_etc_section_type= $req_data['search_etc_section_type'];
$search_content_type = $req_data['search_content_type'];
$sort_column = $req_data['sort_column'];
$search_is_display = $req_data['search_is_display'];
if($search_type!='' && $search_keyword!='') $this->db->like($search_type, $search_keyword);
if($search_etc_section_type!='') $this->db->where('a.etc_section_type', $search_etc_section_type);
if($search_content_type!='') $this->db->where('a.content_type', $search_content_type);
if($search_is_display!='') $this->db->where('b.is_display', $search_is_display);
$this->db->select('a.*, b.display_date, b.search_name, b.hit_count, b.like_count, b.comment_count, b.is_display');
$this->db->where('a.is_del', 'N');
$this->db->from('etc_section as a');
$this->db->join('vw_content as b', 'a.content_idx=b.idx and a.content_type=b.content_type');
$this->db->limit($limit, $offset);
$this->db->order_by($sort_column, 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function etc_section_display_group_by_list($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_etc_section_type= $req_data['search_etc_section_type'];
$search_content_type = $req_data['search_content_type'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_etc_section_type!='') $this->db->where('a.etc_section_type', $search_etc_section_type);
if($search_content_type!='') $this->db->where('a.content_type', $search_content_type);
$this->db->select('b.is_display, count(*) as cnt');
$this->db->where('a.is_del', 'N');
$this->db->from('etc_section as a');
$this->db->join('vw_content as b', 'a.content_idx=b.idx and a.content_type=b.content_type');
$this->db->group_by('b.is_display');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list - total count
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function etc_section_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_etc_section_type= $req_data['search_etc_section_type'];
$search_content_type = $req_data['search_content_type'];
$search_is_display = $req_data['search_is_display'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_etc_section_type!='') $this->db->where('a.etc_section_type', $search_etc_section_type);
if($search_content_type!='') $this->db->where('a.content_type', $search_content_type);
if($search_is_display!='') $this->db->where('b.is_display', $search_is_display);
$this->db->where('a.is_del', 'N');
$this->db->from('etc_section as a');
$this->db->join('vw_content as b', 'a.content_idx=b.idx and a.content_type=b.content_type');
$res = $this->db->get();
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : etc_section 카드뉴스 송출중 내용가져오기
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function etc_section_card_news_display_select(){
$now_date = date("Y-m-d H:i:s");
$this->db->where('etc_section_type', '4');
$this->db->where('display_date >=', $now_date);
$this->db->where('is_del', 'N');
$this->db->order_by('display_date', 'asc');
$this->db->from('etc_section');
$this->db->limit(1);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - rank count
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function etc_section_rank_count($req_data){
# request
$etc_section_type = $req_data['etc_section_type'];
$rank = $req_data['rank'];
$this->db->where('etc_section_type', $etc_section_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$this->db->from('etc_section');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 is_del update
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function etc_section_rank_is_del_update($req_data){
# request
$etc_section_type = $req_data['etc_section_type'];
$rank = $req_data['rank'];
$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('etc_section_type', $etc_section_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$row = $this->db->update('etc_section', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 insert
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function etc_section_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;
$row = $this->db->insert('etc_section', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 content_idx - select
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function etc_section_content_idx_select($req_data){
# request
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('etc_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 content_idx - list
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function etc_section_content_idx_list($req_data){
# request
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$search_type = $req_data['search_type'];
$search_key = $req_data['search_key'];
if($search_type!='' && $search_key!='') $this->db->where($search_type, $search_key);
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('etc_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 is_display update where content_idx
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function etc_section_is_display_where_content_idx_update($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['is_display'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_display', 'N');
$this->db->where('is_del', 'N');
$row = $this->db->update('etc_section', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 content_idx
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function etc_section_rank_content_idx_select($req_data){
# request
$etc_section_type = $req_data['etc_section_type'];
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$rank = $req_data['rank'];
$this->db->select('idx');
$this->db->where('etc_section_type', $etc_section_type);
$this->db->where('rank', $rank);
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('etc_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - update
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function etc_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('etc_section', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function etc_section_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('etc_section', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : type 별 list - 예약제외
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function etc_section_type_list($req_data){
# request
$etc_section_type = $req_data['etc_section_type'];
$sql = "select * from ((select a.*, b.display_date, b.write_id, b.write_name, b.hit_count, b.like_count, b.comment_count, b.share_count, b.popular_count
from etc_section as a
join news as b on (a.content_idx = b.idx)
where a.is_del='N' and a.content_type='1'
and b.is_del = 'N'
and a.is_display = 'Y'
and a.etc_section_type = '".$etc_section_type."')
union all
(select c.*, d.display_date, d.write_id, d.write_name, d.hit_count, d.like_count, d.comment_count, d.share_count, d.popular_count
from etc_section as c
join `column` as d on (c.content_idx = d.idx)
where c.is_del='N' and c.content_type='2'
and d.is_del = 'N'
and c.is_display = 'Y'
and c.etc_section_type = '".$etc_section_type."')
union all
(select e.*, f.display_date, f.write_id, f.write_name, f.hit_count, f.like_count, f.comment_count, f.share_count, f.popular_count
from etc_section as e
join life as f on (e.content_idx = f.idx)
where e.is_del='N' and e.content_type='3'
and f.is_del = 'N'
and e.is_display = 'Y'
and e.etc_section_type = '".$etc_section_type."')) a ";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 + 컨텐츠
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function etc_section_join_content_select($req_data){
# request
$idx = $req_data;
$this->db->select('a.*');
$this->db->where('a.is_del', 'N');
$this->db->where('a.idx', $idx);
$this->db->from('etc_section as a');
$this->db->join('vw_content as b', 'a.content_type=b.content_type and a.content_idx=b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 예약글 따른 리스트 - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function today_word_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('is_display', 'N');
$this->db->where('is_del', 'N');
$this->db->from('today_word');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update batch
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function today_word_is_display_update_batch($req_data){
$user_id = 'system';
$now_date = date("Y-m-d");
$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('today_word', $arr_update_data, 'idx');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update batch - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function etc_section_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('etc_section', $arr_update_data, 'idx');
return $row;
}
}
?>

View File

@@ -0,0 +1,475 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_life_etc_section extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_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_etc_section_type= $req_data['search_etc_section_type'];
$search_category = $req_data['search_category'];
$sort_column = $req_data['sort_column'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
if($search_category!='') $where_query.=" and AA.category_idx = '".$search_category."'";
$sql = "select *
from (select a.*, b.category_name, c.channel_name, c.channel_icon, (select count(*) from partner where channel_idx=a.channel_idx) as editor_count, (select count(*) from life where channel_idx=a.channel_idx and is_del='N') as article_count, (select sum(hit_count) from life where channel_idx=a.channel_idx and is_del='N') as hit_count
from life_etc_section as a
join category as b on (a.category_idx = b.idx)
join channel as c on (a.channel_idx = c.idx)
where a.is_del='N'
and b.is_del='N'
and c.is_del='N'
and a.etc_section_type = '".$search_etc_section_type."') as AA
where 1".$where_query." order by AA.".$sort_column." desc limit $offset, $limit ";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list - total count
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_etc_section_type= $req_data['search_etc_section_type'];
$search_category = $req_data['search_category'];
if($search_type!='' && $search_keyword!=''){
$this->db->like('c.'.$search_type, $search_keyword);
}
if($search_category!='') $this->db->where('a.category_idx', $search_category);
$this->db->select('count(a.idx)');
$this->db->where('a.etc_section_type', $search_etc_section_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('c.is_del', 'N');
$this->db->from('life_etc_section as a');
$this->db->join('category as b', 'a.category_idx = b.idx');
$this->db->from('channel as c', 'a.channel_idx=c.idx');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : type 별 list
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_type_list($req_data){
# request
$etc_section_type = $req_data['etc_section_type'];
$this->db->where('etc_section_type', $etc_section_type);
$this->db->where('is_del', 'N');
$this->db->from('life_etc_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : type 별 list
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_detail_type_list($req_data){
# request
$etc_section_type = $req_data['etc_section_type'];
$this->db->select('a.*, b.hit_count, b.editor_name');
$this->db->where('a.etc_section_type', $etc_section_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->from('life_etc_section_detail as a');
$this->db->from('life as b', 'a.content_idx=b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : life_etc_section insert
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function life_etc_section_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('life_etc_section', $req_data);
$row = $this->db->insert_id();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : life_etc_section_detail insert
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function life_etc_section_detail_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('life_etc_section_detail', $req_data);
$row = $this->db->insert_id();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_and_life_etc_section_detail_is_del_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$arr_update_data1 = array();
$arr_update_data2 = array();
foreach($req_data as $key=>$val) {
$arr_update_data1[$key]['idx'] = $val;
$arr_update_data1[$key]['is_del'] = 'Y';
$arr_update_data1[$key]['update_id'] = $user_id;
$arr_update_data1[$key]['update_date'] = $now_date;
$arr_update_data2[$key]['life_etc_section_idx'] = $val;
$arr_update_data2[$key]['is_del'] = 'Y';
$arr_update_data2[$key]['update_id'] = $user_id;
$arr_update_data2[$key]['update_date'] = $now_date;
}
$this->db->update_batch('life_etc_section', $arr_update_data1, 'idx');
$this->db->update_batch('life_etc_section_detail', $arr_update_data2, 'life_etc_section_idx');
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('life_etc_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function life_etc_section_where_rank_select($req_data){
# request
$rank = $req_data['rank'];
$etc_section_type = $req_data['etc_section_type'];
$this->db->where('rank', $rank);
$this->db->where('etc_section_type', $etc_section_type);
$this->db->where('is_del', 'N');
$this->db->from('life_etc_section');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function life_etc_section_detail_where_rank_select($req_data){
# request
$rank = $req_data['rank'];
$life_etc_section_idx = $req_data['life_etc_section_idx'];
$this->db->where('rank', $rank);
$this->db->where('life_etc_section_idx', $life_etc_section_idx);
$this->db->where('is_del', 'N');
$this->db->from('life_etc_section_detail');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_detail_list($req_data){
# request
$life_etc_section_idx = $req_data;
$this->db->select('a.*, b.hit_count, b.editor_name');
$this->db->where('a.life_etc_section_idx', $life_etc_section_idx);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->from('life_etc_section_detail as a');
$this->db->join('life as b', 'a.content_idx=b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_detail_is_del_update($req_data){
# request
$idx = $req_data;
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('is_del' => 'Y',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('life_etc_section_detail', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_detail_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('life_etc_section_detail', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_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('life_etc_section', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_is_del_update($req_data){
# request
$idx = $req_data;
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array();
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$update_data['is_del'] = 'Y';
$this->db->where('idx', $idx);
$row = $this->db->update('life_etc_section', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_etc_section_detail_is_del_where_section_idx_update($req_data){
# request
$life_etc_section_idx = $req_data;
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array();
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$update_data['is_del'] = 'Y';
$this->db->where('life_etc_section_idx', $life_etc_section_idx);
$row = $this->db->update('life_etc_section_detail', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_editor_etc_section_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_etc_section_type= $req_data['search_etc_section_type'];
$search_category = $req_data['search_category'];
$sort_column = $req_data['sort_column'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
if($search_category!='') $where_query.=" and AA.category_idx = '".$search_category."'";
$sql = "select *
from (select a.*, b.category_name, c.channel_name, d.partner_img, d.partner_name, (select count(*) from life where partner_idx=a.partner_idx and is_del='N') as article_count, (select sum(hit_count) from life where partner_idx=a.partner_idx and is_del='N') as hit_count
from life_etc_section as a
join category as b on (a.category_idx = b.idx)
join channel as c on (a.channel_idx = c.idx)
join partner as d on (a.partner_idx = d.idx)
where a.is_del='N'
and b.is_del='N'
and c.is_del='N'
and d.is_del='N'
and a.etc_section_type = '".$search_etc_section_type."') as AA
where 1".$where_query." order by AA.".$sort_column." desc limit $offset, $limit ";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 - list - total count
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function life_editor_etc_section_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_etc_section_type= $req_data['search_etc_section_type'];
$search_category = $req_data['search_category'];
if($search_type!='' && $search_keyword!=''){
$this->db->like('d.'.$search_type, $search_keyword);
}
if($search_category!='') $this->db->where('a.category_idx', $search_category);
$this->db->select('count(a.idx)');
$this->db->where('a.etc_section_type', $search_etc_section_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.is_del', 'N');
$this->db->from('life_etc_section as a');
$this->db->join('category as b', 'a.category_idx = b.idx');
$this->db->join('channel as c', 'a.channel_idx=c.idx');
$this->db->join('partner as d', 'a.partner_idx=d.idx');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,463 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_main_category extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 - list
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_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_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_category_code1!='') {
$this->db->where('p_category_code', $search_category_code1);
}
if($search_category_code2!='') {
$this->db->where('category_code', $search_category_code2);
$this->db->where('p_category_code', $search_category_code1);
}
$this->db->where('is_del', 'N');
$this->db->from('main_category');
$this->db->order_by('p_category_code asc, depth asc, category_code asc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 - list용 - total count
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_category_code1 = $req_data['search_category_code1'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_category_code1!='') {
$this->db->where('p_category_code', $search_category_code1);
}
$this->db->where('is_del', 'N');
$this->db->from('main_category');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 - insert
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_insert($req_data){
# request
$category_name = $req_data['category_name'];
$category_img = $req_data['category_img'];
$depth = $req_data['depth'];
$p_category_code = $req_data['p_category_code'];
$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('main_category');
$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 = '01';
}
$category_code = sprintf('%02d',$category_code);
$insert_data['category_code'] = $category_code;
$insert_data['category_name'] = $category_name;
$insert_data['category_img'] = $category_img;
$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('main_category', $insert_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 - update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_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('main_category', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 - all list
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_all_list($req_data){
# request
$depth = $req_data;
if($depth!='') $this->db->where('depth', $depth);
$this->db->where('is_del', 'N');
$this->db->from('main_category');
$this->db->order_by('category_code asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 select in idx
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_in_p_category_code($req_data){
# request
$p_category_codes = $req_data;
$this->db->where_in('p_category_code', $p_category_codes);
$this->db->where('is_del', 'N');
$this->db->from('main_category');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 is_del where p_category_code update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_is_del_where_p_category_code_update($req_data){
$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;
$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]['p_category_code'] = $val;
$arr_update_data[$key]['is_del'] = 'Y';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$row = $this->db->update_batch('main_category', $arr_update_data, 'p_category_code');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 - select
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_select($req_data){
# request
$p_category_code = $req_data['p_category_code'];
$idx = $req_data['idx'];
if($p_category_code!='') $this->db->where('p_category_code', $p_category_code);
if($idx!='') $this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('main_category');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 is_del update - 사용안함.나중에도 안쓰면 지우기
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_is_del_update($req_data){
# request
$idx = $req_data['idx'];
$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;
if($idx!='') $this->db->where('idx', $idx);
if($p_category_code!='') $this->db->where('p_category_code', $p_category_code);
$row = $this->db->update('main_category', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 category_code count
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function main_category_code_count($req_data){
# request
$depth = $req_data['depth'];
$category_code = $req_data['category_code'];
if($depth == '1') {
$this->db->where('category_code1', $category_code);
} else {
$this->db->where('category_code2', $category_code);
}
$this->db->where('is_del', 'N');
$this->db->from('main_category_company');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체 - list
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_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_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_category_code1!='') {
$this->db->where('a.category_code1', $search_category_code1);
if($search_category_code2!='') $this->db->where('a.category_code2', $search_category_code2);
}
$this->db->select('a.*, b.category_name as category_name1, c.category_name as category_name2');
$this->db->where('a.is_del', 'N');
$this->db->where('b.depth', '1');
$this->db->where('c.depth', '2');
$this->db->where('c.p_category_code = b.category_code');
$this->db->from('main_category_company as a');
$this->db->join('main_category as b', 'a.category_code1=b.category_code');
$this->db->join('main_category as c', 'a.category_code2=c.category_code');
$this->db->order_by('a.idx desc');
$this->db->limit($limit, $offset);
//echo $this->db->get_compiled_select();
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체- list용 - total count
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_category_code1!='') {
$this->db->where('a.category_code1', $search_category_code1);
if($search_category_code2!='') $this->db->where('a.category_code2', $search_category_code2);
}
$this->db->where('a.is_del', 'N');
$this->db->where('b.depth', '1');
$this->db->where('c.depth', '2');
$this->db->where('c.p_category_code = b.category_code');
$this->db->from('main_category_company as a');
$this->db->join('main_category as b', 'a.category_code1=b.category_code');
$this->db->join('main_category as c', 'a.category_code2=c.category_code');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체 - insert
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_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;
$row = $this->db->insert('main_category_company', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체 - select
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('main_category_company');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체 - update
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_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('main_category_company', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체 is_del update
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_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('main_category_company', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : main 카테고리 업체 - select in idx
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function main_category_company_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('main_category_company');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,233 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_press extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function press_list($req_data){
# request
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$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') $this->db->like('is_direct', 'Y');
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('press');
$this->db->order_by($sort_column, 'desc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - list - total count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function press_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_click1 = '';
if(isset($req_data['search_click1'])==true) $search_click1 = $req_data['search_click1'];
if($search_click1=='1') $this->db->like('is_direct', 'Y');
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('press');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - all list
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function press_all_list(){
$this->db->where('is_del', 'N');
$this->db->from('press');
$this->db->order_by('reg_date', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - 바로가기 count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function press_is_direct_list_count($req_data){
# request
$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->where('is_direct', 'Y');
$this->db->from('press');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - insert
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function press_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;
$row = $this->db->insert('press', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - select
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function press_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('press');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function press_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('press', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - update_batch
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function press_article_count_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) {
if($val['press_idx']=='') continue;
$arr_update_data[$key]['idx'] = $val['press_idx'];
$arr_update_data[$key]['article_count'] = $val['cnt'];
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$row = $this->db->update_batch('press', $arr_update_data, 'idx');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 is_del update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function press_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('press', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 언론사 - select in idx
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function press_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('press');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,165 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_recommend_app extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 list
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_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('recommend_app');
$this->db->order_by('idx desc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 list용 - total count
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_list_total_count($req_data){
# request
$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('recommend_app');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 - insert
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_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;
$row = $this->db->insert('recommend_app', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 - select
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('recommend_app');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 - update
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_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('recommend_app', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 is_del update
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_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('recommend_app', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 추천앱 - select in idx
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function recommend_app_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('recommend_app');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,163 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_today_word extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의말씀 - list
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function today_word_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('today_word')->order_by('display_date', 'desc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의말씀 - list - total count
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function today_word_list_total_count($req_data){
# request
$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('today_word');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의말씀 - insert
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function today_word_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;
$row = $this->db->insert('today_word', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의말씀 - update
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function today_word_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('today_word', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의말씀 - select
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function today_word_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('today_word');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오늘의말씀 is_del update
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function today_word_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('today_word', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 예약글 업데이트
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function today_word_reservation_update(){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$display_now_date = date("Y-m-d");
$req_data['is_display'] = 'Y';
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'N');
$this->db->where('display_date<=', $display_now_date);
$row = $this->db->update('today_word', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,344 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_weather extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - list
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function weather_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_display_status = $req_data['search_display_status'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
if($search_display_status!='') $where_query.=" and AA.display_status = '".$search_display_status."'";
$sql = "select *
from (SELECT *, (select GROUP_CONCAT(DISTINCT b.title ORDER BY b.title DESC SEPARATOR '||||') from relation_article as a join news as b on (a.relation_article_idx=b.idx) where b.is_del='N' and a.content_type='5' and a.content_idx=weather.idx) as news_title, (select relation_article_idx from relation_article as a join news as b on (a.relation_article_idx=b.idx) where b.is_del='N' and a.content_type='5' and a.content_idx=weather.idx limit 1) as news_idx
FROM weather WHERE is_del = 'N'
) as AA where 1 ".$where_query." order by AA.reg_date desc limit $offset, $limit ";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - list - total count
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function weather_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_display_status = $req_data['search_display_status'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
if($search_display_status!='') $where_query.=" and AA.display_status = '".$search_display_status."'";
$sql = "select *
from (SELECT *, (select GROUP_CONCAT(DISTINCT b.title ORDER BY b.title DESC SEPARATOR '||||') from relation_article as a join news as b on (a.relation_article_idx=b.idx) where b.is_del='N' and a.content_type='5' and a.content_idx=weather.idx) as news_title
FROM weather WHERE is_del = 'N'
) as AA where 1 ".$where_query;
$res = $this->db->query($sql);
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - 상태별 count
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_list_display_status($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
$sql = "select display_status, count(*) as cnt
from (SELECT *, (select GROUP_CONCAT(DISTINCT b.title ORDER BY b.title DESC SEPARATOR '||||') from relation_article as a join news as b on (a.relation_article_idx=b.idx) where b.is_del='N' and a.content_type='5' and a.content_idx=weather.idx) as news_title
FROM weather WHERE is_del = 'N'
) as AA where 1 ".$where_query." group by display_status";
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : display_status update
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_display_status_update($req_data){
# request
$idx = $req_data['idx'];
$display_status = $req_data['display_status'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
if($display_status=='1') $display_date = $now_date;
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
if($display_status=='1') $update_data['display_date'] = $display_date;
$update_data['display_status'] = $display_status;
$this->db->where('idx', $idx);
$row = $this->db->update('weather', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_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('weather', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 날씨아이콘 - list
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_icon_list(){
$this->db->from('weather_icon');
$this->db->order_by('idx', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 날씨아이콘 - insert
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_icon_insert($req_data){
# request
$weather_icon = $req_data;
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$insert_data = array('weather_icon' => $weather_icon,
'reg_id' => $user_id,
'reg_date' => $now_date,
);
$row = $this->db->insert('weather_icon', $insert_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - insert
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_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('weather', $req_data);
$row = $this->db->insert_id();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - select
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('weather');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - update
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_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('weather', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - 랭크 count - 예약, 미사용제외
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_rank_select($req_data){
# request
$rank = $req_data['rank'];
$this->db->where('rank', $rank);
$this->db->where('display_status', '1');
$this->db->where('is_del', 'N');
$this->db->from('weather');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - rank list - 예약, 미사용제외
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_rank_list(){
$this->db->where('display_status', '1');
$this->db->where('is_del', 'N');
$this->db->from('weather');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 관련기사 - list
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function weather_join_relation_article_join_news_list($req_data){
# request
$content_type = $req_data['content_type'];
$this->db->select('a.rank, c.idx, c.title');
$this->db->where('a.display_status', '1');
$this->db->where('a.is_del', 'N');
$this->db->where('c.is_del', 'N');
$this->db->from('weather as a');
$this->db->join('relation_article as b', 'a.idx=b.content_idx and b.content_type='.$content_type);
$this->db->join('news as c', 'b.relation_article_idx=c.idx');
$this->db->order_by('a.reg_date', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 예약글 업데이트
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function weather_reservation_update(){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$display_now_date = date("Y-m-d");
$req_data['display_status'] = '1';
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('is_del', 'N');
$this->db->where('display_status', '0');
$this->db->where('display_date<=', $display_now_date);
$row = $this->db->update('weather', $req_data);
return $row;
}
}
?>