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,68 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_admin_member extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 수정
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function member_edit_proc($req_data){
# request
$org_user_pwd = $req_data['org_user_pwd'];
$user_id = $this->session->userdata('Adm_Id');
$sql1 = "select * from admin where is_del = 'N' and user_id ='".$user_id."' and user_pwd = MD5('".$org_user_pwd."')";
$res1 = $this->db->query($sql1);
$row1 = $res1->row();
$array = json_decode(json_encode($row1), true);
return $array;
}
#---------------------------------------------------------------------------
# PURPOSE : 비밀번호 수정
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function member_passwd_update($req_data){
# request
$new_user_pwd = $req_data['new_user_pwd'];
$user_id = $this->session->userdata('Adm_Id');
$sql1 = "update admin
set user_pwd = MD5('".$new_user_pwd."')
where is_del = 'N' and user_id ='".$user_id."'";
$this->db->query($sql1);
}
#---------------------------------------------------------------------------
# PURPOSE : admin where user_id count
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function admin_where_partner_id_count($req_data){
# request
$user_id = $req_data;
$this->db->where('user_id', $user_id);
$this->db->from('admin');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,76 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_login extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
}
#---------------------------------------------------------------------------
# PURPOSE : 어드민 로그인 실핼
# CREATE : 2018-02-18
#---------------------------------------------------------------------------
function login_proc($req_data){
# request
$user_id = $req_data['user_id'];
$user_pwd = $req_data['user_pwd'];
$sql1 = "select idx, user_id, user_name, last_login_date, '0' as member_group_idx from admin where is_del = 'N' and user_id ='".$user_id."' and user_pwd = MD5('".$user_pwd."')";
$res1 = $this->db->query($sql1);
$row1 = $res1->row();
$array = json_decode(json_encode($row1), true);
return $array;
}
#---------------------------------------------------------------------------
# PURPOSE : 마지막 로그인 업데이트
# CREATE : 2018-02-18
#---------------------------------------------------------------------------
function last_login_update($req_data){
# request
$idx = $req_data['idx'];
$tb = $req_data['tb'];
$now_date = date("Y-m-d H:i:s");
$update_data = array();
$update_data['last_login_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update($tb, $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 파트너 어드민 로그인 실핼
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function partner_login_proc($req_data){
# request
$user_id = $req_data['user_id'];
$user_pwd = $req_data['user_pwd'];
$sql1 = "select idx, partner_id as user_id, partner_name as user_name, last_login_date, member_group_idx from partner where is_del = 'N' and partner_id ='".$user_id."' and partner_pwd = MD5('".$user_pwd."')";
$res1 = $this->db->query($sql1);
$row1 = $res1->row();
$array = json_decode(json_encode($row1), true);
return $array;
}
}
?>

View File

@@ -0,0 +1,74 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_ad_detail extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
}
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름
#---------------------------------------------------------------------------
# PURPOSE :
# CREATE :
#---------------------------------------------------------------------------
function detail_list(){
# request
$sql1 = "SELECT a.idx, b.page_name, b.ad_pos_name, a.ad_code, a.ad_file, a.ad_option FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx";
$res1 = $this->db->query($sql1);
$i = 0;
$return_data = array();
foreach($res1->result_array() as $row) {
$return_data['row'][$i] = $row;
$i++;
}
// $array = json_decode(json_encode($row1), true);
return $return_data;
}
#---------------------------------------------------------------------------
# PURPOSE : 비밀번호 수정
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
// function member_passwd_update($req_data){
// # request
// $new_user_pwd = $req_data['new_user_pwd'];
// $user_id = $this->session->userdata('Adm_Id');
// $sql1 = "update admin
// set user_pwd = MD5('".$new_user_pwd."')
// where is_del = 'N' and user_id ='".$user_id."'";
// $this->db->query($sql1);
// }
#---------------------------------------------------------------------------
# PURPOSE : admin where user_id count
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
// function admin_where_partner_id_count($req_data){
// # request
// $user_id = $req_data;
// $this->db->where('user_id', $user_id);
// $this->db->from('admin');
// $row = $this->db->count_all_results();
// return $row;
// }
}
?>

View File

@@ -0,0 +1,737 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_column extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : column - list
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function column_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_write_id = $req_data['search_write_id'];
$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('reg_date >=', $today_date);
}
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 if($search_type == 'write_id') {
$this->db->where($search_type, $search_keyword);
} else {
$this->db->like($search_type, $search_keyword);
}
}
if($search_write_id!='') $this->db->where('write_id', $search_write_id);
$this->db->where('is_del', 'N');
$this->db->from('column');
$this->db->limit($limit, $offset);
$this->db->order_by($sort_column, 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : column list - total count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function column_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_write_id = $req_data['search_write_id'];
$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('reg_date >=', $today_date);
}
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 if($search_type == 'write_id') {
$this->db->where($search_type, $search_keyword);
} else {
$this->db->like($search_type, $search_keyword);
}
}
if($search_write_id!='') $this->db->where('write_id', $search_write_id);
$this->db->where('is_del', 'N');
$this->db->from('column');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : column - list
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function column_is_display_group_by_list($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_write_id = $req_data['search_write_id'];
$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('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 if($search_type == 'write_id') {
$this->db->where($search_type, $search_keyword);
} else {
$this->db->like($search_type, $search_keyword);
}
}
if($search_write_id!='') $this->db->where('write_id', $search_write_id);
$this->db->select('is_display, count(*) as cnt');
$this->db->where('is_del', 'N');
$this->db->from('column');
$this->db->group_by('is_display');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : new count
# CREATE : 2018-06-11
#---------------------------------------------------------------------------
function column_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_write_id = $req_data['search_write_id'];
$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 if($search_type == 'write_id') {
$this->db->where($search_type, $search_keyword);
} else {
$this->db->like($search_type, $search_keyword);
}
}
$now_date = date("Y-m-d")." 00:00:00";
if($search_write_id!='') $this->db->where('write_id', $search_write_id);
$this->db->where('is_del', 'N');
$this->db->where('reg_date >=', $now_date);
$this->db->from('column');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : column - list limit 100
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function column_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('column');
$this->db->order_by($sort_column, $sort_type);
$this->db->limit(100, 0);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : column - insert
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function column_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('column', $req_data);
$row = $this->db->insert_id();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : column - update
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function column_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('column', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function column_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('column', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme column - list
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function theme_join_column_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'];
$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('b.'.$search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
$this->db->select('a.idx, a.rank, a.title, a.theme_img as main_img, a.theme_type, a.content_idx, b.column_name, a.reg_date, b.is_display, b.display_date, b.hit_count, b.like_count, b.comment_count, b.share_count');
$this->db->where('a.content_type', $content_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->from('theme as a');
$this->db->join('column as b', 'a.content_idx = b.idx');
$this->db->limit($limit, $offset);
$this->db->order_by($sort_column, 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme column - list - total count
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function theme_join_column_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'];
$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('b.'.$search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
$this->db->where('a.content_type', $content_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->from('theme as a');
$this->db->join('column as b', 'a.content_idx = b.idx');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme column - list
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function theme_join_column_is_display_group_by_list($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_theme_type = $req_data['search_theme_type'];
$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_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
$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->from('theme as a');
$this->db->join('column as b', 'a.content_idx = b.idx');
$this->db->group_by('b.is_display');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : new count
# CREATE : 2018-06-11
#---------------------------------------------------------------------------
function theme_join_column_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'];
$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');
}
if($search_type!='' && $search_keyword!=''){
$this->db->like('b.'.$search_type, $search_keyword);
}
if($search_theme_type!='') $this->db->where('a.theme_type', $search_theme_type);
$now_date = date("Y-m-d")." 00:00:00";
$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('a.reg_date >=', $now_date);
$this->db->from('theme as a');
$this->db->join('column as b', 'a.content_idx = b.idx');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function column_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('column');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 type list - select
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function theme_join_column_type_list($req_data){
# request
$content_type = $req_data['content_type'];
$theme_type = $req_data['theme_type'];
$this->db->select('a.*, b.partner_idx, b.column_name');
$this->db->where('a.content_type', $content_type);
$this->db->where('a.theme_type', $theme_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('a.is_display', 'Y');
$this->db->from('theme as a');
$this->db->join('column as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : theme column - select
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function theme_join_column_select($req_data){
# request
$idx = $req_data;
$this->db->select('a.*, b.column_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('column as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 관련기사 - list
# CREATE : 2018-03-11
#---------------------------------------------------------------------------
function relation_article_join_column_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('column 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 column_tag_select($req_data){
# request
$content_idx = $req_data['content_idx'];
$tag = $req_data['tag'];
$sql = "select * from `column` 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 : is_del where partner_idx update
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function column_is_del_where_partner_idx_update($req_data){
# request
$partner_idx = $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;
$this->db->where('partner_idx', $partner_idx);
$row = $this->db->update('column', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 예약글 따른 리스트 - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function column_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('column');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update batch
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function column_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('column', $arr_update_data, 'idx');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : video_url update
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function column_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('column', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 스케쥴 인기순 초기화
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function column_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('column', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function column_where_display_date_list($start_date){
$this->db->select('idx, hit_count, 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('column');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,261 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_column_comment extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list - total count
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function column_comment_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_comment_type = $req_data['search_comment_type'];
$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_comment_type!='') $where_query.=" and a.is_best = '".$search_comment_type."'";
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 `column` 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 `column` 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 column_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_comment_type = $req_data['search_comment_type'];
$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_comment_type!='') $where_query.=" and a.is_best = '".$search_comment_type."'";
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.column_name, (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 `column` as c on (a.content_idx = c.idx)
join member as d on (a.write_id = d.member_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.column_name, (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 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 `column` as c on (a.content_idx = c.idx)
join member as d on (a.write_id = d.member_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 column_comment_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_comment_type = $req_data['search_comment_type'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$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_comment_type!='') $where_query.=" and a.is_best = '".$search_comment_type."'";
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 `column` 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 `column` 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 column_comment_is_best_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and a.".$search_type." like '%".$search_keyword."%'";
}
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 `column` 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 `column` 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 column_comment_is_best_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'];
$content_type = $req_data['content_type'];
$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_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 `column` 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 `column` 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 column_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,214 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_comment extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list - total count
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function comment_where_write_id_list_total_count($req_data){
# request
$write_id = $req_data['write_id'];
$this->db->where('write_id', $write_id);
$this->db->from('comment');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function comment_where_write_id_list($req_data){
# request
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$write_id = $req_data['write_id'];
$this->db->where('write_id', $write_id);
$this->db->from('comment');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update - news
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function comment_is_del_where_write_id_update($req_data){
# request
$write_id = $req_data['write_id'];
$comment_status = $req_data['comment_status'];
$comment = $req_data['comment'];
$content_type = $req_data['content_type'];
$user_id = $this->session->userdata('Adm_Id');
$sql = "update comment
set comment_status = '".$comment_status."'
, comment_org = comment
, comment = '".$comment."'
, is_del = 'Y'
, update_id = '".$user_id."'
, update_date = now()
where content_type = '".$content_type."' and write_id = '".$write_id."' and is_del = 'N'";
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : blind 해지 update
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function comment_blind_stop_update($req_data){
# request
$idx = $req_data['idx'];
$comment_status = $req_data['comment_status'];
$user_id = $this->session->userdata('Adm_Id');
$sql = "update comment
set comment_status = '".$comment_status."'
, comment = comment_org
, is_del = 'N'
, update_id = '".$user_id."'
, update_date = now()
where idx = '".$idx."'";
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : contents update
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function comment_is_best_all_update(){
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$update_data = array('is_best' => 'N',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('is_best', 'Y');
$row = $this->db->update('comment', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : contents update
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function comment_is_best_update($req_data){
# request
$content_type = $req_data['content_type'];
$like_count = $req_data['like_count'];
$limit = $req_data['limit'];
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$update_data = array('is_best' => 'Y',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('is_best', 'N');
$this->db->where('content_type', $content_type);
$this->db->where('like_count>=', $like_count);
$this->db->order_by('reg_date', 'desc');
$this->db->limit($limit, 0);
$row = $this->db->update('comment', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-27
#---------------------------------------------------------------------------
function comment_select($idx){
# request
$this->db->where('idx', $idx);
$this->db->from('comment');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function comment_update($req_data){
# request
$idx = $req_data['idx'];
unset($req_data['idx']);
$this->db->where('idx', $idx);
$row = $this->db->update('comment', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-27
#---------------------------------------------------------------------------
function comment_where_p_idx_select($p_idx){
# request
$this->db->where('p_idx', $p_idx);
$this->db->where('s_idx', '1');
$this->db->from('comment');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,63 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_contents_setting extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : contents_setting select
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function contents_setting_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->from('contents_setting');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : contents_setting update
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function contents_setting_update($req_data){
# request
$idx = $req_data['idx'];
$is_duplication = $req_data['is_duplication'];
$no_duplication_setting = $req_data['no_duplication_setting'];
$stat_time = $req_data['stat_time'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('is_duplication' => $is_duplication,
'no_duplication_setting' => $no_duplication_setting,
'stat_time' => $stat_time,
'update_id' => $user_id,
'update_date' => $now_date
);
if(isset($req_data['etc_char1'])==true) {
$update_data['etc_char1'] = $req_data['etc_char1'];
}
$this->db->where('idx', $idx);
$row = $this->db->update('contents_setting', $update_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,143 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_crud extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function insert($req_data){
# request
$tb = $req_data['tb'];
$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($tb, $req_data);
$row = $this->db->insert_id();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function select($req_data){
# request
$idx = $req_data['idx'];
$tb = $req_data['tb'];
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from($tb);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function update($req_data){
# request
$idx = $req_data['idx'];
$tb = $req_data['tb'];
unset($req_data['idx']);
unset($req_data['tb']);
$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($tb, $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function is_del_update($req_data){
# request
$tb = $req_data['tb'];
$data = $req_data['data'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$arr_update_data = array();
foreach($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($tb, $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : select in idx
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function select_in_idx($req_data){
# request
$tb = $req_data['tb'];
$data = $req_data['data'];
$arr_idx = $data;
$this->db->where_in('idx', $arr_idx);
$this->db->where('is_del', 'N');
$this->db->from($tb);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select all list
# CREATE : 2018-03-07
#---------------------------------------------------------------------------
function select_all_list($req_data){
# request
$tb = $req_data['tb'];
$this->db->where('is_del', 'N');
$this->db->from($tb);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,35 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_delivery extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function delivery_where_content_type_content_idx_count($req_data){
# request
$start_date = $req_data['start_date'];
$content_type = $req_data['content_type'];
$main_idx = $req_data['main_idx'];
$this->db->where('main_idx', $main_idx);
$this->db->where('content_type', $content_type);
$this->db->where('reg_date >=', $start_date);
$this->db->where('is_del', 'N');
$this->db->from('delivery');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,345 @@
<?
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 : 랭킹 - rank count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_rank_count($req_data){
# request
$ranking_type = $req_data['ranking_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$this->db->where('ranking_type', $ranking_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->from('ranking');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_rank_is_del_update($req_data){
# request
$ranking_type = $req_data['ranking_type'];
$content_type = $req_data['content_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('ranking_type', $ranking_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$row = $this->db->update('ranking', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['ranking_date'] = $now_date;
$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('ranking', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 content_idx - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_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('ranking');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_update($req_data){
# request
$ranking_type = $req_data['ranking_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$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('ranking_type', $ranking_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$row = $this->db->update('ranking', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('ranking');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_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('ranking', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - select in idx
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_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('ranking');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - update
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function ranking_where_idx_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('ranking', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 log로 copy - 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_all_copy_ranking_log($content_type){
$sql ="insert into ranking_log";
if($content_type =='1'){
$sql.=" select '', a.ranking_date, b.category_code, '', a.ranking_type, a.content_type, a.rank, a.head_title, a.title, b.press_name, b.reporter_name, a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join news as b on (a.content_idx = b.idx)
where a.content_type = '".$content_type."'";
}else if($content_type =='3'){
$sql.=" select '', a.ranking_date, b.category_idx, b.channel_idx, a.ranking_type, a.content_type, a.rank, a.head_title, a.title, '', '', a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join life as b on (a.content_idx = b.idx)
where a.content_type = '".$content_type."'";
}
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 log로 copy - 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_copy_ranking_log($req_data){
# request
$rank_type = $req_data['rank_type'];
$content_type = $req_data['content_type'];
$sql ="insert into ranking_log";
if($content_type =='1'){
$sql.=" select '', a.ranking_date, b.category_code, '', a.ranking_type, a.content_type, a.rank, a.head_title, a.title, b.press_name, b.reporter_name, a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join news as b on (a.content_idx = b.idx)
where a.ranking_type='".$rank_type."' and a.content_type = '".$content_type."'";
}else if($content_type =='3'){
$sql.=" select '', a.ranking_date, b.category_idx, b.channel_idx, a.ranking_type, a.content_type, a.rank, a.head_title, a.title, '', '', a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join life as b on (a.content_idx = b.idx)
where a.ranking_type='".$rank_type."' and a.content_type = '".$content_type."'";
}
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - is_del update - 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_is_del_where_content_type_update($req_data){
# request
$rank_type = $req_data['rank_type'];
$content_type = $req_data['content_type'];
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$update_data = array();
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('is_del', 'N');
$this->db->where('rank_type', $rank_type);
$this->db->where('content_type', $content_type);
$row = $this->db->update('ranking', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 현재랭킹 지우기
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_where_ranking_date_delete($reg_date){
$this->db->where('ranking_date = ', $reg_date);
$row = $this->db->delete('ranking');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오래된 랭킹 지우기
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_where_org_ranking_date_delete($reg_date){
$this->db->where('ranking_date <= ', $reg_date);
$row = $this->db->delete('ranking');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_all_insert($req_data){
$row = $this->db->insert('ranking', $req_data);
return $row;
}
}
?>

View File

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

View File

@@ -0,0 +1,105 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_relation_article extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 관련기사 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function relation_article_insert($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$relation_idxs = $req_data['relation_idxs'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$i = 0;
$arr_word = array();
foreach($relation_idxs as $val) {
$arr_word[$i]['content_idx'] = $content_idx;
$arr_word[$i]['content_type'] = $content_type;
$arr_word[$i]['relation_article_idx'] = $val;
$arr_word[$i]['reg_id'] = $user_id;
$arr_word[$i]['reg_date'] = $now_date;
$i++;
}
$row = $this->db->insert_batch('relation_article', $arr_word);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : delete
# CREATE : 2018-03-11
#---------------------------------------------------------------------------
function relation_article_delete($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$delete_data = array('content_idx' => $content_idx,
'content_type' => $content_type
);
$row = $this->db->delete('relation_article', $delete_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : arr delete
# CREATE : 2018-03-11
#---------------------------------------------------------------------------
function relation_article_arr_delete($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$delete_data = array();
foreach ($content_idx as $val) {
$delete_data = array('content_idx' => $val, 'content_type' => $content_type);
$this->db->delete('relation_article', $delete_data);
}
}
#---------------------------------------------------------------------------
# PURPOSE : count
# CREATE : 2018-03-11
#---------------------------------------------------------------------------
function relation_article_count($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$this->db->where('content_idx', $content_idx);
$this->db->where('content_type', $content_type);
$this->db->from('relation_article');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,43 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_search extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 뉴스, 칼럼, 라이프 list - 예약제외
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function all_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_display', 'Y');
$this->db->from('vw_content');
$this->db->order_by($sort_column, $sort_type);
$this->db->limit(100, 0);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,44 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_search_keyword_log extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : search_keyword_log - group by keyword
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function search_keyword_log_group_by_keyword($req_data){
# request
$start_date = $req_data['start_date'];
$end_date = $req_data['end_date'];
$this->db->select('keyword, count(*) as cnt');
$this->db->where('reg_date >=', $start_date);
$this->db->where('reg_date <=', $end_date);
$this->db->from('search_keyword_log');
$this->db->group_by('keyword');
$this->db->order_by('count(*)', 'desc');
$this->db->limit(20, 0);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,107 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_spam extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : where comment_idx list
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function spam_where_comment_idx_list($req_data){
# request
$comment_idx = $req_data['comment_idx'];
$reason_type = $req_data['reason_type'];
if($reason_type!='') $this->db->where('reason_type', $reason_type);
$this->db->where('comment_idx', $comment_idx);
$this->db->from('spam');
$this->db->order_by('idx', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : reason_type group by count
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function spam_where_comment_idx_reason_type_group_by_count($req_data){
# request
$comment_idx = $req_data['comment_idx'];
$reason_type = $req_data['reason_type'];
$this->db->select('reason_type, count(reason_type) as cnt');
if($reason_type!='') $this->db->where('reason_type', $reason_type);
$this->db->where('comment_idx', $comment_idx);
$this->db->group_by("reason_type");
$this->db->from('spam');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function spam_where_block_list($req_data){
# request
$content_type = $req_data['content_type'];
$block_call_count = $req_data['block_call_count'];
$sql = "select comment_idx, count(*) as cnt
from spam
where content_type = '".$content_type."' and is_blind = 'N'
group by comment_idx having count(*) >= ".$block_call_count;
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_blind update
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function spam_is_blind_where_comment_idx_update($comment_idx){
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$update_data = array('is_blind' => 'Y');
$this->db->where('is_blind', 'N');
$this->db->where('comment_idx', $comment_idx);
$row = $this->db->update('spam', $update_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,49 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_t_weather extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : truncate
# CREATE : 2018-05-28
#---------------------------------------------------------------------------
function t_weather_tuncate(){
$row = $this->db->truncate('t_weather');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-05-28
#---------------------------------------------------------------------------
function t_weather_insert($req_data){
$row = $this->db->insert('t_weather', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,167 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_tag extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : tag count
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function tag_select_where_tag_count($req_data){
# request
$tag = $req_data['tag'];
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$this->db->where('tag', $tag);
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->from('tag');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : tag insert
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function tag_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;
$row = $this->db->insert('tag', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : delete
# CREATE : 2018-03-12
#---------------------------------------------------------------------------
function tag_delete($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$delete_data = array('content_idx' => $content_idx,
'content_type' => $content_type
);
$row = $this->db->delete('tag', $delete_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : tag - list
# CREATE : 2018-03-12
#---------------------------------------------------------------------------
function tag_list($req_data){
# request
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$content_type = $req_data['content_type'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$sort_column = $req_data['sort_column'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($sort_column == 'hit_count') {
$sort_column = 'count(*)';
} else {
$sort_column = 'max('.$sort_column.')';
}
$this->db->select('tag, count(*) as cnt, max(reg_date) as reg_date');
$this->db->where('content_type', $content_type);
$this->db->from('tag');
$this->db->group_by('tag');
$this->db->limit($limit, $offset);
$this->db->order_by($sort_column, 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : tag - total count
# CREATE : 2018-03-12
#---------------------------------------------------------------------------
function tag_list_total_count($req_data){
# request
$content_type = $req_data['content_type'];
$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->select('tag');
$this->db->where('content_type', $content_type);
$this->db->from('tag');
$this->db->group_by('tag');
$row = $this->db->count_all_results();
$this->db->last_query();
return $row;
}
}
?>

View File

@@ -0,0 +1,355 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_theme extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - rank count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_rank_count($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$this->db->where('theme_type', $theme_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$this->db->from('theme');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_rank_is_del_update($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
if($user_id=='') $user_id = 'system';
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('theme_type', $theme_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$row = $this->db->update('theme', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_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('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 content_idx - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_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('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 content_idx - list
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_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('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 type list - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_type_list($req_data){
# request
$content_type = $req_data['content_type'];
$theme_type = $req_data['theme_type'];
$this->db->where('content_type', $content_type);
$this->db->where('theme_type', $theme_type);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_where_idx_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('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_update($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$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('theme_type', $theme_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$row = $this->db->update('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_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('theme', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - select in idx
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_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('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update where content_idx
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function theme_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('theme', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 content_idx
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function theme_rank_content_idx_select($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$rank = $req_data['rank'];
$this->db->select('idx');
$this->db->where('theme_type', $theme_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('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - update
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function theme_item_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('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update batch - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function theme_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('theme', $arr_update_data, 'idx');
return $row;
}
}
?>

View File

@@ -0,0 +1,359 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_bbs_faq extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : faq - list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_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_category1 = $req_data['search_category1'];
$search_category2 = $req_data['search_category2'];
if($search_category1!='') {
$this->db->where('a.faq_category_code1', $search_category1);
}
if($search_category2!='') {
$this->db->where('a.faq_category_code2', $search_category2);
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->select('a.*, b.category_name as category_name1, c.category_name as category_name2');
$this->db->where('b.is_del', 'N');
$this->db->where('c.is_del', 'N');
$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 = a.faq_category_code1');
$this->db->from('bbs_faq as a');
$this->db->join('bbs_faq_category as b', 'a.faq_category_code1 = b.category_code');
$this->db->join('bbs_faq_category as c', 'a.faq_category_code2 = c.category_code');
$this->db->order_by('a.idx desc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq - list - total count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_category1 = $req_data['search_category1'];
$search_category2 = $req_data['search_category2'];
if($search_category1!='') {
$this->db->where('faq_category_code1', $search_category1);
}
if($search_category2!='') {
$this->db->where('faq_category_code2', $search_category2);
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('bbs_faq');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 공지 - select
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_faq_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('bbs_faq');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq - insert
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$user_name = $this->session->userdata('Adm_Name');
$now_date = date("Y-m-d H:i:s");
$req_data['write_id'] = $user_id;
$req_data['write_name'] = $user_name;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date']= $now_date;
$row = $this->db->insert('bbs_faq', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq - category_code count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_category_code_count($req_data){
# request
$depth = $req_data['depth'];
$category_code = $req_data['category_code'];
if($depth == '1') {
$this->db->where('faq_category_code1', $category_code);
} else {
$this->db->where('faq_category_code2', $category_code);
}
$this->db->where('is_del', 'N');
$this->db->from('bbs_faq');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq is_del update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_faq_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('bbs_faq', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : faq 카테고리 - list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function faq_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'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('bbs_faq_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 : faq 카테고리 list용 - total count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function faq_category_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('bbs_faq_category');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq 카테고리 - all list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function faq_category_all_list(){
$this->db->where('is_del', 'N');
$this->db->from('bbs_faq_category');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq 카테고리 - insert
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_category_insert($req_data){
# request
$category_name = $req_data['category_name'];
$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('bbs_faq_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['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('bbs_faq_category', $insert_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq 카테고리 - update
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_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('bbs_faq_category', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : faq 카테고리 is_del update
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function bbs_faq_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('bbs_faq_category', $update_data);
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_faq_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('bbs_faq', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,300 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_bbs_notice extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 공지 - list
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_notice_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(isset($req_data['search_click'])==true) $search_click = $req_data['search_click'];
if($search_click=='1') {
$today_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $today_date);
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('bbs_notice');
$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-02-27
#---------------------------------------------------------------------------
function bbs_notice_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
if(isset($req_data['search_click'])==true) $search_click = $req_data['search_click'];
if($search_click=='1') {
$today_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $today_date);
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('bbs_notice');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - select
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('bbs_question');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 reply - insert
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_reply_insert($req_data){
# request
$idx = $req_data['p_idx'];
$user_id = $this->session->userdata('Adm_Id');
$user_name = $this->session->userdata('Adm_Name');
$now_date = date("Y-m-d H:i:s");
$this->db->select('max(s_idx) + 1 as s_idx');
$this->db->where('p_idx', $idx);
$this->db->from('bbs_question');
$res1 = $this->db->get();
$row1 = $res1->result_array();
$s_idx = $row1[0]['s_idx'];
$req_data['write_id'] = $user_id;
$req_data['write_name'] = $user_name;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date']= $now_date;
$req_data['s_idx'] = $s_idx;
$req_data['is_reply'] = 'Y';
$row = $this->db->insert('bbs_question', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 is_reply - update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_is_reply_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_reply' => 'Y',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('bbs_question', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 is_del update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_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('bbs_question', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 신규 count
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_new_count(){
$now_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $now_date);
$this->db->where('is_del', 'N');
$this->db->where('s_idx', '1');
$this->db->from('bbs_question');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 처리상태 count
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_group_by_is_reply(){
$this->db->select('is_reply, count(is_reply) as cnt');
$this->db->where('is_del', 'N');
$this->db->where('s_idx', '1');
$this->db->group_by("is_reply");
$this->db->from('bbs_question');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 공지 - insert
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_notice_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$user_name = $this->session->userdata('Adm_Name');
$now_date = date("Y-m-d H:i:s");
$req_data['write_id'] = $user_id;
$req_data['write_name'] = $user_name;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date']= $now_date;
$row = $this->db->insert('bbs_notice', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 공지 - select
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_notice_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('bbs_notice');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 공지 - update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_notice_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('bbs_notice', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 공지 is_del update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_notice_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('bbs_notice', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 신규 count
# CREATE : 2018-06-11
#---------------------------------------------------------------------------
function bbs_notice_new_count(){
$now_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $now_date);
$this->db->where('is_del', 'N');
$this->db->from('bbs_notice');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,239 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_bbs_question extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - list
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_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_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('reg_date >=', $today_date);
}
if($search_click2=='1') {
$this->db->like('is_reply', 'Y');
} else if($search_click2=='2') {
$this->db->like('is_reply', 'N');
}
if($search_type!='' && $search_keyword!='') $this->db->like($search_type, $search_keyword);
$this->db->where('is_del', 'N');
$this->db->from('bbs_question');
$this->db->order_by('p_idx desc, s_idx asc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - list - total count
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$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('reg_date >=', $today_date);
}
if($search_click2=='1') {
$this->db->like('is_reply', 'Y');
} else if($search_click2=='2') {
$this->db->like('is_reply', 'N');
}
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
$this->db->where('is_del', 'N');
$this->db->from('bbs_question');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 - select
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('bbs_question');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 reply - insert
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_reply_insert($req_data){
# request
$idx = $req_data['p_idx'];
$user_id = $this->session->userdata('Adm_Id');
$user_name = $this->session->userdata('Adm_Name');
$now_date = date("Y-m-d H:i:s");
$this->db->select('max(s_idx) + 1 as s_idx');
$this->db->where('p_idx', $idx);
$this->db->from('bbs_question');
$res1 = $this->db->get();
$row1 = $res1->result_array();
$s_idx = $row1[0]['s_idx'];
$req_data['write_id'] = $user_id;
$req_data['write_name'] = $user_name;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date']= $now_date;
$req_data['s_idx'] = $s_idx;
$req_data['p_idx'] = $idx;
$req_data['is_reply'] = 'Y';
$row = $this->db->insert('bbs_question', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 is_reply - update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_is_reply_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_reply' => 'Y',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('bbs_question', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 is_del update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_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('bbs_question', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 신규 count
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_new_count($req_data){
$search_click2 = '';
if(isset($req_data['search_click2'])==true) $search_click2 = $req_data['search_click2'];
if($search_click2=='1') {
$this->db->like('is_reply', 'Y');
} else if($search_click2=='2') {
$this->db->like('is_reply', 'N');
}
$now_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $now_date);
$this->db->where('is_del', 'N');
$this->db->where('s_idx', '1');
$this->db->from('bbs_question');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 1:1문의 처리상태 count
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function bbs_question_group_by_is_reply($req_data){
$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('reg_date >=', $today_date);
}
$this->db->select('is_reply, count(is_reply) as cnt');
$this->db->where('is_del', 'N');
$this->db->where('s_idx', '1');
$this->db->group_by("is_reply");
$this->db->from('bbs_question');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,273 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class m_maptoon extends CI_Model{
var $tb_name_category = 'mt_categories';
var $tb_name_episode = 'mt_episodes';
var $tb_name_maptoon_list = 'mt_list';
var $tb_name_notice = 'mt_notices';
var $tb_name_cartoonist = 'mt_cartoonists';
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
/*
return maptoon category list
@param (numeric) primary key of category table
@return array or FALSE
*/
public function get_category($idx='') {
$idx = trim($idx);
if(is_numeric($idx)==TRUE && $idx>0) {
$query = $this->db->get_where($this->tb_name_category,['idx' => $idx]);
return $query->row_array();
} else {
return FALSE;
}
}
/*
return episodes data by category id
@param (numeric|string with comma separated) primary key of category table
@return array or FALSE
*/
public function get_episodes_by_category($cid) {
if(is_numeric($cid)==TRUE && $cid>0) {
$query = $this->db->get_where(
$this->tb_name_episode,
['mt_categories_idx' => $cid]);
return $query->result_array();
} else if(is_string($cid)==TRUE && strpos($cid,',')>0) {
$arr = explode(',',$cid);
$this->db->where_in('idx', $arr);
$this->db->order_by('Field(idx, '.$cid.')');
$query = $this->db->get($this->tb_name_episode);
$ret = $query->result_array();
// echo $this->db->last_query();
return $ret;
} else {
return FALSE;
}
}
/*
update episodes' idx in category
@param (numeric) idx of category table
@param (string) idx of episodes separated with comma
@return (boolean)
*/
public function update_episodes_by_category($cid, $str) {
if(is_numeric($cid)==TRUE && $str!='') {
//1.find all episodes in the category
$ret1 = $this->get_episodes_by_category($cid);
$len_ret1 = count($ret1);
$prev_idxs = [];
if($len_ret1>0) {
foreach($ret1 as $v) {
$prev_idxs[] = $v['idx'];
}
}
//2.remove some episode in case those are not in the updated idx from db table mt_episodes
$new_idxs = explode(',',$str);
$idxs_deleted = array_diff($prev_idxs,$new_idxs);
$len_idxs_deleted = count($idxs_deleted);
if($len_idxs_deleted>0) {
// echo '-----<br>'.$idxs_deleted.'<br>-----'; exit;
$this->db->where_in('idx',$idxs_deleted);
$this->db->update($this->tb_name_episode, ['mt_categories_idx' => 0]);// echo $this->db->last_query();
}
//3.update
$this->db->where('idx',$cid);
$ret = $this->db->update($this->tb_name_category, ['mt_episodes_idx' => $str]);
// echo $this->db->last_query();
return $ret;
} else {
return FALSE;
}
}
/*
get episode thumbnail, title, idx
@param (string) search keyword
@return (array) or NULL
*/
public function get_episodes_by_search_keyword($str) {
$str = trim($str);
if($str!='') {
$this->db->select(['idx','title','main_img']);
$this->db->like('title',$str);
$query = $this->db->get($this->tb_name_episode);
$row = $query->result_array();
// echo $this->db->last_query();
return $row;
} else {
return NULL;
}
}
/*
return list of maptoon
@param (array) search keywords keys & values
@return array or FALSE
*/
public function get_maptoon_list($arr='') {
if(is_array($arr)==TRUE && count($arr)>0) {
$query = $this->db->get_where($this->tb_name_maptoon_list, $arr);
} else {
$query = $this->db->get($this->tb_name_maptoon_list);
}
$row = $query->result_array();
//echo $this->db->last_query();
return $row;
}
/*
insert maptoon data
@return (boolean)
*/
public function insert_maptoon($arr) {
if(is_array($arr)==TRUE) {
return $this->db->insert($this->tb_name_maptoon_list,$arr);
} else {
return FALSE;
}
}
/*
update maptoon data
@param (numeric) idx of mt_list table
@param (array) maptoon data
@return (boolean)
*/
public function update_maptoon($idx, $arr) {
if(is_numeric($idx)==TRUE && is_array($arr)==TRUE) {
$this->db->where('idx',$idx);
return $this->db->update($this->tb_name_maptoon_list, $arr);
} else {
return FALSE;
}
}
public function get_cartoonist_list() {
$this->db->order_by('name','ASC');
$query = $this->db->get($this->tb_name_cartoonist);
return $query->result_array();
}
/*
return num of episodes by maptoon idx
@param (numeric) idx of mt_list table
@return (numeric)
*/
public function get_num_of_episodes($mt_idx) {
if(is_numeric($mt_idx)==TRUE && $mt_idx>0) {
$query = $this->db->get_where($this->tb_name_episode,['mt_list_idx' => $mt_idx]);
return $query->num_rows();
} else {
return 0;
}
}
/*
get announcement list
@return array or FALSE
*/
public function get_announcement_list($mt_idx){
$this->db->order_by($this->tb_name_notice.'.reg_date','DESC');
$this->db->select($this->tb_name_notice.'.*');
$this->db->select($this->tb_name_maptoon_list.'.name');
$this->db->from($this->tb_name_notice);
$this->db->join($this->tb_name_maptoon_list, $this->tb_name_maptoon_list.'.idx = '.$this->tb_name_notice.'.mt_list_idx');
if($mt_idx!=0)$this->db->where($this->tb_name_notice.'.mt_list_idx',$mt_idx);
$query = $this->db->get();
return $query->result_array();
}
/*
get name of mt_list
@return array or FALSE
*/
public function get_mt_title(){
$this->db->order_by("name","ASC");
$this->db->select("idx");
$this->db->select("name");
$query = $this->db->get($this->tb_name_maptoon_list);
return $query->result_array();
}
/*
get_episode_list
@return array or FALSE
*/
public function get_episode_list($req_data){
$sort_list = $req_data['sort_list']; // 최신 조회
$date_reg = $req_data['date_reg']; // 등록 날짜별
$mt_categories_idx = $req_data['category']; // 카테고리
$mt_list_idx = $req_data['mt_name']; // 맵툰 이름
$title = $req_data['ep_title']; // 맵툰 제목
$sdate = $req_data['sdate']; // 시작일
$edate = $req_data['edate']; // 종료일
$author = $req_data['author']; // 작가
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$this->db->select('a.*');
$this->db->select('b.mt_cartoonists_idx');
$this->db->select('b.name');
$this->db->from($this->tb_name_episode.' AS a');
$this->db->join($this->tb_name_maptoon_list.' AS b', 'b.idx = a.mt_list_idx');
if($mt_categories_idx!='') $this->db->where('mt_categories_idx',$mt_categories_idx);
if($mt_list_idx!='') $this->db->where('mt_list_idx',$mt_list_idx);
if($title!='')$this->db->where('title',$title);
//작가 번호로 조회
if(is_array($author)){
if(count($author)>0){
for($i=0;$i<count($author);$i++){
if($i==0){ $this->db->where('b.mt_cartoonists_idx',$author[$i]['idx']);
}else{
$this->db->or_where('b.mt_cartoonists_idx',$author[$i]['idx']);
}
}}}
//등록날짜별 조회
if(isset($date_reg)){
switch ($date_reg) {
case 'td' : $this->db->where('DATE(a.reg_date) =',date("Y-m-d")); break;
case 'yd' : $this->db->where('DATE(a.reg_date) =',date("Y-m-d", strtotime("-1 days"))); break;
case 'w' : $this->db->where('DATE(a.reg_date) >=',date("Y-m-d", strtotime("-7 days"))); break;
case '30d' : $this->db->where('DATE(a.reg_date) >=',date("Y-m-d", strtotime("-30 days"))); break;
case 'lm' : $this->db->where('DATE(a.reg_date) >=',date("Y-m-d", strtotime("-1 months"))); break;
case 'sel' : $this->db->where('DATE(a.reg_date) <=',$sdate); $this->db->where('DATE(a.reg_date) >=',$edate); break;
}}
$this->db->limit($limit, $offset);
if($sort_list=="up") $this->db->order_by("reg_date","DESC");
if($sort_list=="vi") $this->db->order_by("view_count","DESC");
$res = $this->db->get();
return $res->result_array();
}
/*
get cartoonist idx by_name
@return array or FALSE
*/
public function get_cartoonist_idx_by_name($name) { //test
$this->db->select("idx");
$this->db->where('name',$name);
$query = $this->db->get($this->tb_name_cartoonist);
return $query->result_array();
}
}

View File

@@ -0,0 +1,159 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class m_maptoon_test extends CI_Model{
var $tb_name_category = 'mt_categories';
var $tb_name_episode = 'mt_episodes';
var $tb_name_maptoon_list = 'mt_list';
var $tb_name_notice = 'mt_notices';
var $tb_name_cartoonist = 'mt_cartoonists';
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
/*
return maptoon category list
@param (numeric) primary key of category table
@return array or FALSE
*/
public function get_category($idx='') {
$idx = trim($idx);
if(is_numeric($idx)==TRUE && $idx>0) {
$query = $this->db->get_where($this->tb_name_category,['idx' => $idx]);
return $query->row_array();
} else {
return FALSE;
}
}
/*
return episodes data by category id
@param (numeric) primary key of category table
@return array or FALSE
*/
public function get_episodes_by_category($cid) {
if(is_numeric($cid)==TRUE && $cid>0) {
$query = $this->db->get_where(
$this->tb_name_episode,
['mt_categories_idx' => $cid]);
return $query->result_array();
} else {
return FALSE;
}
}
/*
return list of maptoon
@param (array) search keywords keys & values
@return array or FALSE
*/
public function get_maptoon_list($arr='') {
if(is_array($arr)==TRUE) {
$query = $this->db->get_where($this->tb_name_maptoon_list, $arr);
$row = $query->result_array();
return $row;
} else {
return FALSE;
}
}
/*
insert maptoon data
@return (boolean)
*/
public function insert_maptoon($arr) {
if(is_array($arr)==TRUE) {
return $this->db->insert($this->tb_name_maptoon_list,$arr);
} else {
return FALSE;
}
}
public function get_cartoonist_list() {
$this->db->order_by('name','ASC');
$query = $this->db->get($this->tb_name_cartoonist);
return $query->result_array();
}
public function get_cartoonist_idx_by_name($name) { //test
$this->db->select("idx");
$this->db->where('name',$name);
$query = $this->db->get($this->tb_name_cartoonist);
return $query->result_array();
}
/*
get announcement list
*/
public function get_announcement_list(){
$this->db->order_by($this->tb_name_notice.'.reg_date','DESC');
$this->db->select($this->tb_name_notice.'.*');
$this->db->select($this->tb_name_maptoon_list.'.name');
$this->db->from($this->tb_name_notice);
$this->db->join($this->tb_name_maptoon_list, $this->tb_name_maptoon_list.'.idx = '.$this->tb_name_notice.'.mt_list_idx');
$query = $this->db->get();
return $query->result_array();
}
public function get_mt_title(){
$this->db->order_by("name","ASC");
$this->db->select("idx");
$this->db->select("name");
$query = $this->db->get($this->tb_name_maptoon_list);
return $query->result_array();
}
public function get_episode_list($req_data){
$sort_list = $req_data['sort_list']; // 최신 조회
$date_reg = $req_data['date_reg']; // 등록 날짜별
$mt_categories_idx = $req_data['category']; // 카테고리
$mt_list_idx = $req_data['mt_name']; // 맵툰 이름
$title = $req_data['ep_title']; // 맵툰 제목
$sdate = $req_data['sdate']; // 시작일
$edate = $req_data['edate']; // 종료일
$author = $req_data['author']; // 작가
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$this->db->select('a.*');
$this->db->select('b.mt_cartoonists_idx');
$this->db->from($this->tb_name_episode.' AS a');
$this->db->join($this->tb_name_maptoon_list.' AS b', 'b.idx = a.mt_list_idx');
if($mt_categories_idx!='') $this->db->where('mt_categories_idx',$mt_categories_idx);
if($mt_list_idx!='') $this->db->where('mt_list_idx',$mt_list_idx);
if($title!='')$this->db->where('title',$title);
//작가 번호로 조회
if($author!=''){
for($i=0;$i<=count($author);$i++){
$i==0? $this->db->where('reg_date',$author[$i]['idx']) : $this->db->or_where('reg_date',$author[$i]['idx']);
}}
//등록날짜별 조회
if(isset($date_reg)){
switch ($date_reg) {
case 'td' : $this->db->where('DATE(reg_date) =',date("Y-m-d")); break;
case 'yd' : $this->db->where('DATE(reg_date) >=',date("Y-m-d", strtotime("-1 days"))); break;
case 'w' : $this->db->where('DATE(reg_date) >=',date("Y-m-d", strtotime("-7 days"))); break;
case '30d' : $this->db->where('DATE(reg_date) >=',date("Y-m-d", strtotime("-30 days"))); break;
case 'lm' : $this->db->where('DATE(reg_date) >=',date("Y-m-d", strtotime("-1 months"))); break;
case 'sel' : $this->db->where('DATE(reg_date) <=',$sdate); $this->db->where('DATE(reg_date) >=',$edate); break;
}}
$this->db->limit($limit, $offset);
if($sort_list=="up") $this->db->order_by("reg_date","DESC");
if($sort_list=="vi") $this->db->order_by("view_count","DESC");
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}

View File

@@ -0,0 +1,142 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_design extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : popup - list
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function popup_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_menu_code = $req_data['search_menu_code'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_menu_code!='') $this->db->where('menu_code', $search_menu_code);
$this->db->where('is_del', 'N');
$this->db->from('popup');
$this->db->limit($limit, $offset);
$this->db->order_by('reg_date', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : popup - list용 - total count
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function popup_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_menu_code = $req_data['search_menu_code'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_menu_code!='') $this->db->where('menu_code', $search_menu_code);
$this->db->where('is_del', 'N');
$this->db->from('popup');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : popup - select
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function popup_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('popup');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : popup - insert
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function popup_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('popup', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : popup - update
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function popup_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('popup', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : popup.is_del update
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function popup_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('popup', $arr_update_data, 'idx');
}
}
?>

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_life_category extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 카테고리 - list
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function category_all_list(){
# request
$this->db->where('is_del', 'N');
$this->db->from('category');
$this->db->order_by('idx', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 카테고리 - select
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function category_select($idx){
# request
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('category');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,303 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_life_channel extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 채널에디터 - list
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_editor_list($req_data){
# request
$idx = $req_data;
$this->db->where('channel_idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 select
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_select($req_data){
# request
$idx = $req_data;
$this->db->where('is_del', 'N');
$this->db->where('idx', $idx);
$this->db->from('channel');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - list
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function channel_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 = $req_data['search_category'];
$sort_column = 'reg_date';
if(isset($req_data['sort_column'])==true) $sort_column = $req_data['sort_column'];
if($search_type!='' && $search_keyword!=''){
$this->db->like('channel.'.$search_type, $search_keyword);
}
if($search_category!='') $this->db->where('channel.category_idx', $search_category);
$this->db->select('channel.*, category.category_name, (select count(*) from partner where channel_idx=channel.idx and is_del="N") as editor_count, (select count(*) from life where channel_idx=channel.idx and is_del="N") as article_count, (select sum(hit_count) from life where channel_idx=channel.idx and is_del="N") as hit_count');
$this->db->where('channel.is_del', 'N');
$this->db->from('channel');
$this->db->join('category', 'category.idx = channel.category_idx');
$query = $this->db->get_compiled_select();
$this->db->from('('.$query.') as b');
$this->db->order_by('b.'.$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-21
#---------------------------------------------------------------------------
function channel_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('channel');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널아이콘 - list
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_icon_list(){
$this->db->from('channel_icon');
$this->db->order_by('idx', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널아이콘 - insert
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_icon_insert($req_data){
# request
$channel_icon = $req_data;
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$insert_data = array('channel_icon' => $channel_icon,
'reg_id' => $user_id,
'reg_date' => $now_date,
);
$row = $this->db->insert('channel_icon', $insert_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - insert
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_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('channel', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : channel is_del update
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_is_del_update($req_data){
# request
$channel_idx = $req_data;
$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['is_del'] = 'Y';
$this->db->where('idx', $channel_idx);
$row = $this->db->update('channel', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - update
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_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('channel', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - update
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function channel_partner_update($req_data, $req_data2){
# request
if($req_data2['partner_idx'])
$idxArr = explode(",", $req_data2['partner_idx']);
else
$idxArr = array();
$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['member_group_idx'] = 6;
$update_data['category_idx'] = $req_data['category_idx'];
$update_data['channel_idx'] = $req_data['idx'];
$this->db->select('idx');
$this->db->where('channel_idx', $req_data['idx']);
$this->db->where('is_del', 'N');
if(sizeof($idxArr) > 0) {
$this->db->where_not_in('idx', $idxArr);
}
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
$idxExceptArr = array();
for($i = 0; $i < sizeof($row); $i++) {
$idxExceptArr[$i] = $row[$i]['idx'];
}
$except_data['channel_idx'] = 0;
$except_data['category_idx'] = 0;
$except_data['member_group_idx'] = 7;
if(sizeof($idxExceptArr) > 0) {
$this->db->where_in('idx', $idxExceptArr);
$row = $this->db->update('partner', $except_data);
}
unset($this->db);
if(sizeof($idxArr) > 0) {
$this->db->where_in('idx', $idxArr);
$row = $this->db->update('partner', $update_data);
}
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - all list
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function channel_all_list(){
$this->db->where('is_del', 'N');
$this->db->from('channel');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,286 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_life_comment extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list - total count
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function life_comment_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_life_type = $req_data['search_life_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_life_type!='') $where_query.=" and c.life_type = '".$search_life_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 life 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 life 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-21
#---------------------------------------------------------------------------
function life_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_life_type = $req_data['search_life_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_life_type!='') $where_query.=" and c.life_type = '".$search_life_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.life_type, a.theme_types, d.category_name as category_name1, e.channel_name as category_name2, (select comment from comment where is_del='N' and idx=a.p_idx and s_idx > 1) as p_comment, f.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 life as c on (a.content_idx = c.idx)
join category as d on (c.category_idx = d.idx)
join channel as e on (c.channel_idx = e.idx)
join member as f on (f.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.life_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, d.category_name as category_name1, e.channel_name as category_name2, (select comment from comment where is_del='N' and idx=a.p_idx and s_idx > 1) as p_comment, f.member_img
from comment as a
join life as c on (a.content_idx = c.idx)
join category as d on (c.category_idx = d.idx)
join channel as e on (c.channel_idx = e.idx)
join member as f on (f.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 life_comment_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_life_type = $req_data['search_life_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_life_type!='') $where_query.=" and c.life_type = '".$search_life_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 `life` 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 `life` 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 life_comment_is_best_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_life_type = $req_data['search_life_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_life_type!='') $where_query.=" and c.life_type = '".$search_life_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 `life` 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 `life` 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 life_comment_is_best_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_life_type = $req_data['search_life_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_life_type!='') $where_query.=" and c.life_type = '".$search_life_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 `life` 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 `life` 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 life_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,147 @@
<?
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 life - list
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function ranking_join_life_list($req_data){
# request
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_ranking_type = $req_data['search_ranking_type'];
$search_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
$search_life_type = $req_data['search_life_type'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
if($search_type!='' && $search_keyword!=''){
$this->db->like('b.'.$search_type, $search_keyword);
}
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1);
if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2);
if($search_life_type!='') $this->db->where('b.life_type', $search_life_type);
if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type);
$this->db->select('a.idx, a.rank, a.title, a.main_img, a.ranking_type, a.reg_date, a.content_idx, b.life_type, b.editor_name, b.hit_count, b.like_count, b.comment_count, b.share_count, c.category_name as category_name1, d.channel_name as category_name2');
$this->db->where('a.content_type', $content_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('c.is_del', 'N');
$this->db->where('d.is_del', 'N');
$this->db->from('ranking as a');
$this->db->join('life as b', 'a.content_idx = b.idx');
$this->db->join('category as c', 'c.idx = b.category_idx');
$this->db->join('channel as d', 'd.idx = b.channel_idx');
$this->db->order_by('a.reg_date desc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : ranking life - list - total count
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function ranking_join_life_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_ranking_type = $req_data['search_ranking_type'];
$search_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
$search_life_type = $req_data['search_life_type'];
$search_theme_type = $req_data['search_theme_type'];
$content_type = $req_data['content_type'];
if($search_type!='' && $search_keyword!=''){
$this->db->like('b.'.$search_type, $search_keyword);
}
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1);
if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2);
if($search_life_type!='') $this->db->where('b.life_type', $search_life_type);
if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type);
$this->db->where('a.content_type', $content_type);
$this->db->where('a.is_del', 'N');
$this->db->where('b.is_del', 'N');
$this->db->where('c.is_del', 'N');
$this->db->where('d.is_del', 'N');
$this->db->from('ranking as a');
$this->db->join('life as b', 'a.content_idx = b.idx');
$this->db->join('category as c', 'c.idx = b.category_idx');
$this->db->join('channel as d', 'd.idx = b.channel_idx');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 type list - select
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function ranking_join_life_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.share_count, b.comment_count, b.editor_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->from('ranking as a');
$this->db->join('life as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - select
# CREATE : 2018-03-21
#---------------------------------------------------------------------------
function ranking_join_life_select($req_data){
# request
$idx = $req_data;
$this->db->select('a.*, b.hit_count, b.share_count, b.comment_count, b.editor_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('life as b', 'a.content_idx = b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,307 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_member extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 - list
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_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_member_group = $req_data['search_member_group'];
$search_member_gender = $req_data['search_member_gender'];
$search_member_age = $req_data['search_member_age'];
$search_member_new = $req_data['search_member_new'];
$where_query = '';
if($search_type!='' && $search_keyword!=''){
$where_query.= 'and a.'.$search_type.' like "%'.$search_keyword.'%"';
}
if($search_member_group!=''){
$where_query.= 'and a.member_group_idx="'.$search_member_group.'"';
}
if($search_member_gender!=''){
$where_query.= 'and a.member_gender="'.$search_member_gender.'"';
}
if($search_member_age!=''){
$where_query.= 'and a.member_age="'.$search_member_age.'"';
}
if($search_member_new!=''){
$now_date = date("Y-m-d").' 00:00:00';
$where_query.= 'and a.reg_Date >= "'.$now_date.'"';
}
$sql = "select a.*, b.member_group_name
from member as a
join member_group as b on (a.member_group_idx = b.idx)
where a.member_status = '1' ".$where_query." order by a.idx desc limit ".$offset.", ". $limit;
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 - list용 - total count
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_list_total_count($req_data){
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_member_group = $req_data['search_member_group'];
$search_member_gender = $req_data['search_member_gender'];
$search_member_age = $req_data['search_member_age'];
$search_member_new = $req_data['search_member_new'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($search_member_group!='') {
$this->db->where('member_group_idx', $search_member_group);
}
if($search_member_gender!=''){
$this->db->where('member_gender', $search_member_gender);
}
if($search_member_age!=''){
$this->db->where('member_age', $search_member_age);
}
if($search_member_new!=''){
$now_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $now_date);
}
$this->db->where('member_status', '1');
$this->db->from('member');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 - total count
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_total_count(){
$this->db->where('member_status', '1');
$this->db->from('member');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 - 성별 count
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_group_by_member_gender(){
$this->db->select('member_gender, count(member_gender) as cnt');
$this->db->where('member_status', '1');
$this->db->group_by("member_gender");
$this->db->from('member');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 - 그룹 count
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_group_by_member_group(){
$this->db->select('member_group_idx, count(member_group_idx) as cnt');
$this->db->where('member_status', '1');
$this->db->group_by("member_group_idx");
$this->db->from('member');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 - 신규회원
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_count_member_new(){
$now_date = date("Y-m-d").' 00:00:00';
$this->db->where('reg_date >=', $now_date);
$this->db->where('member_status', '1');
$this->db->from('member');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원 - 회원 나이 대
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_group_by_member_age(){
$this->db->select('member_age, count(member_age) as cnt');
$this->db->where('member_status', '1');
$this->db->group_by("member_age");
$this->db->from('member');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 - select
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_select($req_data){
# request
$member_idx = $req_data;
$this->db->where('idx', $member_idx);
$this->db->from('member');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 - update
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_update($req_data){
# request
$idx = $req_data['idx'];
$member_email = $req_data['member_email'];
$member_birth = $req_data['member_birth'];
$member_age = $req_data['member_age'];
$member_calendar = $req_data['member_calendar'];
$member_gender = $req_data['member_gender'];
$member_group_idx = $req_data['member_group_idx'];
$member_church = $req_data['member_church'];
$member_dong = $req_data['member_dong'];
$member_pastor = $req_data['member_pastor'];
$is_agree_sms = $req_data['is_agree_sms'];
$is_agree_mail = $req_data['is_agree_mail'];
$is_agree_info_open = $req_data['is_agree_info_open'];
$member_img = $req_data['member_img'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['member_email'] = $member_email;
$update_data['member_birth'] = $member_birth;
$update_data['member_age'] = $member_age;
$update_data['member_calendar'] = $member_calendar;
$update_data['member_gender'] = $member_gender;
$update_data['member_group_idx'] = $member_group_idx;
$update_data['member_church'] = $member_church;
$update_data['member_dong'] = $member_dong;
$update_data['member_pastor'] = $member_pastor;
$update_data['is_agree_sms'] = $is_agree_sms;
$update_data['is_agree_mail'] = $is_agree_mail;
$update_data['is_agree_info_open']= $is_agree_info_open;
$update_data['member_img'] = $member_img;
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update('member', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 - member_status.update
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_member_status_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('member_status' => '2',
'member_group_idx'=>'5',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('member', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 - select
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_where_member_id_select($member_id){
$this->db->where('member_id', $member_id);
$this->db->from('member');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 일반회원 - where_member_id
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_where_member_id_update($req_data){
# request
$member_id = $req_data['member_id'];
unset($req_data['member_id']);
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('member_id', $member_id);
$row = $this->db->update('member', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,280 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_member_group extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - list
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_list($req_data){
# request
$member_type = $req_data['member_type'];
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$sql1 = "select * from member_group where is_del = 'N' and member_type = '".$member_type."' order by idx asc limit ".$offset.", ". $limit;
$res1 = $this->db->query($sql1);
$row1 = $res1->result_array();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - all list
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_group_all_list($req_data){
# request
$member_type = $req_data['member_type'];
$sql1 = "select * from member_group where is_del = 'N' and member_group_status = '1' and member_type = '".$member_type."' order by idx asc";
$res1 = $this->db->query($sql1);
$row1 = $res1->result_array();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - insert
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_insert($req_data){
# request
$member_type = $req_data['member_type'];
$member_group_name = $req_data['member_group_name'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$insert_data = array('member_type' => $member_type,
'member_group_name' => $member_group_name,
'reg_id' => $user_id,
'reg_date' => $now_date,
'update_id' => $user_id,
'update_date' => $now_date
);
$row = $this->db->insert('member_group', $insert_data);
$last_idx = $this->db->insert_id();
if(!$row) {
return 0;
} else {
return $last_idx;
}
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - update
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_update($req_data){
# request
$idx = $req_data['idx'];
$member_group_name = $req_data['member_group_name'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('member_group_name' => $member_group_name,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('member_group', $update_data);
if(!$row) {
return '9999';
} else {
return '0000';
}
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - member_group.member_group_status update
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_status_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]['member_group_status'] = '2';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$this->db->update_batch('member_group', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - member_group.is_del update
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_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('member_group', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - total count
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_total_count($req_data){
# request
$member_type = $req_data['member_type'];
$this->db->where('member_type', $member_type);
$this->db->where('is_del', 'N');
$this->db->from('member_group');
$row1 = $this->db->count_all_results();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : member_group join member_group_menu_auth select
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_join_member_group_menu_auth_select($member_group_idx){
$sql1 = "select a.*, b.member_group_name
from member_group_menu_auth as a
join member_group as b on (a.member_group_idx = b.idx)
where a.member_group_idx = '".$member_group_idx."' order by a.idx asc";
$res1 = $this->db->query($sql1);
$row1 = $res1->result_array();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : member_group join member_group_menu_auth select
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_join_member_group_menu_auth_guest_select($req_data){
# request
$member_type = $req_data['member_type'];
$sql1 = "select a.*, b.member_group_name
from member_group_menu_auth as a
join member_group as b on (a.member_group_idx = b.idx)
where b.member_type = ".$member_type." order by a.idx asc";
$res1 = $this->db->query($sql1);
$row1 = $res1->result_array();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : member_group_menu_auth insert
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function member_group_menu_auth_insert($req_data){
# request
$member_group_idx = $req_data['member_group_idx'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$insert_data = array();
foreach($req_data['menu_list'] as $key=>$val) {
$insert_data[$key]['member_group_idx'] = $member_group_idx;
$insert_data[$key]['menu_code'] = $val['menu_code'];
$insert_data[$key]['menu_name'] = $val['menu_name'];
$insert_data[$key]['menu_auth_status'] = $val['menu_auth_status'];
$insert_data[$key]['reg_id'] = $user_id;
$insert_data[$key]['reg_date'] = $now_date;
$insert_data[$key]['update_id'] = $user_id;
$insert_data[$key]['update_date'] = $now_date;
}
$this->db->insert_batch('member_group_menu_auth', $insert_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - 메뉴권한 - member_group_menu_auth.menu_auth_status update (member_group_idx)
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_group_menu_auth_menu_auth_status_reset($req_data){
# request
$member_group_idx = $req_data;
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('menu_auth_status' => '1',
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('member_group_idx', $member_group_idx);
$row = $this->db->update('member_group_menu_auth', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원그룹 - 메뉴권한 - member_group_menu_auth.menu_auth_status update
# CREATE : 2018-02-21
#---------------------------------------------------------------------------
function member_group_menu_auth_menu_auth_status_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]['menu_auth_status'] = '2';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$result = $this->db->update_batch('member_group_menu_auth', $arr_update_data, 'idx');
return $result;
}
}
?>

View File

@@ -0,0 +1,48 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_member_setting extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 회원가입설정 셋팅 - list
# CREATE : 2018-02-25
#---------------------------------------------------------------------------
function m_member_setting_list(){
$this->db->where('is_del', 'N');
$this->db->from('member_setting');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 회원가입설정 셋팅 - update
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function m_member_setting_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
foreach ($req_data as $key=>$val) {
$req_data[$key]['update_id'] = $user_id;
$req_data[$key]['update_date'] = $now_date;
}
$row = $this->db->update_batch('member_setting', $req_data, 'idx');
return $row;
}
}
?>

View File

@@ -0,0 +1,331 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_partner extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : partner where member_group_idx
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function partner_list_where_member_group_idx($req_data){
# request
$member_group_idx = $req_data['member_group_idx'];
$search_write_id = '';
if(isset($req_data['search_write_id']) == true) {
$search_write_id = $req_data['search_write_id'];
}
if($search_write_id!='') $this->db->where('partner_id', $search_write_id);
$this->db->where('member_group_idx', $member_group_idx);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner where member_group_idx -- life_channel_reg NEW
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function partner_list_no_channel_new(){
# request
$search_write_id = '';
if(isset($req_data['search_write_id']) == true) {
$search_write_id = $req_data['search_write_id'];
}
if($search_write_id!='') $this->db->where('partner_id', $search_write_id);
$this->db->where('category_idx', '0');
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner where member_group_idx
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function partner_where_channel_idx_list_new($req_data){
# request
$category_idx = $req_data;
$this->db->where('category_idx', $category_idx);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner where member_group_idx
# CREATE : 2018-03-08
#---------------------------------------------------------------------------
function partner_my_channel_idx_list($req_data){
# request
$channel_idx = $req_data;
$this->db->where('channel_idx', $channel_idx);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner - list
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_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 = '';
if(isset($req_data['sort_column'])==true) $sort_column = $req_data['sort_column'];
$member_group_idx = $req_data['member_group_idx'];
if($search_type!='' && $search_keyword!=''){
$this->db->like('a.'.$search_type, $search_keyword);
}
if($member_group_idx == '6') {
$search_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
if($search_category_code1!='') $this->db->where('a.category_idx', $search_category_code1);
if($search_category_code2!='') $this->db->where('a.channel_idx', $search_category_code2);
$this->db->select('a.*, b.member_group_name, c.category_name, d.channel_name, (select count(*) from life where is_del="N" and partner_idx = a.idx) as article_count');
$this->db->where('a.member_group_idx', $member_group_idx);
$this->db->where('a.is_del', 'N');
$this->db->from('partner as a');
$this->db->join('member_group as b', 'a.member_group_idx = b.idx');
$this->db->join('category as c', 'a.category_idx = c.idx');
$this->db->join('channel as d', 'a.channel_idx = d.idx');
$query = $this->db->get_compiled_select();
$this->db->from('('.$query.') as f');
if($sort_column!='') $this->db->order_by('f.'.$sort_column, 'DESC');
$this->db->order_by('f.display_sort desc, f.reg_date desc');
$this->db->limit($limit, $offset);
} else {
$this->db->select('a.*, b.member_group_name, (select count(*) from `column` where is_del="N" and partner_idx = a.idx) as article_count');
$this->db->where('a.member_group_idx', $member_group_idx);
$this->db->where('a.is_del', 'N');
$this->db->from('partner as a');
$this->db->join('member_group as b', 'a.member_group_idx = b.idx');
$query = $this->db->get_compiled_select();
$this->db->from('('.$query.') as f');
if($sort_column!='') $this->db->order_by('f.'.$sort_column, 'DESC');
$this->db->limit($limit, $offset);
}
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner - list용 - total count
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$member_group_idx = $req_data['member_group_idx'];
if($search_type!='' && $search_keyword!=''){
$this->db->like($search_type, $search_keyword);
}
if($member_group_idx == '6') {
$search_category_code1 = $req_data['search_category_code1'];
$search_category_code2 = $req_data['search_category_code2'];
if($search_category_code1!='') $this->db->where('category_idx', $search_category_code1);
if($search_category_code2!='') $this->db->where('channel_idx', $search_category_code2);
}
$this->db->where('member_group_idx', $member_group_idx);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner - insert
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['partner_pwd']= MD5($req_data['partner_pwd']);
$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('partner', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner - update
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_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('partner', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner where partner_id count
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_where_partner_id_count($req_data){
# request
$partner_id = $req_data;
$this->db->where('partner_id', $partner_id);
$this->db->from('partner');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner - select
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner is_del update
# CREATE : 2018-03-14
#---------------------------------------------------------------------------
function partner_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('partner', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : partner - select in idx
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function partner_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('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : partner - select
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function partner_where_partner_id_select($req_data){
# request
$partner_id = $req_data;
$this->db->where('partner_id', $partner_id);
$this->db->where('is_del', 'N');
$this->db->from('partner');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

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

View File

@@ -0,0 +1,233 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_blind extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function blind_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_content_type = $req_data['search_content_type'];
$search_spam_reason = $req_data['search_spam_reason'];
$search_status = $req_data['search_status'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
if($search_content_type!='') $where_query.=" and AA.content_type = '".$search_content_type."'";
if($search_spam_reason!='') $where_query.=" and AA.reason_type like '%".$search_spam_reason."%'";
if($search_status!='') $where_query.=" and AA.blind_status = '".$search_status."'";
$sql="select *, (select count(*) from blind where is_del='N' and blind_id=AA.blind_id and blind_status = '2') as admin_spam_count, (select count(*) from spam where comment_idx=AA.comment_idx) as spam_count
from (select *, (select GROUP_CONCAT(DISTINCT reason_type ORDER BY reason_type DESC SEPARATOR ',') from spam where is_del='N' and comment_idx=blind.comment_idx) as reason_type
from blind
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-28
#---------------------------------------------------------------------------
function blind_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_content_type = $req_data['search_content_type'];
$search_spam_reason = $req_data['search_spam_reason'];
$search_status = $req_data['search_status'];
$where_query = "";
if($search_type!='' && $search_keyword!=''){
$where_query.=" and AA.".$search_type." like '%".$search_keyword."%'";
}
if($search_content_type!='') $where_query.=" and AA.content_type = '".$search_content_type."'";
if($search_spam_reason!='') $where_query.=" and AA.reason_type like '%".$search_spam_reason."%'";
if($search_status!='') $where_query.=" and AA.blind_status = '".$search_status."'";
$sql="select *
from (select *,
(select GROUP_CONCAT(DISTINCT reason_type ORDER BY reason_type DESC SEPARATOR ',') from spam where is_del='N' and comment_idx=blind.comment_idx) as reason_type
from blind
where is_del = 'N') as AA where 1 ".$where_query;
$res = $this->db->query($sql);
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function blind_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('blind', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function blind_join_comment_select($req_data){
# request
$idx = $req_data;
$this->db->select('a.*, b.reg_date as write_date');
$this->db->where('a.idx', $idx);
$this->db->where('a.is_del', 'N');
$this->db->from('blind as a');
$this->db->join('comment as b', 'a.comment_idx=b.idx');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : status group by count
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function blind_list_status_group_by_count(){
$this->db->select('blind_status, count(blind_status) as cnt');
$this->db->where('is_del', 'N');
$this->db->group_by("blind_status");
$this->db->from('blind');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : comment status count
# CREATE : 2018-04-13
#---------------------------------------------------------------------------
function blind_list_join_comment_status_count($comment_status){
$this->db->where('a.is_del', 'N');
$this->db->where('b.comment_status', $comment_status);
$this->db->from('blind as a');
$this->db->join('comment as b', 'a.comment_idx=b.idx');
$res = $this->db->get();
$row = $res->num_rows();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function blind_insert($req_data){
$row = $this->db->insert('blind', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-27
#---------------------------------------------------------------------------
function blind_select($idx){
# request
$this->db->where('idx', $idx);
$this->db->from('blind');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-27
#---------------------------------------------------------------------------
function blind_group_by_count_list($req_data){
# request
$cnt = $req_data['cnt'];
$sql="select blind_id, count(*) as cnt
from blind
where blind_status = '2'
and limit_count < '".$cnt."'
and is_del = 'N'
group by blind_id having count(*) >= ".$cnt;
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-04-27
#---------------------------------------------------------------------------
function blind_group_by_count_update($req_data){
# request
$member_id = $req_data['member_id'];
$limit_count = $req_data['cnt'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_date['update_id'] = $user_id;
$update_date['update_date'] = $now_date;
$update_date['limit_count'] = $limit_count;
$this->db->where('blind_id', $member_id);
$row = $this->db->update('blind', $update_date);
return $row;
}
}
?>

View File

@@ -0,0 +1,222 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_blind_limit extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function blind_limit_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_limit_type = $req_data['search_limit_type'];
$search_status = $req_data['search_status'];
$search_is_today = $req_data['search_is_today'];
if($search_type!='' && $search_keyword!=''){
$this->db->where("(a.member_id LIKE '%".$search_keyword."%' OR a.member_name LIKE '%".$search_keyword."%')");
}
if($search_limit_type!='') $this->db->where('a.limit_type', $search_limit_type);
if($search_status!='') $this->db->where('a.limit_status', $search_status);
if($search_is_today=='Y') $this->db->where('a.reg_date >= ', date("Y-m-d")."00:00:00");
$this->db->select('a.*, (select count(*) from blind_limit where is_del="N" and member_id=a.member_id) as limit_sum_count');
$this->db->where('a.is_del', 'N');
$this->db->from('blind_limit as a');
$this->db->limit($limit, $offset);
$this->db->order_by('a.reg_date', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list - total count
# CREATE : 2018-03-30
#----------------------------------------------------------------------------
function blind_limit_list_total_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_limit_type = $req_data['search_limit_type'];
$search_status = $req_data['search_status'];
$search_is_today = $req_data['search_is_today'];
if($search_type!='' && $search_keyword!=''){
$this->db->where("(member_id LIKE '%".$search_keyword."%' OR member_name LIKE '%".$search_keyword."%')");
}
if($search_limit_type!='') $this->db->where('limit_type', $search_limit_type);
if($search_status!='') $this->db->where('limit_status', $search_status);
if($search_is_today=='Y') $this->db->where('reg_date >= ', date("Y-m-d")."00:00:00");
$this->db->where('is_del', 'N');
$this->db->from('blind_limit');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : new count
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_limit_new_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_limit_type = $req_data['search_limit_type'];
$search_status = $req_data['search_status'];
$now_date = date("Y-m-d")." 00:00:00";
if($search_type!='' && $search_keyword!=''){
$this->db->where("(member_id LIKE '%".$search_keyword."%' OR member_name LIKE '%".$search_keyword."%')");
}
if($search_limit_type!='') $this->db->where('limit_type', $search_limit_type);
if($search_status!='') $this->db->where('limit_status', $search_status);
$this->db->where('is_del', 'N');
$this->db->where('reg_date >=', $now_date);
$this->db->from('blind_limit');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : status group by count
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_limit_status_group_by_count($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$search_limit_type = $req_data['search_limit_type'];
$search_status = $req_data['search_status'];
$search_is_today = $req_data['search_is_today'];
if($search_type!='' && $search_keyword!=''){
$this->db->where("(member_id LIKE '%".$search_keyword."%' OR member_name LIKE '%".$search_keyword."%')");
}
if($search_limit_type!='') $this->db->where('limit_type', $search_limit_type);
if($search_status!='') $this->db->where('limit_status', $search_status);
if($search_is_today=='Y') $this->db->where('reg_date >= ', date("Y-m-d")."00:00:00");
$this->db->select('limit_status, count(limit_status) as cnt');
$this->db->where('is_del', 'N');
$this->db->group_by("limit_status");
$this->db->from('blind_limit');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_limit_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
if($user_id=='') $user_id = $req_data['reg_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('blind_limit', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_limit_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('blind_limit');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_limit_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('blind_limit', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_del update
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_limit_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('blind_limit', $update_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,76 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_blind_setting extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_setting_list(){
$this->db->from('blind_setting');
$this->db->order_by('limit_count', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : update
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_setting_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
foreach($req_data as $key=>$val) {
$req_data[$key]['update_id'] = $user_id;
$req_data[$key]['update_date'] = $now_date;
}
$this->db->update_batch('blind_setting', $req_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function blind_setting_select($idx){
$this->db->where('idx', $idx);
$this->db->from('blind_setting');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,117 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_comment_setting extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : comment_setting select
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function comment_setting_select($req_data){
# request
$setting_type = $req_data['setting_type'];
$this->db->where('setting_type', $setting_type);
$this->db->from('comment_setting');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : comment_setting update
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function comment_setting_update($req_data){
# request
$setting_type = $req_data['setting_type'];
$best_comment_like_count = $req_data['best_comment_like_count'];
$max_best_comment_count = $req_data['max_best_comment_count'];
$block_call_count = $req_data['block_call_count'];
$block_call_type = $req_data['block_call_type'];
$block_blind_conent = $req_data['block_blind_conent'];
$block_del_conent = $req_data['block_del_conent'];
$self_del_contnet = $req_data['self_del_contnet'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('best_comment_like_count' => $best_comment_like_count,
'max_best_comment_count' => $max_best_comment_count,
'block_call_count' => $block_call_count,
'block_call_type' => $block_call_type,
'block_blind_conent' => $block_blind_conent,
'block_del_conent' => $block_del_conent,
'self_del_contnet' => $self_del_contnet,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('setting_type', $setting_type);
$row = $this->db->update('comment_setting', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : comment_setting list
# CREATE : 2018-03-13
#---------------------------------------------------------------------------
function comment_setting_list(){
$this->db->from('comment_setting');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-11
#---------------------------------------------------------------------------
function contents_setting_select($idx){
$this->db->where('idx', $idx);
$this->db->from('contents_setting');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-05-10
#---------------------------------------------------------------------------
function comment_setting_where_content_idx_select($content_idx){
$this->db->where('setting_type', $content_idx);
$this->db->from('comment_setting');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,329 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_realtime_keyword extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 - list
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_list(){
$this->db->where('is_del', 'N');
$this->db->from('realtime_keyword');
$this->db->order_by('rank asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 - list where search count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function realtime_keyword_list_where_search_count($req_data){
# request
$search_count = $req_data;
$this->db->where('is_del', 'N');
$this->db->where('search_count <=', $search_count);
$this->db->from('realtime_keyword');
$this->db->order_by('rank asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 - list where search count 위에 순위
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function realtime_keyword_list_where_over_search_count($req_data){
# request
$search_count = $req_data;
$this->db->where('is_del', 'N');
$this->db->where('search_count >', $search_count);
$this->db->from('realtime_keyword');
$this->db->order_by('rank desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 insert
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_insert($req_data){
# request
$rank = $req_data['rank'];
$keyword = $req_data['keyword'];
$search_count = $req_data['search_count'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$insert_data = array('rank' => $rank,
'keyword' => $keyword,
'search_count' => $search_count,
'reg_id' => $user_id,
'reg_date' => $now_date,
'update_id' => $user_id,
'update_date' => $now_date
);
$row = $this->db->insert('realtime_keyword', $insert_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 - realtime_keyword.is_del update
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_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('realtime_keyword', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 update
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
foreach($req_data as $key=>$val) {
$req_data[$key]['update_id'] = $user_id;
$req_data[$key]['update_date'] = $now_date;
}
$row = $this->db->update_batch('realtime_keyword', $req_data, 'idx');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 셋팅 - select
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_setting_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->from('realtime_keyword_setting');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 select
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_where_keyword_select($keyword){
$this->db->where('keyword', $keyword);
$this->db->from('realtime_keyword');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 셋팅 - update
# CREATE : 2018-02-23
#---------------------------------------------------------------------------
function realtime_keyword_setting_update($req_data){
# request
$idx = $req_data['idx'];
$base_hour = $req_data['base_hour'];
$delete_hour = $req_data['delete_hour'];
$is_no_result_keyword = $req_data['is_no_result_keyword'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('base_hour' => $base_hour,
'delete_hour' => $delete_hour,
'is_no_result_keyword' => $is_no_result_keyword,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$row = $this->db->update('realtime_keyword_setting', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 log - list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function realtime_keyword_log_list($req_data){
# request
$start_date = $req_data['start_date'];
$end_date = $req_data['end_date'];
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$this->db->where('base_date >=', $start_date);
$this->db->where('base_date <=', $end_date);
$this->db->where('is_del', 'N');
$this->db->from('realtime_keyword_log');
$this->db->order_by('reg_date desc, rank asc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 log list - total count
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function realtime_keyword_log_list_total_count($req_data){
# request
$start_date = $req_data['start_date'];
$end_date = $req_data['end_date'];
$this->db->where('base_date >=', $start_date);
$this->db->where('base_date <=', $end_date);
$this->db->where('is_del', 'N');
$this->db->from('realtime_keyword_log');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 log - all list
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function realtime_keyword_log_all_list($req_data){
# request
$start_date = $req_data['start_date'];
$end_date = $req_data['end_date'];
$this->db->where('base_date >=', $start_date);
$this->db->where('base_date <=', $end_date);
$this->db->where('is_del', 'N');
$this->db->from('realtime_keyword_log');
$this->db->order_by('reg_date desc, rank asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 실시간검색어 select max reg_date
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function realtime_keyword_max_reg_date(){
$this->db->select('max(reg_date) as reg_date');
$this->db->where('is_del', 'N');
$this->db->from('realtime_keyword');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 로그로 이동
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function realtime_keyword_move_log(){
$now_date = date("Y-m-d H:i:s");
$sql = "INSERT INTO realtime_keyword_log (base_date, rank, last_rank, keyword, search_count, reg_id, reg_date, update_id, update_date, is_del)
SELECT reg_date, rank, last_rank, keyword, search_count, reg_id, reg_date, update_id, update_date, is_del
FROM realtime_keyword";
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : delete
# CREATE : 2018-04-17
#---------------------------------------------------------------------------
function realtime_keyword_where_reg_date_delete($reg_date){
$this->db->where('reg_date <', $reg_date);
$row = $this->db->delete('realtime_keyword');
return $row;
}
}
?>

View File

@@ -0,0 +1,248 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_setting_site extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : site_info select
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function site_info_select(){
$sql1 = "select * from site_info where idx = 1";
$res1 = $this->db->query($sql1);
$row1 = $res1->row();
$array = json_decode(json_encode($row1), true);
return $array;
}
#---------------------------------------------------------------------------
# PURPOSE : site_info insert
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function site_info_insert($req_data){
# request
$homepage_title = $req_data['homepage_title'];
$footer_script = $req_data['footer_script'];
$webmaster_name = $req_data['webmaster_name'];
$webmaster_email = $req_data['webmaster_email'];
$admin_logo = $req_data['admin_logo'];
$footer_content = $req_data['footer_content'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$insert_data = array('idx' => 1,
'homepage_title' => $homepage_title,
'footer_script' => $footer_script,
'webmaster_name' => $webmaster_name,
'webmaster_email' => $webmaster_email,
'admin_logo' => $admin_logo,
'footer_content' => $footer_content,
'reg_date' => $now_date,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->insert('site_info', $insert_data);
}
#---------------------------------------------------------------------------
# PURPOSE : site_info update
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function site_info_update($req_data){
# request
$idx = $req_data['idx'];
$homepage_title = $req_data['homepage_title'];
$footer_script = $req_data['footer_script'];
$webmaster_name = $req_data['webmaster_name'];
$webmaster_email = $req_data['webmaster_email'];
$admin_logo = $req_data['admin_logo'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('homepage_title' => $homepage_title,
'footer_script' => $footer_script,
'webmaster_name' => $webmaster_name,
'webmaster_email' => $webmaster_email,
'admin_logo' => $admin_logo,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$this->db->update('site_info', $update_data);
}
#---------------------------------------------------------------------------
# PURPOSE : site_info.footer_content update
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function site_info_footer_content_update($req_data){
# request
$idx = $req_data['idx'];
$footer_content = $req_data['footer_content'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('footer_content' => $footer_content,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$this->db->update('site_info', $update_data);
}
#---------------------------------------------------------------------------
# PURPOSE : site_info.service, privacy, privacy_agreement update
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function site_info_policy_update($req_data){
# request
$idx = $req_data['idx'];
$service = $req_data['service'];
$privacy = $req_data['privacy'];
$privacy_agreement = $req_data['privacy_agreement'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data = array('service' => $service,
'privacy' => $privacy,
'privacy_agreement' => $privacy_agreement,
'update_id' => $user_id,
'update_date' => $now_date
);
$this->db->where('idx', $idx);
$this->db->update('site_info', $update_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 금칙어 select
# CREATE : 2018-02-19
#---------------------------------------------------------------------------
function forbidden_word_select(){
$sql1 = "select * from forbidden_word order by idx asc";
$res1 = $this->db->query($sql1);
$row1 = $res1->result_array();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : 금칙어 truncate
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function forbidden_word_delete(){
$this->db->truncate('forbidden_word');
}
#---------------------------------------------------------------------------
# PURPOSE : 금칙어 insert
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function forbidden_word_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$i = 0;
$arr_word = array();
foreach($req_data as $val) {
$arr_word[$i]['word'] = $val;
$arr_word[$i]['reg_id'] = $user_id;
$arr_word[$i]['reg_date'] = $now_date;
$i++;
}
$this->db->insert_batch('forbidden_word', $arr_word);
}
#---------------------------------------------------------------------------
# PURPOSE : 접근권한 select
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function site_access_ip_select(){
$sql1 = "select * from site_access_ip order by idx asc";
$res1 = $this->db->query($sql1);
$row1 = $res1->result_array();
return $row1;
}
#---------------------------------------------------------------------------
# PURPOSE : 접근권한 truncate
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function site_access_ip_delete(){
$this->db->truncate('site_access_ip');
}
#---------------------------------------------------------------------------
# PURPOSE : 접근권한 insert
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function site_access_ip_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$i = 0;
$arr_access_ip = array();
foreach ($req_data['access_type_1'] as $val1){
$arr_access_ip[$i]['access_type'] = 1;
$arr_access_ip[$i]['ip'] = $val1;
$arr_access_ip[$i]['reg_id'] = $user_id;
$arr_access_ip[$i]['reg_date'] = $now_date;
$i++;
}
foreach ($req_data['access_type_2'] as $val2){
$arr_access_ip[$i]['access_type'] = 2;
$arr_access_ip[$i]['ip'] = $val2;
$arr_access_ip[$i]['reg_id'] = $user_id;
$arr_access_ip[$i]['reg_date'] = $now_date;
$i++;
}
foreach ($req_data['access_type_3'] as $val3){
$arr_access_ip[$i]['access_type'] = 3;
$arr_access_ip[$i]['ip'] = $val3;
$arr_access_ip[$i]['reg_id'] = $user_id;
$arr_access_ip[$i]['reg_date'] = $now_date;
$i++;
}
$this->db->insert_batch('site_access_ip', $arr_access_ip);
}
}
?>