first commit
This commit is contained in:
68
application/models/admin/admin_member/m_admin_member.php
Executable file
68
application/models/admin/admin_member/m_admin_member.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
76
application/models/admin/admin_member/m_login.php
Executable file
76
application/models/admin/admin_member/m_login.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
74
application/models/admin/advertisement/m_ad_detail.php
Executable file
74
application/models/admin/advertisement/m_ad_detail.php
Executable 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;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
737
application/models/admin/column/m_column.php
Executable file
737
application/models/admin/column/m_column.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
261
application/models/admin/column/m_column_comment.php
Executable file
261
application/models/admin/column/m_column_comment.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
214
application/models/admin/comm/m_comment.php
Executable file
214
application/models/admin/comm/m_comment.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
63
application/models/admin/comm/m_contents_setting.php
Executable file
63
application/models/admin/comm/m_contents_setting.php
Executable 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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
143
application/models/admin/comm/m_crud.php
Executable file
143
application/models/admin/comm/m_crud.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
35
application/models/admin/comm/m_delivery.php
Executable file
35
application/models/admin/comm/m_delivery.php
Executable 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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
345
application/models/admin/comm/m_ranking.php
Executable file
345
application/models/admin/comm/m_ranking.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
182
application/models/admin/comm/m_ranking_log.php
Executable file
182
application/models/admin/comm/m_ranking_log.php
Executable file
@@ -0,0 +1,182 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_ranking_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking log - list
|
||||
# CREATE : 2018-03-07
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code = $req_data['search_category_code'];
|
||||
$search_date = $req_data['search_date'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('a.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
|
||||
if($search_date!='') $this->db->where('a.ranking_date', $search_date);
|
||||
|
||||
$this->db->select('a.*, c.category_name as category_name1');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('c.depth', '1');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('news_section as c', 'SUBSTRING(c.category_code, 1, 2) = c.category_code');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.'.$sort_column, 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking news - list - total count
|
||||
# CREATE : 2018-03-07
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code = $req_data['search_category_code'];
|
||||
$search_date = $req_data['search_date'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('a.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code!='') $this->db->like('c.category_code', $search_category_code, 'after');
|
||||
if($search_date!='') $this->db->where('a.ranking_date', $search_date);
|
||||
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('c.depth', '1');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('news_section as c', 'SUBSTRING(c.category_code, 1, 2) = c.category_code');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking life - list
|
||||
# CREATE : 2018-03-21
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_join_life_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code1 = $req_data['search_category_code1'];
|
||||
$search_category_code2 = $req_data['search_category_code2'];
|
||||
$search_life_type = $req_data['search_life_type'];
|
||||
$search_theme_type = $req_data['search_theme_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('b.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1);
|
||||
if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2);
|
||||
if($search_life_type!='') $this->db->where('b.life_type', $search_life_type);
|
||||
if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type);
|
||||
|
||||
$this->db->select('a.idx, a.rank, a.title, a.main_img, a.ranking_type, a.reg_date, a.content_idx, b.life_type, b.editor_name, b.hit_count, b.like_count, b.comment_count, b.share_count, c.category_name as category_name1, d.channel_name as category_name2');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('life as b', 'a.content_idx = b.idx');
|
||||
$this->db->join('category as c', 'c.idx = b.category_idx');
|
||||
$this->db->join('channel as d', 'd.idx = b.channel_idx');
|
||||
$this->db->order_by('a.reg_date desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking life - list - total count
|
||||
# CREATE : 2018-03-21
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_log_join_life_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$search_ranking_type = $req_data['search_ranking_type'];
|
||||
$search_category_code1 = $req_data['search_category_code1'];
|
||||
$search_category_code2 = $req_data['search_category_code2'];
|
||||
$search_life_type = $req_data['search_life_type'];
|
||||
$search_theme_type = $req_data['search_theme_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
if($search_type!='' && $search_keyword!=''){
|
||||
$this->db->like('b.'.$search_type, $search_keyword);
|
||||
}
|
||||
if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type);
|
||||
if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1);
|
||||
if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2);
|
||||
if($search_life_type!='') $this->db->where('b.life_type', $search_life_type);
|
||||
if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type);
|
||||
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->from('ranking_log as a');
|
||||
$this->db->join('life as b', 'a.content_idx = b.idx');
|
||||
$this->db->join('category as c', 'c.idx = b.category_idx');
|
||||
$this->db->join('channel as d', 'd.idx = b.channel_idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
105
application/models/admin/comm/m_relation_article.php
Executable file
105
application/models/admin/comm/m_relation_article.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
43
application/models/admin/comm/m_search.php
Executable file
43
application/models/admin/comm/m_search.php
Executable 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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
44
application/models/admin/comm/m_search_keyword_log.php
Executable file
44
application/models/admin/comm/m_search_keyword_log.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
107
application/models/admin/comm/m_spam.php
Executable file
107
application/models/admin/comm/m_spam.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
49
application/models/admin/comm/m_t_weather.php
Executable file
49
application/models/admin/comm/m_t_weather.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
167
application/models/admin/comm/m_tag.php
Executable file
167
application/models/admin/comm/m_tag.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
355
application/models/admin/comm/m_theme.php
Executable file
355
application/models/admin/comm/m_theme.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
359
application/models/admin/cs/m_bbs_faq.php
Executable file
359
application/models/admin/cs/m_bbs_faq.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
300
application/models/admin/cs/m_bbs_notice.php
Executable file
300
application/models/admin/cs/m_bbs_notice.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
239
application/models/admin/cs/m_bbs_question.php
Executable file
239
application/models/admin/cs/m_bbs_question.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
273
application/models/admin/delete___maptoon/m_maptoon.php
Executable file
273
application/models/admin/delete___maptoon/m_maptoon.php
Executable 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();
|
||||
}
|
||||
}
|
||||
159
application/models/admin/delete___maptoon/m_maptoon_test.php
Executable file
159
application/models/admin/delete___maptoon/m_maptoon_test.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
142
application/models/admin/design/m_design.php
Executable file
142
application/models/admin/design/m_design.php
Executable 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');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
532
application/models/admin/etc_section/m_etc_section.php
Executable file
532
application/models/admin/etc_section/m_etc_section.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
475
application/models/admin/etc_section/m_life_etc_section.php
Executable file
475
application/models/admin/etc_section/m_life_etc_section.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
463
application/models/admin/etc_section/m_main_category.php
Executable file
463
application/models/admin/etc_section/m_main_category.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
233
application/models/admin/etc_section/m_press.php
Executable file
233
application/models/admin/etc_section/m_press.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
165
application/models/admin/etc_section/m_recommend_app.php
Executable file
165
application/models/admin/etc_section/m_recommend_app.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
163
application/models/admin/etc_section/m_today_word.php
Executable file
163
application/models/admin/etc_section/m_today_word.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
344
application/models/admin/etc_section/m_weather.php
Executable file
344
application/models/admin/etc_section/m_weather.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
1024
application/models/admin/life/m_life.php
Executable file
1024
application/models/admin/life/m_life.php
Executable file
File diff suppressed because it is too large
Load Diff
48
application/models/admin/life/m_life_category.php
Executable file
48
application/models/admin/life/m_life_category.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
303
application/models/admin/life/m_life_channel.php
Executable file
303
application/models/admin/life/m_life_channel.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
286
application/models/admin/life/m_life_comment.php
Executable file
286
application/models/admin/life/m_life_comment.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
147
application/models/admin/life/m_ranking.php
Executable file
147
application/models/admin/life/m_ranking.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
307
application/models/admin/member/m_member.php
Executable file
307
application/models/admin/member/m_member.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
280
application/models/admin/member/m_member_group.php
Executable file
280
application/models/admin/member/m_member_group.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
48
application/models/admin/member/m_member_setting.php
Executable file
48
application/models/admin/member/m_member_setting.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
331
application/models/admin/member/m_partner.php
Executable file
331
application/models/admin/member/m_partner.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
642
application/models/admin/news/m_news.php
Executable file
642
application/models/admin/news/m_news.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
283
application/models/admin/news/m_news_comment.php
Executable file
283
application/models/admin/news/m_news_comment.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
294
application/models/admin/news/m_news_section.php
Executable file
294
application/models/admin/news/m_news_section.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
193
application/models/admin/news/m_ranking.php
Executable file
193
application/models/admin/news/m_ranking.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
262
application/models/admin/news/m_theme_news.php
Executable file
262
application/models/admin/news/m_theme_news.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
233
application/models/admin/setting/m_blind.php
Executable file
233
application/models/admin/setting/m_blind.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
222
application/models/admin/setting/m_blind_limit.php
Executable file
222
application/models/admin/setting/m_blind_limit.php
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
76
application/models/admin/setting/m_blind_setting.php
Executable file
76
application/models/admin/setting/m_blind_setting.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
117
application/models/admin/setting/m_comment_setting.php
Executable file
117
application/models/admin/setting/m_comment_setting.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
329
application/models/admin/setting/m_realtime_keyword.php
Executable file
329
application/models/admin/setting/m_realtime_keyword.php
Executable 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
248
application/models/admin/setting/m_setting_site.php
Executable file
248
application/models/admin/setting/m_setting_site.php
Executable 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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
78
application/models/category_model.php
Executable file
78
application/models/category_model.php
Executable file
@@ -0,0 +1,78 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class category_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'category';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($categoryId = null)
|
||||
{
|
||||
if (!is_null($categoryId)) {
|
||||
if(is_array($categoryId)) $categoryId = implode(',', $categoryId);
|
||||
$sql = "SELECT *
|
||||
FROM `category`
|
||||
WHERE `category`.`idx` IN($categoryId)";
|
||||
} else {
|
||||
$sql = "SELECT *
|
||||
FROM `category` order by category_name";
|
||||
}
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
public function getCategories($categoryId)
|
||||
{
|
||||
if (is_array($categoryId)) {
|
||||
$categoryId = implode(",", $categoryId);
|
||||
}
|
||||
|
||||
$query = $this->db->query("SELECT
|
||||
*
|
||||
FROM
|
||||
`category`
|
||||
WHERE
|
||||
`category`.`idx` IN ($categoryId) order by category_name");
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
public function findByName($categoryName)
|
||||
{
|
||||
return $this->db->where_in('category_name', $categoryName)->get($this->table);
|
||||
}
|
||||
|
||||
public function findByParentId($parentId)
|
||||
{
|
||||
return $this->db->where_in('parent', $parentId)->get($this->table);
|
||||
}
|
||||
|
||||
public function getSubCategoryId($parentCategoryName = 'grace-category')
|
||||
{
|
||||
$subCategoryId = array();
|
||||
$parentId = 0;
|
||||
$categoryQuery = $this->findByName($parentCategoryName);
|
||||
if (!$categoryQuery->num_rows()) {
|
||||
$this->db->insert($this->table, array(
|
||||
'category_name' => $parentCategoryName,
|
||||
));
|
||||
$parentId = $this->db->insert_id();
|
||||
} else {
|
||||
$parentId = $categoryQuery->row()->idx;
|
||||
$subCategories = $this->findByParentId($parentId)->result();
|
||||
foreach ($subCategories as $sub) {
|
||||
array_push($subCategoryId, $sub->idx);
|
||||
}
|
||||
}
|
||||
return array('parent' => $parentId, 'subcategories' => $subCategoryId);
|
||||
}
|
||||
|
||||
public function findAll($categoryId = null)
|
||||
{
|
||||
return $this->db->from($this->table . ' l');
|
||||
}
|
||||
|
||||
}
|
||||
28
application/models/comment_model.php
Executable file
28
application/models/comment_model.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class comment_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'comment';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function find($alias = true) {
|
||||
return $this->db->from($this->table. ($alias ? ' cmt' : ''));
|
||||
}
|
||||
|
||||
public function findById($commentId) {
|
||||
return $this->db->where('idx', $commentId)->get($this->table)->row();
|
||||
}
|
||||
|
||||
public function findByContentTypeAndContentId($type, $id) {
|
||||
return $this->db->from($this->table. ' c')
|
||||
->where('content_type', $type)
|
||||
->where('content_idx', $id);
|
||||
}
|
||||
|
||||
}
|
||||
52
application/models/config_model.php
Executable file
52
application/models/config_model.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class config_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'cm_config';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($configId)
|
||||
{
|
||||
return $this->db->where('Id', $configId)->get($this->table);
|
||||
}
|
||||
|
||||
public function findByCategoryId($categoryId)
|
||||
{
|
||||
return $this->db->from($this->table . ' cnf')->where_in('CategoryId', $categoryId);
|
||||
}
|
||||
|
||||
public function findByTypeAndName($configType, $name)
|
||||
{
|
||||
return $this->db->from($this->table . ' cnf')->where_in('Type', $configType)->where_in('Name', $name);
|
||||
}
|
||||
|
||||
public function findByTypeAndPostId($configType, $postId)
|
||||
{
|
||||
return $this->db->from($this->table . ' cnf')->where_in('Type', $configType)->where_in('PostId', $postId);
|
||||
}
|
||||
|
||||
public function findByTypeAndNameAndPage($configType, $name, $page)
|
||||
{
|
||||
return $this->db->from($this->table . ' cnf')->where_in('Type', $configType)
|
||||
->where_in('Name', $name)->where_in('Page', $page)->order_by('OrderNum');
|
||||
}
|
||||
|
||||
public function findByTypeAndPage($configType, $page)
|
||||
{
|
||||
return $this->db->from($this->table . ' cnf')->where_in('Type', $configType)
|
||||
->where_in('Page', $page)->order_by('OrderNum');
|
||||
}
|
||||
|
||||
public function findByTypeAndNameAndPageAndOrderNum($configType, $name, $page, $order)
|
||||
{
|
||||
return $this->db->from($this->table . ' cnf')->where_in('Type', $configType)->where_in('Name', $name)
|
||||
->where_in('Page', $page)->where_in('OrderNum', $order);
|
||||
}
|
||||
|
||||
}
|
||||
44
application/models/editor_model.php
Executable file
44
application/models/editor_model.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class editor_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'partner';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($editorId) {
|
||||
return $this->db->where('idx', $editorId)->get($this->table)->row();
|
||||
}
|
||||
|
||||
public function findAll() {
|
||||
return $this->db->from($this->table. ' l');
|
||||
}
|
||||
|
||||
public function findByCategoryId($categoryId) {
|
||||
return $this->db->from($this->table. ' p')->where_in('category_idx', $categoryId)->where('p.is_del', 'N')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro, p.category_idx categoryId');
|
||||
}
|
||||
|
||||
public function getEditors($c, $l) {
|
||||
$q = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`p`.`category_idx` `categoryId`
|
||||
FROM
|
||||
`partner` `p`
|
||||
WHERE
|
||||
`category_idx` IN ($c)
|
||||
AND `p`.`is_del` = 'N'
|
||||
LIMIT $l");
|
||||
return $q->result();
|
||||
}
|
||||
|
||||
}
|
||||
38
application/models/life_model.php
Executable file
38
application/models/life_model.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class life_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'life';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($id)
|
||||
{
|
||||
return $this->db->from($this->table . ' l')->where_in('l.idx', $id)
|
||||
->join('partner p', 'l.partner_idx=p.idx', 'left')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
|
||||
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views, l.like_count likes, l.comment_count comments, l.*');
|
||||
}
|
||||
|
||||
public function findByEditorId($editorId)
|
||||
{
|
||||
return $this->db->from($this->table . ' l')->where_in('l.partner_idx', $editorId)
|
||||
->join('partner p', 'l.partner_idx=p.idx', 'left')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
|
||||
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views, l.like_count likes, l.comment_count comments, l.*');
|
||||
}
|
||||
|
||||
public function findByCategoryId($categoryId = null)
|
||||
{
|
||||
return $this->db->from($this->table . ' l')->where_in('l.category_idx', $categoryId)
|
||||
->join('partner p', 'l.partner_idx=p.idx', 'left')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
|
||||
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views,
|
||||
l.like_count likes, l.comment_count comments, l.update_date, l.reg_date');
|
||||
}
|
||||
}
|
||||
24
application/models/likelog_model.php
Executable file
24
application/models/likelog_model.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class comment_model extends CI_Model
|
||||
{
|
||||
|
||||
private $table = 'like_log';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($id) {
|
||||
return $this->db->where('idx', $id)->get($this->table)->row();
|
||||
}
|
||||
|
||||
public function findByContentTypeAndContentId($type, $id) {
|
||||
return $this->db->from($this->table. ' ll')
|
||||
->where('content_type', $type)
|
||||
->where('content_idx', $id);
|
||||
}
|
||||
|
||||
}
|
||||
896
application/models/maptoon/m_maptoon.php
Executable file
896
application/models/maptoon/m_maptoon.php
Executable file
@@ -0,0 +1,896 @@
|
||||
<?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';
|
||||
var $tb_name_ep_like = 'mt_ep_recommend_count';
|
||||
var $tb_name_grade = 'mt_ep_grade_count';
|
||||
var $tb_name_ep_hit = 'mt_ep_hit_log';
|
||||
var $tb_name_mt_recommend ='mt_recommend_count';
|
||||
var $tb_name_ep_rank ='mt_ep_view_rank';
|
||||
|
||||
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]);
|
||||
$ret = $query->result_array();
|
||||
// echo $this->db->last_query();
|
||||
} 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();
|
||||
} else {
|
||||
$ret = FALSE;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/*
|
||||
get episodes info by sql query
|
||||
@param (array) episode idx
|
||||
@param (string) return data format
|
||||
@return (array or string | FALSE)
|
||||
*/
|
||||
public function get_widget_info_by_episode_idx($arr, $format='') {
|
||||
if(is_array($arr)==FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
$len = count($arr);
|
||||
if(is_numeric($len)==FALSE || $len<=0) {
|
||||
return FALSE;
|
||||
}
|
||||
$where_in = implode(',',$arr);
|
||||
$where_in = "'".str_replace(',',"','",$where_in)."'";
|
||||
|
||||
$sql = "SELECT a.idx as epi_idx, a.mt_list_idx, a.title, a.main_img, a.ep_no,".
|
||||
"a.display_date, a.view_count, a.grade, a.reg_date,".
|
||||
"b.idx as mt_idx, b.name, b.mt_cartoonists_idx ".
|
||||
"FROM ".$this->tb_name_episode." a, ".$this->tb_name_maptoon_list." b ".
|
||||
"WHERE a.mt_list_idx=b.idx ".
|
||||
"AND a.idx IN ($where_in) ".
|
||||
"ORDER BY FIELD(a.idx,$where_in)";
|
||||
$query = $this->db->query($sql);
|
||||
$row = $query->result_array();
|
||||
$len_row = count($row);
|
||||
$where_in2 = [];
|
||||
if($len_row<=0) {
|
||||
return FALSE;
|
||||
}
|
||||
foreach($row as $k=>$v) {
|
||||
if(is_numeric($v['mt_cartoonists_idx'])==TRUE
|
||||
&& $v['mt_cartoonists_idx'] > 0) {
|
||||
$where_in2[] = $v['mt_cartoonists_idx'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->select('idx, name');
|
||||
$this->db->where_in('idx',$where_in2);
|
||||
$where_in2_str = implode(',',$where_in2);
|
||||
$this->db->order_by('Field(idx, '.$where_in2_str.')');
|
||||
$query = $this->db->get($this->tb_name_cartoonist);
|
||||
$row2 = $query->result_array();
|
||||
// echo $this->db->last_query();
|
||||
for($i=0; $i<$len_row; $i++) {
|
||||
$row[$i]['cartoonist'] = $this->get_cartoonist_name_from_data($row2,$row[$i]['mt_cartoonists_idx']);
|
||||
$row[$i]['episode_url'] = '/web/maptoon/article?mtId='.$row[$i]['mt_idx'].'&no='.$row[$i]['ep_no'];
|
||||
$row[$i]['maptoon_url'] = $this->get_maptoon_url($row[$i]['mt_idx']);
|
||||
$row[$i]['display_date_timestamp'] = strtotime($row[$i]['display_date']);
|
||||
}
|
||||
|
||||
if($format=='json') {
|
||||
return json_encode($row);
|
||||
} else {
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
||||
function get_cartoonist_name_from_data($arr,$idx) {
|
||||
if(is_array($arr)==TRUE && is_numeric($idx)==TRUE && $idx>0) {
|
||||
foreach($arr as $v) {
|
||||
if($v['idx']==$idx) {
|
||||
return $v['name'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
get today maptoon; presented on ongoing maing page
|
||||
*/
|
||||
public function get_today_maptoon() {
|
||||
$sql = "SELECT * FROM ".$this->tb_name_maptoon_list.
|
||||
" WHERE status=0 ORDER BY recommend ASC";
|
||||
$qry = $this->db->query($sql);
|
||||
$row = $qry->result_array();
|
||||
$len_row = count($row);
|
||||
|
||||
if($len_row<=0) {
|
||||
return FALSE;
|
||||
}
|
||||
$result = ['mon' => [], 'tue' => [], 'wed' => [],
|
||||
'thu' => [], 'fri' => [], 'sat' => []];
|
||||
$cartoonist = $this->get_cartoonist_list();
|
||||
foreach($row as $v) {
|
||||
$v['maptoon_url'] = $this->get_maptoon_url($v['idx']);
|
||||
$v['description'] = str_replace('\n',' ',$v['description']);
|
||||
foreach($cartoonist as $val) {
|
||||
if($v['mt_cartoonists_idx']==$val['idx']) {
|
||||
$v['cartoonist'] = $val['name'];
|
||||
}
|
||||
}
|
||||
// if($v['date_sun']==1) {
|
||||
// $result['sun'] = $v;
|
||||
// }
|
||||
if($v['date_mon']==1) {
|
||||
array_push($result['mon'],$v);
|
||||
}
|
||||
if($v['date_tue']==1) {
|
||||
array_push($result['tue'],$v);
|
||||
}
|
||||
if($v['date_wed']==1) {
|
||||
array_push($result['wed'],$v);
|
||||
}
|
||||
if($v['date_thu']==1) {
|
||||
array_push($result['thu'],$v);
|
||||
}
|
||||
if($v['date_fri']==1) {
|
||||
array_push($result['fri'],$v);
|
||||
}
|
||||
if($v['date_sat']==1) {
|
||||
array_push($result['sat'],$v);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
return maptoon url
|
||||
@param (numeric) idx of mt_list table
|
||||
@return (string | NULL)
|
||||
*/
|
||||
public function get_maptoon_url($mt_idx) {
|
||||
if(is_numeric($mt_idx)==TRUE && $mt_idx>0) {
|
||||
return '/web/maptoon/list?mtId='.$mt_idx;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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();
|
||||
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 delete_maptoon($idx) {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$ret = $this->db->delete($this->tb_name_maptoon_list, ['idx'=>$idx]);
|
||||
return $this->db->last_query();
|
||||
return $ret;
|
||||
} 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 number of announcement by maptoon
|
||||
@param (numeric) pk of tb_name_maptoon_list
|
||||
@return (numeric)
|
||||
*/
|
||||
public function get_num_of_announcement_by_maptoon($mt_idx) {
|
||||
if(is_numeric($mt_idx)==TRUE && $mt_idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_notice,['mt_list_idx'=>$mt_idx]);
|
||||
return $query->num_rows();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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"||$sort_list=="") $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_episode_list
|
||||
@return array or FALSE
|
||||
*/
|
||||
public function get_episode_list_search_count($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']; // 작가
|
||||
|
||||
$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;
|
||||
}}
|
||||
|
||||
if($sort_list=="up"||$sort_list=="") $this->db->order_by("reg_date","DESC");
|
||||
if($sort_list=="vi") $this->db->order_by("view_count","DESC");
|
||||
|
||||
$res = $this->db->count_all_results();
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
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();
|
||||
}
|
||||
|
||||
/*
|
||||
return episode data by maptoon id and idx
|
||||
@param array (mt_idx, episode_idx)
|
||||
@return array or FALSE
|
||||
*/
|
||||
public function get_episode_by_mt_idx_episode_no($arr){
|
||||
$query = $this->db->get_where($this->tb_name_episode,$arr);
|
||||
$result= $query -> row();
|
||||
$data = (array)$result;
|
||||
if(count($data)==0 || ($data['is_display']==0)){
|
||||
return false;
|
||||
}else{
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
return num of episodes by maptoon idx
|
||||
@param (numeric) idx of mt_list table
|
||||
@return (numeric)
|
||||
*/
|
||||
public function get_display_episodes($req_data) {
|
||||
$mt_idx = $req_data['idx'];
|
||||
isset($req_data['offset'])?$offset= $req_data['offset']:$offset=0;
|
||||
isset($req_data['limit'])?$limit=$req_data['limit']:$limit=0;
|
||||
isset($req_data['div'])?$div=$req_data['div']:$div=0;
|
||||
|
||||
if($limit!=0){
|
||||
if($div=='main'){//메인페이지
|
||||
$this->db->select($this->tb_name_episode.'.*');
|
||||
$this->db->select('b.name');
|
||||
$this->db->join($this->tb_name_maptoon_list.' as b', 'b.idx = '.$this->tb_name_episode.'.mt_list_idx');
|
||||
$this->db->order_by("reg_date","DESC");
|
||||
}
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by("ep_no","DESC");
|
||||
}else{
|
||||
$this->db->order_by("ep_no","ASC");
|
||||
}
|
||||
if($mt_idx==0){
|
||||
$_where = "is_display=1";
|
||||
}else{
|
||||
$_where = "mt_list_idx=".$mt_idx." AND is_display=1";
|
||||
}
|
||||
$query = $this->db->get_where($this->tb_name_episode,$_where);
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/*
|
||||
return toal count of display episodes by maptoon idx
|
||||
@param (numeric) idx of mt_list table
|
||||
@return (numeric)
|
||||
*/
|
||||
public function get_totalcount_episodes($mt_idx){
|
||||
if($mt_idx==0){
|
||||
$num = $this->db->count_all($this->tb_name_episode);
|
||||
}else{
|
||||
$_where = "mt_list_idx=".$mt_idx." AND is_display=1";
|
||||
$this->db->where($_where);
|
||||
$num = $this->db->count_all_results($this->tb_name_episode);
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
/*
|
||||
find like data and insert or delete
|
||||
return String message
|
||||
*/
|
||||
public function like($req_data){
|
||||
$member_id=$req_data['user_id'];
|
||||
|
||||
$this->db->where('member_id',$member_id);
|
||||
$query=$this->db->get('member');
|
||||
|
||||
$ep_idx=$req_data['ep_idx'];
|
||||
$mt_list_idx=$req_data['mt_list_idx'];
|
||||
$mb_idx=$query->result_array()[0]['idx'];
|
||||
|
||||
$data=array('ep_idx'=>$ep_idx,
|
||||
'mb_idx'=>$mb_idx); //where
|
||||
|
||||
$query = $this->db->get_where($this->tb_name_ep_like,$data);
|
||||
$num=$query->num_rows();
|
||||
$message;
|
||||
|
||||
if($num==0){
|
||||
//Insert
|
||||
$message="좋아요를 선택하셨습니다.";
|
||||
$this->db->insert($this->tb_name_ep_like, $data);
|
||||
|
||||
$this->db->set("recommend_count","recommend_count+1",false);
|
||||
$this->db->where("idx",$ep_idx);
|
||||
$this->db->update($this->tb_name_episode);
|
||||
|
||||
$this->db->set("recommend","recommend+1",false);
|
||||
$this->db->where("idx",$mt_list_idx);
|
||||
$this->db->update($this->tb_name_maptoon_list);
|
||||
$state=1;
|
||||
}else{
|
||||
//Delete
|
||||
$message="좋아요를 해지하셨습니다.";
|
||||
$this->db->delete($this->tb_name_ep_like, $data);
|
||||
$this->db->set("recommend_count","recommend_count-1",false);
|
||||
$this->db->where("idx",$ep_idx);
|
||||
$this->db->update($this->tb_name_episode);
|
||||
|
||||
$this->db->set("recommend","recommend-1",false);
|
||||
$this->db->where("idx",$mt_list_idx);
|
||||
$this->db->update($this->tb_name_maptoon_list);
|
||||
|
||||
$state=2;
|
||||
}
|
||||
|
||||
$return_data=array('message'=>$message,'state'=>$state);
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
/*
|
||||
return grade insert and return grade
|
||||
@param (array) idx of mt_episodes table AND user id
|
||||
@return (array)
|
||||
*/
|
||||
public function star_score($req_data){
|
||||
$member_id = $req_data['user_id'];
|
||||
$this->db->where('member_id',$member_id);
|
||||
$query=$this->db->get('member');
|
||||
|
||||
$mb_idx=$query->result_array()[0]['idx'];
|
||||
$ep_idx = $req_data['ep_idx'];
|
||||
$grade = $req_data['score'];
|
||||
|
||||
|
||||
//중복 조회
|
||||
// $where_data=array(
|
||||
// 'mb_idx'=>$mb_idx,
|
||||
// 'ep_idx'=>$ep_idx);
|
||||
|
||||
$this->db->where('mb_idx',$mb_idx);
|
||||
$this->db->where('ep_idx',$ep_idx);
|
||||
$query = $this->db->get($this->tb_name_grade);
|
||||
$is_date=$query->result_array();
|
||||
if(count($is_date)==0){
|
||||
$insert_data=array(
|
||||
'mb_idx'=>$mb_idx,
|
||||
'ep_idx'=>$ep_idx,
|
||||
'grade'=>$grade
|
||||
);
|
||||
|
||||
$this->db->insert($this->tb_name_grade, $insert_data);
|
||||
|
||||
|
||||
$this->db->select('grade, grade_total');
|
||||
$query =$this->db->get_where($this->tb_name_episode,array('idx'=>$ep_idx));
|
||||
|
||||
$grade_data = $query->result_array();
|
||||
$c_grade=$grade_data[0]['grade'];
|
||||
$c_grade_total=$grade_data[0]['grade_total'];
|
||||
|
||||
$u_grade= ($c_grade*$c_grade_total+$grade)/($c_grade_total+1);
|
||||
$u_grade_total= $c_grade_total+1;
|
||||
|
||||
$update_data=array(
|
||||
'grade'=>$u_grade,
|
||||
'grade_total'=>$u_grade_total
|
||||
);
|
||||
|
||||
$this->db->where('idx',$ep_idx);
|
||||
$this->db->update($this->tb_name_episode,$update_data);
|
||||
|
||||
|
||||
if ($this->db->affected_rows() > 0)
|
||||
{
|
||||
$res_data['grade']=$u_grade;
|
||||
$res_data['grade_total']=$u_grade_total;
|
||||
$res_data['message']="참여하였습니다.";
|
||||
$res_data['state']=1;
|
||||
return $res_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "실패하였습니다. 관리자에게 문의바랍니다.";
|
||||
}
|
||||
}else{
|
||||
return "이미 참여하였습니다.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
return confirm like and grade
|
||||
@param (array) idx of mt_episodes table AND user id
|
||||
@return (array)
|
||||
*/
|
||||
function ep_is_like_grade($req_data){
|
||||
$member_id = $req_data['user_id'];
|
||||
$this->db->where('member_id',$member_id);
|
||||
$query=$this->db->get('member');
|
||||
|
||||
$mb_idx=$query->result_array()[0]['idx'];
|
||||
$ep_idx=$req_data['ep_idx'];
|
||||
// echo $ep_idx;
|
||||
|
||||
$query = $this->db->get_where($this->tb_name_ep_like,array('mb_idx'=>$mb_idx,'ep_idx'=>$ep_idx));
|
||||
$is_data=$query->num_rows();
|
||||
// echo $is_data;
|
||||
$res_data=array();
|
||||
if($is_data==0){
|
||||
$res_data['is_like']=0;
|
||||
}else{
|
||||
$res_data['is_like']=1;
|
||||
// echo 1;
|
||||
}
|
||||
|
||||
$query = $this->db->get_where($this->tb_name_grade,array('mb_idx'=>$mb_idx,'ep_idx'=>$ep_idx));
|
||||
$is_data=$query->num_rows();
|
||||
if($is_data==0){
|
||||
$res_data['is_grade']=0;
|
||||
}else{
|
||||
$res_data['is_grade']=1;
|
||||
}
|
||||
|
||||
return $res_data;
|
||||
}
|
||||
|
||||
/*
|
||||
return episodes list for article page
|
||||
@param (array) idx of mt_episodes ep_no AND mt_idx
|
||||
@return (array)
|
||||
*/
|
||||
function get_article_ep_list($req_data){
|
||||
$ep_no=$req_data['ep_no'];
|
||||
$mt_list_idx=$req_data['mt_list_idx'];
|
||||
|
||||
if($ep_no<8){
|
||||
$offset=0;
|
||||
$limit=14;
|
||||
}else{
|
||||
$p_limit=7; // 페이지에 표시 되는 에피소드 수
|
||||
$c_page=$ep_no/$p_limit;
|
||||
$offset=($c_page-1)*$p_limit+1;
|
||||
$limit=21;
|
||||
}
|
||||
|
||||
$this->db->select(['idx','title','main_img','ep_no']);
|
||||
$this->db->where('is_display',1);
|
||||
|
||||
$_where=[
|
||||
'mt_list_idx' => $mt_list_idx,
|
||||
'is_display' => 1,
|
||||
'DATE(display_date)<=' => date("Y-m-d H:i:s")
|
||||
];
|
||||
|
||||
$this->db->limit($limit, $offset);
|
||||
$query = $this->db->get_where($this->tb_name_episode,$_where);
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/*
|
||||
insert view count And not return
|
||||
@param (array) idx of mt_episodes member mb_idx
|
||||
@INSERT hit log AND UPDATE mt_episodes view_count
|
||||
*/
|
||||
function ep_hit_count($req_data){
|
||||
$member_id=$req_data['user_id'];
|
||||
if($member_id){
|
||||
$this->db->where('member_id',$member_id);
|
||||
$query=$this->db->get('member');
|
||||
$mb_idx=$query->result_array()[0]['idx'];
|
||||
}else{
|
||||
$mb_idx=NULL;
|
||||
}
|
||||
$ep_idx=$req_data['ep_idx'];
|
||||
$insert_data=array(
|
||||
'mb_idx'=>$mb_idx,
|
||||
'ep_idx'=>$ep_idx
|
||||
);
|
||||
$this->db->insert($this->tb_name_ep_hit,$insert_data);
|
||||
|
||||
$this->db->where('idx',$ep_idx);
|
||||
$this->db->set("view_count","view_count+1",false);
|
||||
$this->db->update($this->tb_name_episode);
|
||||
}
|
||||
|
||||
/*
|
||||
get episodes view ranking
|
||||
@param()
|
||||
@return(array)
|
||||
*/
|
||||
function get_ep_view_rank(){
|
||||
$this->db->select('a.*, b.mt_list_idx, b.ep_no, b.title, c.name');
|
||||
// $this->db->where("a.reg_date>=",date("Y-m-d H:00:00", strtotime("+1 hours")));
|
||||
$this->db->order_by('a.reg_date', 'desc');
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$this->db->limit(10);
|
||||
$this->db->join($this->tb_name_episode.' as b', 'b.idx = a.ep_idx');
|
||||
$this->db->join($this->tb_name_maptoon_list.' as c', 'b.mt_list_idx = c.idx');
|
||||
$query=$this->db->get($this->tb_name_ep_rank.' as a');
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/*
|
||||
get episodes view ranking
|
||||
@param()
|
||||
@return(array)
|
||||
*/
|
||||
function get_mt_pop_rank(){
|
||||
$this->db->select('a.idx, a.main_img, a.name as mt_name, a.recommend, b.name as ct_name');
|
||||
$this->db->order_by('a.recommend','desc');
|
||||
$this->db->limit(5);
|
||||
$this->db->where('recommend !=',0);
|
||||
$this->db->join($this->tb_name_cartoonist.' as b', 'b.idx = a.mt_cartoonists_idx');
|
||||
$query=$this->db->get($this->tb_name_maptoon_list.' as a');
|
||||
|
||||
$rank_list=$query->result_array();
|
||||
$count_list=$query->num_rows();
|
||||
|
||||
if($count_list<5){
|
||||
$_limit=5-$count_list;
|
||||
$this->db->select('a.idx, a.main_img, a.name as mt_name, a.recommend, b.name as ct_name');
|
||||
$this->db->order_by('rand()');
|
||||
$this->db->limit($_limit);
|
||||
$this->db->where('recommend',0);
|
||||
$this->db->join($this->tb_name_cartoonist.' as b', 'b.idx = a.mt_cartoonists_idx');
|
||||
$query_1=$this->db->get($this->tb_name_maptoon_list.' as a');
|
||||
$rank_list_1=$query_1->result_array();
|
||||
$rank_list=array_merge($rank_list,$rank_list_1);
|
||||
}
|
||||
|
||||
return $rank_list;
|
||||
}
|
||||
|
||||
/*
|
||||
update mt_recommend table And return array
|
||||
@param (array) member id, mt_idx
|
||||
@return (array) message, state
|
||||
*/
|
||||
function mt_recommend($res_data){
|
||||
$member_id=$res_data['user_id'];
|
||||
$this->db->where('member_id',$member_id);
|
||||
$query=$this->db->get('member');
|
||||
|
||||
$mb_idx=$query->result_array()[0]['idx'];//member idx
|
||||
|
||||
$mt_idx=$res_data['mt_idx'];
|
||||
|
||||
$data=array('mt_list_idx'=>$mt_idx,
|
||||
'mb_idx'=>$mb_idx); //where
|
||||
|
||||
$query = $this->db->get_where($this->tb_name_mt_recommend,$data);
|
||||
$num=$query->num_rows();
|
||||
$message;
|
||||
|
||||
if($num==0){
|
||||
//Insert
|
||||
$this->db->insert($this->tb_name_mt_recommend, $data);
|
||||
$this->db->set("recommend","recommend+1",false);
|
||||
$this->db->where("idx",$mt_idx);
|
||||
$this->db->update($this->tb_name_maptoon_list);
|
||||
$message="추천하셨습니다.";
|
||||
$state=1;
|
||||
}else{
|
||||
//Delete
|
||||
$this->db->delete($this->tb_name_mt_recommend, $data);
|
||||
$this->db->set("recommend","recommend-1",false);
|
||||
$this->db->where("idx",$mt_idx);
|
||||
$this->db->update($this->tb_name_maptoon_list);
|
||||
$message="추천을 취소했습니다.";
|
||||
$state=2;
|
||||
}
|
||||
|
||||
$return_data=array('message'=>$message,'state'=>$state);
|
||||
return $return_data;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
return reserved idx of epsiodes list
|
||||
@param ()
|
||||
@return (array) idx
|
||||
*/
|
||||
function get_epsiodes_reservation_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', '0');
|
||||
$this->db->from($this->tb_name_episode);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/*
|
||||
update reserved episodes and return update count
|
||||
@param (array) reserved episodes array
|
||||
@return (numeric) update_count
|
||||
*/
|
||||
function episodes_is_display_update_batch($req_data){
|
||||
$arr_update_data = array();
|
||||
foreach($req_data as $key=>$val) {
|
||||
$arr_update_data[$key]['idx'] = $val['idx'];
|
||||
$arr_update_data[$key]['is_display'] = 1;
|
||||
}
|
||||
|
||||
$row = $this->db->update_batch($this->tb_name_episode, $arr_update_data, 'idx');
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
34
application/models/member_model.php
Executable file
34
application/models/member_model.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class member_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'member';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($id)
|
||||
{
|
||||
return $this->db->from($this->table . ' l')->where_in('l.idx', $id)
|
||||
->join('partner p', 'l.partner_idx=p.idx', 'left')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
|
||||
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views, l.like_count likes, l.comment_count comments, l.*');
|
||||
}
|
||||
|
||||
public function findByEditorId($editorId)
|
||||
{
|
||||
return $this->db->from($this->table . ' l')->where_in('l.partner_idx', $editorId)
|
||||
->join('partner p', 'l.partner_idx=p.idx', 'left')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
|
||||
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views, l.like_count likes, l.comment_count comments, l.*');
|
||||
}
|
||||
|
||||
public function findAll($categoryId = null)
|
||||
{
|
||||
return $this->db->from($this->table . ' l');
|
||||
}
|
||||
}
|
||||
129
application/models/web/delete___maptoon/m_maptoon.php
Executable file
129
application/models/web/delete___maptoon/m_maptoon.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?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';
|
||||
var $tb_name_ep_like ='';
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
/*
|
||||
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();
|
||||
return $row;
|
||||
}
|
||||
|
||||
/*
|
||||
return episode data by maptoon id and idx
|
||||
@param array (mt_idx, episode_idx)
|
||||
@return array or FALSE
|
||||
*/
|
||||
public function get_episode_by_mt_idx_episode_idx($arr){
|
||||
$query = $this->db->get_where($this->tb_name_episode,$arr);
|
||||
$result= $query -> row();
|
||||
$data = (array)$result;
|
||||
if(count($data)==0){
|
||||
return false;
|
||||
}else{
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
return num of episodes by maptoon idx
|
||||
@param (numeric) idx of mt_list table
|
||||
@return (numeric)
|
||||
*/
|
||||
public function get_display_episodes($req_data) {
|
||||
$mt_idx = $req_data['idx'];
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$this->db->limit($limit, $offset);
|
||||
$_where=['mt_list_idx' => $mt_idx,
|
||||
'is_display' => 1,
|
||||
'DATE(display_date)<=' => date("Y-m-d H:i:s")];
|
||||
$this->db->order_by("idx","DESC");
|
||||
$query = $this->db->get_where($this->tb_name_episode,$_where);
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/*
|
||||
return toal count of episodes by maptoon idx
|
||||
@param (numeric) idx of mt_list table
|
||||
@return (numeric)
|
||||
*/
|
||||
public function get_totalcount_episodes($mt_idx){
|
||||
$_where=['mt_list_idx' => $mt_idx,
|
||||
'is_display' => 1,
|
||||
'DATE(display_date)<=' => date("Y-m-d H:i:s")];
|
||||
|
||||
$query = $this->db->get_where($this->tb_name_episode,$_where);
|
||||
return $query->num_rows();
|
||||
}
|
||||
|
||||
/*
|
||||
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();
|
||||
}
|
||||
|
||||
/*
|
||||
find like data and insert or delete
|
||||
return String message
|
||||
*/
|
||||
public function clcik_like($req_data){
|
||||
$query = $this->db->get($this->tb_name_ep_like, $req_data);
|
||||
$num=$query->num_rows();
|
||||
$message;
|
||||
if($num==0){
|
||||
//Insert
|
||||
$this->db->insert($this->tb_name_ep_like, $req_data);
|
||||
$message="좋아하기 버튼을 클릭했습니다.";
|
||||
$state=1;
|
||||
}else{
|
||||
//Delete
|
||||
$this->db->delete($this->tb_name_ep_like, $req_data);
|
||||
$message="좋아하기를 취소했습니다.";
|
||||
$state=3;
|
||||
}
|
||||
$return_data=array('message'=>$message,'state'=>$state);
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
public function grade_($req_data){
|
||||
$mb_idx = $req_data['mb_idx'];
|
||||
$ep_idx = $req_data['ep_idx'];
|
||||
$grade = $req_data['grade'];
|
||||
}
|
||||
}
|
||||
34
application/models/web/m_advertisement.php
Executable file
34
application/models/web/m_advertisement.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_advertisement extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : life - list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function find_ad_by_page_key($req_data){
|
||||
|
||||
$page_key=$req_data;
|
||||
|
||||
$this->db->select('a.*, b.*');
|
||||
$this->db->where('a.page_key', $page_key);
|
||||
$this->db->from('ad_page as a');
|
||||
$this->db->join('ad_detail as b', 'a.idx=b.ad_idx');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
140
application/models/web/m_bbs_faq.php
Executable file
140
application/models/web/m_bbs_faq.php
Executable file
@@ -0,0 +1,140 @@
|
||||
<?
|
||||
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 : list
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
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'];
|
||||
$faq_category_code1 = $req_data['faq_category_code1'];
|
||||
$faq_category_code2 = $req_data['faq_category_code2'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') $this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
if($faq_category_code1 !='') $this->db->where('faq_category_code1', $faq_category_code1);
|
||||
if($faq_category_code2 !='') $this->db->where('faq_category_code2', $faq_category_code2);
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$faq_category_code1 = $req_data['faq_category_code1'];
|
||||
$faq_category_code2 = $req_data['faq_category_code2'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') $this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
if($faq_category_code1 !='') $this->db->where('faq_category_code1', $faq_category_code1);
|
||||
if($faq_category_code2 !='') $this->db->where('faq_category_code2', $faq_category_code2);
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_select($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : next_list
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_next_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$faq_category_code1 = $req_data['faq_category_code1'];
|
||||
$faq_category_code2 = $req_data['faq_category_code2'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') $this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
if($faq_category_code1 !='') $this->db->where('faq_category_code1', $faq_category_code1);
|
||||
if($faq_category_code2 !='') $this->db->where('faq_category_code2', $faq_category_code2);
|
||||
|
||||
$this->db->where('idx < '.$idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
function bbs_faq_other_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$faq_category_code1 = $req_data['faq_category_code1'];
|
||||
$faq_category_code2 = $req_data['faq_category_code2'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') $this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
if($faq_category_code1 !='') $this->db->where('faq_category_code1', $faq_category_code1);
|
||||
if($faq_category_code2 !='') $this->db->where('faq_category_code2', $faq_category_code2);
|
||||
|
||||
$this->db->where('idx != '.$idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
46
application/models/web/m_bbs_faq_category.php
Executable file
46
application/models/web/m_bbs_faq_category.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_bbs_faq_category extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_faq_category_all_list(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_faq_category');
|
||||
$this->db->order_by('idx', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
function bbs_faq_category_all_list_with_depth1(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('depth', 1);
|
||||
$this->db->from('bbs_faq_category');
|
||||
$this->db->order_by('idx', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
144
application/models/web/m_bbs_notice.php
Executable file
144
application/models/web/m_bbs_notice.php
Executable file
@@ -0,0 +1,144 @@
|
||||
<?
|
||||
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-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
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($search_type=='total' && $search_keyword != '') {
|
||||
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
||||
}
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if($search_type=='total' && $search_keyword != '') {
|
||||
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
||||
}
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_select($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : next_list
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_next_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
if($search_type=='total' && $search_keyword != '') {
|
||||
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
||||
}
|
||||
|
||||
$this->db->where('idx < '.$idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-07
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_notice_order_by_reg_date_limit1_select(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_notice');
|
||||
$this->db->limit(1, 0);
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function bbs_notice_new(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('reg_date > CURRENT_DATE()');
|
||||
$this->db->from('bbs_notice');
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
239
application/models/web/m_bbs_question.php
Executable file
239
application/models/web/m_bbs_question.php
Executable 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 : list
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_where_member_id_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') {
|
||||
if($search_type=='total') {
|
||||
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
||||
} else {
|
||||
$this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('bbs_question');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('p_idx', 'desc');
|
||||
$this->db->order_by('s_idx', 'asc');
|
||||
$res = $this->db->get();
|
||||
// echo $this->db->last_query();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_where_member_id_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') {
|
||||
if($search_type=='total') {
|
||||
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
||||
} else {
|
||||
$this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->from('bbs_question');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : max idx
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_max_idx_select(){
|
||||
# request
|
||||
$this->db->select('max(idx) as max_idx');
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_insert($req_data){
|
||||
|
||||
$row = $this->db->insert('bbs_question', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : write_id and idx count
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_write_id_idx_count($req_data){
|
||||
# request
|
||||
$write_id = $req_data['write_id'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('write_id', $write_id);
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('bbs_question');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : is_del update batch
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_is_del_update_batch($req_data){
|
||||
$row = $this->db->update_batch('bbs_question', $req_data, 'idx');
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : is_del update batch
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_p_idx_is_del_update_batch($req_data){
|
||||
|
||||
$row = $this->db->update_batch('bbs_question', $req_data, 'p_idx');
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : write_id and idx select
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_write_id_idx_select($req_data){
|
||||
# request
|
||||
$write_id = $req_data['write_id'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('write_id', $write_id);
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : member_id and idx select
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_member_id_idx_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('bbs_question');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : next list
|
||||
# CREATE : 2018-05-05
|
||||
#---------------------------------------------------------------------------
|
||||
function bbs_question_next_parent_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
if($search_type!='' && $search_keyword != '') {
|
||||
if($search_type=='total') {
|
||||
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
||||
} else {
|
||||
$this->db->where($search_type.' like "%'.$search_keyword.'%"');
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->where('p_idx < ', $idx);
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('s_idx', '1');
|
||||
$this->db->from('bbs_question');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('p_idx', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
44
application/models/web/m_blind_limit.php
Executable file
44
application/models/web/m_blind_limit.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?
|
||||
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 : select
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function blind_limit_where_member_id_limit_type_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$limit_type = $req_data['limit_type'];
|
||||
|
||||
$this->db->where('limit_status', '1');
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('limit_type', $limit_type);
|
||||
$this->db->from('blind_limit');
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
193
application/models/web/m_bookmark.php
Executable file
193
application/models/web/m_bookmark.php
Executable file
@@ -0,0 +1,193 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_bookmark extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_member_id_content_idx_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->from('bookmark');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_member_id_content_idx_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->from('bookmark');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : delete
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_delete($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->delete('bookmark');
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('bookmark', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_content_type_content_idx_count($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->from('bookmark');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-04
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_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'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
if($search_type=='total' && $search_keyword!='') {
|
||||
$this->db->where('b.content like "%'.$search_keyword.'%"');
|
||||
$this->db->where('b.title like "%'.$search_keyword.'%"');
|
||||
}
|
||||
|
||||
$this->db->select('b.*, a.idx as bookmark_idx, a.reg_date as bookmark_date');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->from('bookmark 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('a.reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_join_vw_content_list_total_count($req_data){
|
||||
# request
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
if($search_type=='total' && $search_keyword!='') {
|
||||
$this->db->where('b.content like "%'.$search_keyword.'%"');
|
||||
$this->db->where('b.title like "%'.$search_keyword.'%"');
|
||||
}
|
||||
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->from('bookmark as a');
|
||||
$this->db->join('vw_content as b', 'a.content_idx=b.idx and a.content_type=b.content_type');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function bookmark_member_id_idx_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$idx = $req_data['idx'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('bookmark');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
78
application/models/web/m_category.php
Executable file
78
application/models/web/m_category.php
Executable file
@@ -0,0 +1,78 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_category extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function category_all_list(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('category');
|
||||
$this->db->order_by('display_sort', 'asc');
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function category_list_total_count(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('category');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function category_select($idx){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('category');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
93
application/models/web/m_channel.php
Executable file
93
application/models/web/m_channel.php
Executable file
@@ -0,0 +1,93 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_channel extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function channel_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('channel');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by($sort_column, 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function channel_list_total_count(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('channel');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function channel_select($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('channel');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : join category select
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function channel_join_category_select($idx){
|
||||
|
||||
$this->db->select('a.*, b.category_name');
|
||||
$this->db->where('a.idx', $idx);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->from('channel as a');
|
||||
$this->db->join('category as b', 'a.category_idx=b.idx');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
35
application/models/web/m_ci_sessions.php
Executable file
35
application/models/web/m_ci_sessions.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_ci_sessions extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function ci_sessions_select($id){
|
||||
|
||||
|
||||
$this->db->where('id', $id);
|
||||
$this->db->from('ci_sessions');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
230
application/models/web/m_column.php
Executable file
230
application/models/web/m_column.php
Executable file
@@ -0,0 +1,230 @@
|
||||
<?
|
||||
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 : list
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_list($req_data)
|
||||
{
|
||||
// request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
$search_type = '';
|
||||
$search_key = '';
|
||||
$search_keyword = '';
|
||||
if (isset($req_data['search_type']) == true)
|
||||
$search_type = $req_data['search_type'];
|
||||
if (isset($req_data['search_key']) == true)
|
||||
$search_key = $req_data['search_key'];
|
||||
if (isset($req_data['search_keyword']) == true)
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if ($search_type != '' && $search_key != '')
|
||||
$this->db->where($search_type, $search_key);
|
||||
|
||||
if ($search_type == 'main_search' && $search_keyword != '') {
|
||||
$keywordAsteriskRemoved = str_replace('*', '', $search_keyword);
|
||||
$this->db->group_start()
|
||||
->like('title', $keywordAsteriskRemoved)
|
||||
// ->or_like('content', $keywordAsteriskRemoved)
|
||||
// ->or_like('tag', $keywordAsteriskRemoved)
|
||||
->group_end();
|
||||
|
||||
// $this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
}
|
||||
|
||||
if ($search_type == 'main_search_and_video_url' && $search_keyword != '') {
|
||||
$this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
$this->db->where('video_url!=', '');
|
||||
}
|
||||
|
||||
$this->db->select('*, "2" as content_type, column_name as category_name');
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('column');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by($sort_column, 'desc');
|
||||
$this->db->order_by('display_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : list - total count
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_list_total_count($req_data)
|
||||
{
|
||||
if (isset($req_data['search_type']) == false)
|
||||
$req_data['search_type'] = '';
|
||||
if (isset($req_data['search_key']) == false)
|
||||
$req_data['search_key'] = '';
|
||||
if (isset($req_data['search_keyword']) == false)
|
||||
$req_data['search_keyword'] = '';
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_key = $req_data['search_key'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
if ($search_type == 'main_search' && $search_keyword != '')
|
||||
$this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
if ($search_type != '' && $search_key != '')
|
||||
$this->db->where($search_type, $search_key);
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('column');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : total count
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_total_count()
|
||||
{
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('column');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : select idx
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_select($idx)
|
||||
{
|
||||
$this->db->select('*, column_name as category_name');
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('column');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : hit +1 update
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_hit_count_update($idx)
|
||||
{
|
||||
$sql = "update `column`
|
||||
set hit_count = hit_count + 1
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : update
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_share_count_update($req_data)
|
||||
{
|
||||
// request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update `column`
|
||||
set share_count = share_count + " . $value . "
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : update
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_like_count_update($req_data)
|
||||
{
|
||||
// request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update `column`
|
||||
set like_count = like_count + " . $value . "
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : where now_date
|
||||
// CREATE : 2018-05-08
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_where_display_date_count($req_data)
|
||||
{
|
||||
// request
|
||||
$reg_date = $req_data;
|
||||
|
||||
$this->db->where('display_date >=', $reg_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('column');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : comment_count +1 update
|
||||
// CREATE : 2018-05-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_comment_count_update($idx)
|
||||
{
|
||||
$sql = "update `column`
|
||||
set comment_count = comment_count + 1
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : where now_date + partner_idx
|
||||
// CREATE : 2018-05-30
|
||||
// ---------------------------------------------------------------------------
|
||||
function column_where_display_date_partner_idx_count($req_data)
|
||||
{
|
||||
// request
|
||||
$partner_idx = $req_data['partner_idx'];
|
||||
$now_date = $req_data['now_date'];
|
||||
|
||||
$this->db->where('partner_idx', $partner_idx);
|
||||
$this->db->where('display_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('column');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
?>
|
||||
388
application/models/web/m_comment.php
Executable file
388
application/models/web/m_comment.php
Executable file
@@ -0,0 +1,388 @@
|
||||
<?
|
||||
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
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_parent_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$sort_type = $req_data['sort_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
|
||||
$this->db->select('a.*, (select count(*) from comment where p_idx=a.idx and idx!=a.idx) as reply_count');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.content_idx', $content_idx);
|
||||
$this->db->where('a.s_idx', '1');
|
||||
$this->db->from('comment as a');
|
||||
$this->db->join('member as m', 'a.write_id=m.member_id', 'left');
|
||||
$this->db->select('m.member_nickname, m.member_id');
|
||||
$query = $this->db->get_compiled_select();
|
||||
|
||||
$this->db->from('('.$query.') as b');
|
||||
$this->db->order_by('b.is_best', 'Desc');
|
||||
$this->db->order_by('b.'.$sort_column, $sort_type);
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-20
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_child_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$sort_type = $req_data['sort_type'];
|
||||
$p_idx = $req_data['p_idx'];
|
||||
|
||||
$this->db->where('a.p_idx', $p_idx);
|
||||
$this->db->where('a.s_idx > ', '1');
|
||||
$this->db->from('comment as a');
|
||||
$this->db->join('member m', 'a.write_id=m.member_id', 'left');
|
||||
$this->db->select('a.*, m.member_nickname, m.member_id');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.'.$sort_column, $sort_type);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 글의 댓글 수
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_parent_where_content_idx_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
# request
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->where('s_idx', '1');
|
||||
$this->db->from('comment');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 글의 댓글 수
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_where_content_idx_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
# request
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->from('comment');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 글의 내가 삭제한 댓글 수
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_my_delete_where_content_idx_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
# request
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->where('write_id', $write_id);
|
||||
$this->db->where('is_del', 'Y');
|
||||
$this->db->where('comment_status', '4');
|
||||
$this->db->from('comment');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1분 전 쓴글이 있는지 확인
|
||||
# CREATE : 2018-04-27
|
||||
#--------------------------------------------------------------------------
|
||||
function comment_where_reg_date_count($req_data){
|
||||
# request
|
||||
$write_id = $req_data['write_id'];
|
||||
$comment_sns_type = $req_data['comment_sns_type'];
|
||||
$reg_date = $req_data['reg_date'];
|
||||
|
||||
|
||||
# request
|
||||
$this->db->where('sns_name', $comment_sns_type);
|
||||
$this->db->where('write_id', $write_id);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('reg_date >=', $reg_date);
|
||||
$this->db->from('comment');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : max idx
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_max_idx_select(){
|
||||
|
||||
|
||||
# request
|
||||
$this->db->select('max(idx) + 1 as max_idx');
|
||||
$this->db->from('comment');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : max s_idx
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_max_s_idx_select($idx){
|
||||
|
||||
# request
|
||||
$this->db->select('max(s_idx) + 1 as max_s_idx');
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('comment');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_insert($req_data){
|
||||
|
||||
$row = $this->db->insert('comment', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_select($idx){
|
||||
|
||||
# request
|
||||
$this->db->select('*, (select count(*) from comment where p_idx=a.idx and idx!=a.idx) as reply_count');
|
||||
$this->db->where('a.idx', $idx);
|
||||
$this->db->from('comment as a');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 대댓글수
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_where_p_idx_count($p_idx){
|
||||
|
||||
# request
|
||||
$this->db->where('p_idx', $p_idx);
|
||||
$this->db->where('idx!=', $p_idx);
|
||||
$this->db->from('comment');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comemnt_like_bad_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$type_name = $req_data['type_name'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update comment
|
||||
set ".$type_name." = ".$type_name." + ".$value."
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-08
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_join_vw_content_where_write_id_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$sort_type = $req_data['sort_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
|
||||
|
||||
$this->db->select('a.*, (select count(*) from comment where p_idx=a.idx and idx!=a.idx) as reply_count, b.title, b.main_img, b.column_name');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.write_id', $write_id);
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->from('comment as a');
|
||||
$this->db->join('vw_content as b', 'a.content_type=b.content_type and a.content_idx=b.idx');
|
||||
$query = $this->db->get_compiled_select();
|
||||
|
||||
$this->db->from('('.$query.') as c');
|
||||
if($sort_column == 'reply_count') {
|
||||
$this->db->order_by('c.s_idx', 'asc');
|
||||
$this->db->order_by('c.'.$sort_column, $sort_type);
|
||||
} else {
|
||||
$this->db->order_by('c.is_best', 'desc');
|
||||
$this->db->order_by('c.'.$sort_column, $sort_type);
|
||||
}
|
||||
$this->db->limit($limit, $offset);
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : user_comment count
|
||||
# CREATE : 2018-05-08
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_join_vw_content_where_write_id_list_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
# request
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.write_id', $write_id);
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->from('comment as a');
|
||||
$this->db->join('vw_content as b', 'a.content_type=b.content_type and a.content_idx=b.idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 내글 인지 확인
|
||||
# CREATE : 2018-05-09
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_member_id_idx_count($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
# request
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('write_id', $write_id);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('comment');
|
||||
$row = $this->db->count_all_results();
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 내글 인지 확인
|
||||
# CREATE : 2018-05-09
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_member_id_idx_select($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
# request
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('write_id', $write_id);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('comment');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : is_del update
|
||||
# CREATE : 2018-05-09
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_is_del_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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
64
application/models/web/m_comment_like_log.php
Executable file
64
application/models/web/m_comment_like_log.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_comment_like_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_like_log_where_member_id_comment_idx_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$comment_idx = $req_data['comment_idx'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('comment_idx', $comment_idx);
|
||||
$this->db->from('comment_like_log');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : delete
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_like_log_delete($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->delete('comment_like_log');
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_like_log_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('comment_like_log', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
37
application/models/web/m_comment_setting.php
Executable file
37
application/models/web/m_comment_setting.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?
|
||||
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 : 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
32
application/models/web/m_comment_social_member_log.php
Executable file
32
application/models/web/m_comment_social_member_log.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_comment_social_member_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
function comment_social_member_log_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('comment_social_member_log', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
39
application/models/web/m_contents_setting.php
Executable file
39
application/models/web/m_contents_setting.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?
|
||||
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 : 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
284
application/models/web/m_delivery.php
Executable file
284
application/models/web/m_delivery.php
Executable file
@@ -0,0 +1,284 @@
|
||||
<?
|
||||
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 : select
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_where_member_id_main_idx_select($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$main_idx = $req_data['main_idx'];
|
||||
|
||||
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('main_idx', $main_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('delivery');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
unset($req_data['idx']);
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('delivery', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_insert($req_data){
|
||||
|
||||
$row = $this->db->insert('delivery', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_where_main_idx_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$main_idx = $req_data['main_idx'];
|
||||
|
||||
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('main_idx', $main_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('delivery');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_join_channel_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->select('a.*, b.channel_icon, b.channel_name, (select count(*) from life where is_del="N" and is_display="Y" and channel_idx=a.main_idx) as article_count, (select count(*) from delivery where is_del="N" and content_type=a.content_type and main_idx=a.main_idx) as delivery_count');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->from('delivery as a');
|
||||
$this->db->join('channel as b', 'a.main_idx=b.idx');
|
||||
$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
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_join_channel_list_total_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->from('delivery as a');
|
||||
$this->db->join('channel as b', 'a.main_idx=b.idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_member_id_idx_count($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('is_del', 'N');;
|
||||
$this->db->from('delivery');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : is_del update
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_is_del_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
unset($req_data['idx']);
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('delivery', $req_data);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-08
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_join_partner_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->select('a.*, b.partner_img, b.partner_name, (select count(*) from `column` where is_del="N" and is_display="Y" and partner_idx=a.main_idx) as article_count, (select count(*) from delivery where is_del="N" and content_type=a.content_type and main_idx=a.main_idx) as delivery_count');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->from('delivery as a');
|
||||
$this->db->join('partner as b', 'a.main_idx=b.idx');
|
||||
$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
|
||||
# CREATE : 2018-05-08
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_join_partner_list_total_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->from('delivery as a');
|
||||
$this->db->join('partner as b', 'a.main_idx=b.idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-11
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_join_tag_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->select('max(a.idx) as idx, a.main_idx, max(a.content_type) as content_type, max(a.reg_date) as reg_date');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('c.is_display', 'Y');
|
||||
$this->db->where('b.content_type', '3');
|
||||
$this->db->from('delivery as a');
|
||||
$this->db->join('tag as b', 'a.main_idx=b.tag');
|
||||
$this->db->join('life as c', 'b.content_idx=c.idx');
|
||||
$this->db->group_by('b.tag');
|
||||
$query = $this->db->get_compiled_select();
|
||||
|
||||
|
||||
|
||||
$this->db->select('d.*, (select count(*) from delivery where is_del="N" and content_type=d.content_type and main_idx=d.main_idx) as delivery_count');
|
||||
$this->db->from('('.$query.') as d');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('d.reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-05-11
|
||||
#---------------------------------------------------------------------------
|
||||
function delivery_join_tag_list_total_count($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->select('a.main_idx');
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('c.is_display', 'Y');
|
||||
$this->db->where('b.content_type', '3');
|
||||
$this->db->from('delivery as a');
|
||||
$this->db->join('tag as b', 'a.main_idx=b.tag');
|
||||
$this->db->join('life as c', 'b.content_idx=c.idx');
|
||||
$this->db->group_by('b.tag');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
66
application/models/web/m_etc_section.php
Executable file
66
application/models/web/m_etc_section.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?
|
||||
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 : where theme_type select
|
||||
# CREATE : 2018-04-09
|
||||
#---------------------------------------------------------------------------
|
||||
function etc_section_where_theme_type_list($etc_section_type){
|
||||
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.etc_section_type', $etc_section_type);
|
||||
$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');
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where in etc_section_type list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function etc_section_where_in_etc_section_type_list($req_data){
|
||||
# request
|
||||
$etc_section_types = $req_data['etc_section_types'];
|
||||
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->where_in('a.etc_section_type', $etc_section_types);
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
66
application/models/web/m_forbidden_word.php
Executable file
66
application/models/web/m_forbidden_word.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_forbidden_word extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 금칙어 count
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
function forbidden_word_where_word_count($word){
|
||||
|
||||
$this->db->where('word', $word);
|
||||
$this->db->from('forbidden_word');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 금칙어 list
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
function forbidden_word_list(){
|
||||
|
||||
$this->db->from('forbidden_word');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
53
application/models/web/m_hit_log.php
Executable file
53
application/models/web/m_hit_log.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_hit_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
function hit_log_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('hit_log', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 1시간전에 글을 읽었는지 확인
|
||||
# CREATE : 2018-04-27
|
||||
#--------------------------------------------------------------------------
|
||||
function hit_log_where_member_id_content_idx_count($req_data){
|
||||
# request
|
||||
$reg_date = $req_data['reg_date'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
$member_id = $req_data['member_id'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->where('reg_date >=', $reg_date);
|
||||
$this->db->from('hit_log');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
350
application/models/web/m_life.php
Executable file
350
application/models/web/m_life.php
Executable file
@@ -0,0 +1,350 @@
|
||||
<?
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class m_life extends CI_Model
|
||||
{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : life - list
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_list($req_data)
|
||||
{
|
||||
// request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
$start_date = '';
|
||||
$end_date = '';
|
||||
$search_type = '';
|
||||
$search_key = '';
|
||||
$search_keyword = '';
|
||||
if (isset($req_data['start_date']) == true)
|
||||
$start_date = $req_data['start_date'];
|
||||
if (isset($req_data['end_date']) == true)
|
||||
$end_date = $req_data['end_date'];
|
||||
if (isset($req_data['search_type']) == true)
|
||||
$search_type = $req_data['search_type'];
|
||||
if (isset($req_data['search_key']) == true)
|
||||
$search_key = $req_data['search_key'];
|
||||
if (isset($req_data['search_keyword']) == true)
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if ($search_type == 'main_search' && $search_keyword != '') {
|
||||
$keywordAsteriskRemoved = str_replace('*', '', $search_keyword);
|
||||
$this->db->group_start()
|
||||
->like('a.title', $keywordAsteriskRemoved)
|
||||
// ->or_like('a.content', $keywordAsteriskRemoved)
|
||||
// ->or_like('a.tag', $keywordAsteriskRemoved)
|
||||
->group_end();
|
||||
|
||||
// $this->db->where("match(a.title, a.content, a.tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
}
|
||||
if ($search_type == 'main_search_and_video_url' && $search_keyword != '') {
|
||||
$this->db->where("match(a.title, a.content, a.tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
$this->db->where('a.video_url!=', '');
|
||||
}
|
||||
if ($search_type != '' && $search_key != '')
|
||||
$this->db->where('a.' . $search_type, $search_key);
|
||||
if ($start_date != '')
|
||||
$this->db->where('a.display_date >=', $start_date);
|
||||
if ($end_date != '')
|
||||
$this->db->where('a.display_date <=', $end_date);
|
||||
|
||||
$this->db->select('a.*, "3" as content_type, b.partner_img, (select category_name from category where a.category_idx = idx) as category_name');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
// 크맵TV, 기도공감, 성경지식인, 자료실, 라이프에 연결된 채널이 은혜에서 안 보이게 설정
|
||||
|
||||
// $this->db->where_not_in('a.channel_idx', array(8 ,51, 42, 43, 44, 45, 49, 18, 46, 47, 50));
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->from('life as a');
|
||||
$this->db->join('partner as b', 'a.partner_idx=b.idx');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.' . $sort_column, 'desc');
|
||||
$this->db->order_by('a.display_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
// echo $this->db->last_query();
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : life - list - total count
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_list_total_count($req_data)
|
||||
{
|
||||
$start_date = '';
|
||||
$end_date = '';
|
||||
$search_type = '';
|
||||
$search_key = '';
|
||||
if (isset($req_data['start_date']) == true)
|
||||
$start_date = $req_data['start_date'];
|
||||
if (isset($req_data['end_date']) == true)
|
||||
$end_date = $req_data['end_date'];
|
||||
if (isset($req_data['search_type']) == true)
|
||||
$search_type = $req_data['search_type'];
|
||||
if (isset($req_data['search_key']) == true)
|
||||
$search_key = $req_data['search_key'];
|
||||
if (isset($req_data['search_keyword']) == true)
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if ($start_date != '')
|
||||
$this->db->where('display_date >=', $start_date);
|
||||
if ($end_date != '')
|
||||
$this->db->where('display_date <=', $end_date);
|
||||
if ($search_type != '' && $search_key != '')
|
||||
$this->db->where($search_type, $search_key);
|
||||
if ($search_type == 'main_search' && $search_keyword != '')
|
||||
$this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$this->db->where_not_in('channel_idx', array(
|
||||
8,
|
||||
51,
|
||||
42,
|
||||
43,
|
||||
44,
|
||||
45,
|
||||
49,
|
||||
18,
|
||||
46,
|
||||
47,
|
||||
50
|
||||
));
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : join select
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_join_editor_category_channel_select($idx)
|
||||
{
|
||||
$this->db->select('a.*, b.partner_img, c.category_name, d.channel_name, d.main_img as channel_main_img');
|
||||
$this->db->where('a.idx', $idx);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->from('life as a');
|
||||
$this->db->join('partner as b', 'a.partner_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');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : prev select
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_prev_select($idx)
|
||||
{
|
||||
$this->db->where('idx <', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$this->db->order_by('display_date', 'desc');
|
||||
$this->db->limit(1);
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : next select
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_next_select($idx)
|
||||
{
|
||||
$this->db->where('idx >', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->order_by('display_date', 'asc');
|
||||
$this->db->from('life');
|
||||
$this->db->limit(1);
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : update
|
||||
// CREATE : 2018-04-17
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_like_count_update($req_data)
|
||||
{
|
||||
// request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update life
|
||||
set like_count = like_count + " . $value . "
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : select
|
||||
// CREATE : 2018-04-17
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_select($idx)
|
||||
{
|
||||
$this->db->select('*, (select category_name from category where life.category_idx = idx) as category_name');
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : select
|
||||
// CREATE : 2018-04-17
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_select_idx($idx)
|
||||
{
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : hit +1 update
|
||||
// CREATE : 2018-04-26
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_hit_count_update($idx)
|
||||
{
|
||||
$sql = "update life
|
||||
set hit_count = hit_count + 1
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : update
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_share_count_update($req_data)
|
||||
{
|
||||
// request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update life
|
||||
set share_count = share_count + " . $value . "
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : life where channel_idx
|
||||
// CREATE : 2018-05-07
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_where_channel_idx_list_limit1($req_data)
|
||||
{
|
||||
// request
|
||||
$channel_idx = $req_data['channel_idx'];
|
||||
|
||||
$this->db->where('channel_idx', $channel_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$this->db->limit(1, 0);
|
||||
$this->db->order_by('display_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : life where now_date
|
||||
// CREATE : 2018-05-07
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_where_display_date_count($req_data)
|
||||
{
|
||||
// request
|
||||
$reg_date = $req_data;
|
||||
|
||||
$this->db->where('display_date >=', $reg_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : comment_count +1 update
|
||||
// CREATE : 2018-05-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_comment_count_update($idx)
|
||||
{
|
||||
$sql = "update life
|
||||
set comment_count = comment_count + 1
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : life where now_date + channle_idx
|
||||
// CREATE : 2018-05-30
|
||||
// ---------------------------------------------------------------------------
|
||||
function life_where_display_date_channel_idx_count($req_data)
|
||||
{
|
||||
// request
|
||||
$now_date = $req_data['now_date'];
|
||||
$channel_idx = $req_data['channel_idx'];
|
||||
|
||||
$this->db->where('channel_idx', $channel_idx);
|
||||
$this->db->where('display_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
326
application/models/web/m_life_backup190307.php
Executable file
326
application/models/web/m_life_backup190307.php
Executable file
@@ -0,0 +1,326 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_life extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : life - list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function life_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
$start_date = ''; $end_date = ''; $search_type =''; $search_key = ''; $search_keyword = '';
|
||||
if(isset($req_data['start_date']) == true) $start_date = $req_data['start_date'];
|
||||
if(isset($req_data['end_date']) == true) $end_date = $req_data['end_date'];
|
||||
if(isset($req_data['search_type']) == true) $search_type = $req_data['search_type'];
|
||||
if(isset($req_data['search_key']) == true) $search_key = $req_data['search_key'];
|
||||
if(isset($req_data['search_keyword']) == true) $search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if($search_type == 'main_search' && $search_keyword!='') $this->db->where("match(a.title, a.content, a.tag) against('".$search_keyword."' in boolean mode)");
|
||||
if($search_type == 'main_search_and_video_url' && $search_keyword!='') {
|
||||
$this->db->where("match(a.title, a.content, a.tag) against('".$search_keyword."' in boolean mode)");
|
||||
$this->db->where('a.video_url!=', '');
|
||||
}
|
||||
if($search_type != '' && $search_key!='') $this->db->where('a.'.$search_type, $search_key);
|
||||
if($start_date != '') $this->db->where('a.display_date >=', $start_date);
|
||||
if($end_date != '') $this->db->where('a.display_date <=', $end_date);
|
||||
|
||||
$this->db->select('a.*, "3" as content_type, b.partner_img, (select category_name from category where a.category_idx = idx) as category_name');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->from('life as a');
|
||||
$this->db->join('partner as b', 'a.partner_idx=b.idx');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.'.$sort_column, 'desc');
|
||||
$this->db->order_by('a.display_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : life - list - total count
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function life_list_total_count($req_data){
|
||||
|
||||
$start_date = ''; $end_date = ''; $search_type =''; $search_key = '';
|
||||
if(isset($req_data['start_date']) == true) $start_date = $req_data['start_date'];
|
||||
if(isset($req_data['end_date']) == true) $end_date = $req_data['end_date'];
|
||||
if(isset($req_data['search_type']) == true) $search_type = $req_data['search_type'];
|
||||
if(isset($req_data['search_key']) == true) $search_key = $req_data['search_key'];
|
||||
if(isset($req_data['search_keyword']) == true) $search_keyword = $req_data['search_keyword'];
|
||||
|
||||
|
||||
if($start_date != '') $this->db->where('display_date >=', $start_date);
|
||||
if($end_date != '') $this->db->where('display_date <=', $end_date);
|
||||
if($search_type != '' && $search_key!='') $this->db->where($search_type, $search_key);
|
||||
if($search_type == 'main_search' && $search_keyword!='') $this->db->where("match(title, content, tag) against('".$search_keyword."' in boolean mode)");
|
||||
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : join select
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function life_join_editor_category_channel_select($idx){
|
||||
|
||||
$this->db->select('a.*, b.partner_img, c.category_name, d.channel_name, d.main_img as channel_main_img');
|
||||
$this->db->where('a.idx', $idx);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->from('life as a');
|
||||
$this->db->join('partner as b', 'a.partner_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');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : prev select
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function life_prev_select($idx){
|
||||
|
||||
$this->db->where('idx <', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$this->db->order_by('display_date', 'desc');
|
||||
$this->db->limit(1);
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : next select
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function life_next_select($idx){
|
||||
|
||||
$this->db->where('idx >', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->order_by('display_date', 'asc');
|
||||
$this->db->from('life');
|
||||
$this->db->limit(1);
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function life_like_count_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update life
|
||||
set like_count = like_count + ".$value."
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function life_select($idx){
|
||||
|
||||
$this->db->select('*, (select category_name from category where life.category_idx = idx) as category_name');
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function life_select_idx($idx){
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : hit +1 update
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
function life_hit_count_update($idx){
|
||||
|
||||
$sql = "update life
|
||||
set hit_count = hit_count + 1
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function life_share_count_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update life
|
||||
set share_count = share_count + ".$value."
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : life where channel_idx
|
||||
# CREATE : 2018-05-07
|
||||
#---------------------------------------------------------------------------
|
||||
function life_where_channel_idx_list_limit1($req_data){
|
||||
# request
|
||||
$channel_idx = $req_data['channel_idx'];
|
||||
|
||||
$this->db->where('channel_idx', $channel_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$this->db->limit(1, 0);
|
||||
$this->db->order_by('display_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : life where now_date
|
||||
# CREATE : 2018-05-07
|
||||
#---------------------------------------------------------------------------
|
||||
function life_where_display_date_count($req_data){
|
||||
# request
|
||||
$reg_date = $req_data;
|
||||
|
||||
$this->db->where('display_date >=', $reg_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : comment_count +1 update
|
||||
# CREATE : 2018-05-11
|
||||
#---------------------------------------------------------------------------
|
||||
function life_comment_count_update($idx){
|
||||
|
||||
$sql = "update life
|
||||
set comment_count = comment_count + 1
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : life where now_date + channle_idx
|
||||
# CREATE : 2018-05-30
|
||||
#---------------------------------------------------------------------------
|
||||
function life_where_display_date_channel_idx_count($req_data){
|
||||
# request
|
||||
$now_date = $req_data['now_date'];
|
||||
$channel_idx = $req_data['channel_idx'];
|
||||
|
||||
$this->db->where('channel_idx', $channel_idx);
|
||||
$this->db->where('display_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('life');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
270
application/models/web/m_life_etc_section.php
Executable file
270
application/models/web/m_life_etc_section.php
Executable file
@@ -0,0 +1,270 @@
|
||||
<?
|
||||
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 : join detail join category join channel
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function life_etc_section_join_detail_join_category_join_channel_list($etc_section_type){
|
||||
|
||||
$this->db->select('a.*, b.main_img, b.head_title, b.title, b.content_idx, b.rank, d.channel_name, e.editor_name');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
$this->db->where('e.is_del', 'N');
|
||||
$this->db->where('e.is_display', 'Y');
|
||||
$this->db->where('etc_section_type', $etc_section_type);
|
||||
$this->db->from('life_etc_section as a');
|
||||
$this->db->join('life_etc_section_detail as b', 'a.idx = b.life_etc_section_idx');
|
||||
$this->db->join('channel as d', 'd.idx = a.channel_idx');
|
||||
$this->db->join('life as e', 'e.idx = a.content_idx');
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$this->db->order_by('b.rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : join channel
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function life_etc_section_join_channel_list($etc_section_type){
|
||||
|
||||
$this->db->select('a.*, d.channel_name, d.channel_icon, (select count(*) from life where channel_idx=a.channel_idx and is_del = "N" and is_display = "Y") as channel_article_count, (select count(*) from delivery where content_type = "3" and main_idx = a.channel_idx and is_del = "N") as delivery_count');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('d.is_del', 'N');
|
||||
if(is_array($etc_section_type))
|
||||
$this->db->where_in('etc_section_type', $etc_section_type);
|
||||
else
|
||||
$this->db->where('etc_section_type', $etc_section_type);
|
||||
$this->db->from('life_etc_section as a');
|
||||
$this->db->join('channel as d', 'd.idx = a.channel_idx');
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : detail join life
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function life_etc_section_detail_join_life_list($etc_section_type){
|
||||
|
||||
$this->db->select('a.*, b.partner_idx, b.editor_name');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.etc_section_type', $etc_section_type);
|
||||
$this->db->from('life_etc_section_detail as a');
|
||||
$this->db->join('life as b', 'b.idx = a.content_idx');
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# 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 : 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, b.partner_idx, b.video_url, b.video_playtime');
|
||||
$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');
|
||||
$this->db->order_by('rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
// echo $this->db->last_query();
|
||||
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();
|
||||
// echo $this->db->last_query();
|
||||
$row = $res->result_array();
|
||||
|
||||
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.*, d.partner_intro,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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
66
application/models/web/m_like_log.php
Executable file
66
application/models/web/m_like_log.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_like_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function like_log_where_member_id_content_idx_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('content_idx', $content_idx);
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->from('like_log');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : delete
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function like_log_delete($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->delete('like_log');
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function like_log_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('like_log', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
30
application/models/web/m_main_category_company.php
Executable file
30
application/models/web/m_main_category_company.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_main_category_company extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : all list
|
||||
# CREATE : 2018-04-10
|
||||
#---------------------------------------------------------------------------
|
||||
function main_category_company_all_list(){
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_direct', 'Y');
|
||||
$this->db->from('main_category_company');
|
||||
$this->db->order_by('display_sort', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
395
application/models/web/m_member.php
Executable file
395
application/models/web/m_member.php
Executable file
@@ -0,0 +1,395 @@
|
||||
<?
|
||||
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 : where member_id count
|
||||
# CREATE : 2018-04-04
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_count($member_id){
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->from('member');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : join member_group where member_id_member_pwd_select
|
||||
# CREATE : 2018-04-04
|
||||
#---------------------------------------------------------------------------
|
||||
function member_join_member_group_where_member_id_member_pwd_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_pwd = $req_data['member_pwd'];
|
||||
|
||||
$this->db->select('a.*, b.member_group_name');
|
||||
$this->db->where('a.member_id', $member_id);
|
||||
$this->db->where('a.member_pwd', MD5($member_pwd));
|
||||
$this->db->where('a.member_status', '1');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.member_group_status', '1');
|
||||
$this->db->from('member as a');
|
||||
$this->db->join('member_group as b', 'a.member_group_idx=b.idx');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-04-04
|
||||
#---------------------------------------------------------------------------
|
||||
function member_update($req_data){
|
||||
# request
|
||||
$idx = $req_data['idx'];
|
||||
unset($req_data['idx']);
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$row = $this->db->update('member', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where email count
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_email_count($member_email){
|
||||
|
||||
$this->db->where('member_email', $member_email);
|
||||
$this->db->from('member');
|
||||
$this->db->where('member_status', '1');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where email + name count
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_email_name_count($req_data){
|
||||
# request
|
||||
$member_name = $req_data['member_name'];
|
||||
$member_email = $req_data['member_email'];
|
||||
|
||||
$this->db->where('member_name', $member_name);
|
||||
$this->db->where('member_email', $member_email);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where email + name select
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_email_name_select_limit1($req_data){
|
||||
# request
|
||||
$member_name = $req_data['member_name'];
|
||||
$member_email = $req_data['member_email'];
|
||||
|
||||
$this->db->where('member_name', $member_name);
|
||||
$this->db->where('member_email', $member_email);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$this->db->order_by('reg_date', 'DESC');
|
||||
$this->db->limit(1, 0);
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_insert($req_data){
|
||||
$this->db->insert('member', $req_data);
|
||||
$row = $this->db->insert_id();
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where sns_id select
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_sns_id_select($req_data){
|
||||
# request
|
||||
$sns_type = $req_data['sns_type'];
|
||||
$sns_id = $req_data['sns_id'];
|
||||
|
||||
$this->db->where('sns_type', $sns_type);
|
||||
$this->db->where('sns_id', $sns_id);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where member_id select
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_select($member_id){
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where nickname count
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_nickname_count($member_nickname){
|
||||
|
||||
$this->db->where('member_nickname', $member_nickname);
|
||||
$this->db->from('member');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where member_id, email count
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_email_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_email = $req_data['member_email'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_email', $member_email);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where member_id, email select
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_email_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_email = $req_data['member_email'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_email', $member_email);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update where member_id
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_update($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
unset($req_data['member_id']);
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$row = $this->db->update('member', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where member_id count
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_member_pwd_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_pwd = $req_data['member_pwd'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_pwd', $member_pwd);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where member_id count
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_member_id_member_pwd_select($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_pwd = $req_data['member_pwd'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_pwd', $member_pwd);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function member_visit_count_last_login_update($idx){
|
||||
|
||||
$sql = "update member
|
||||
set last_login_date = now()
|
||||
, visit_count = visit_count + 1
|
||||
where idx= ".$idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where mobile_CI select
|
||||
# CREATE : 2018-05-30
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_mobile_CI_select($mobile_CI){
|
||||
|
||||
$this->db->where('mobile_CI', $mobile_CI);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where mobile_CI count
|
||||
# CREATE : 2018-05-30
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_mobile_CI_member_id_count($req_data){
|
||||
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$CI = $req_data['CI'];
|
||||
|
||||
$this->db->where('mobile_CI', $CI);
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : where parent_CI select
|
||||
# CREATE : 2018-06-08
|
||||
#---------------------------------------------------------------------------
|
||||
function member_where_parent_CI_select($parent_CI){
|
||||
|
||||
$this->db->where('parent_CI', $parent_CI);
|
||||
$this->db->where('member_status', '1');
|
||||
$this->db->from('member');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
34
application/models/web/m_member_group.php
Executable file
34
application/models/web/m_member_group.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?
|
||||
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 : select
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_group_select($idx){
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->from('member_group');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
34
application/models/web/m_member_group_menu_auth.php
Executable file
34
application/models/web/m_member_group_menu_auth.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_member_group_menu_auth extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function member_group_menu_auth_count($req_data){
|
||||
# request
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
$menu_code = $req_data['menu_code'];
|
||||
|
||||
$this->db->where('member_group_idx', $member_group_idx);
|
||||
$this->db->where('menu_code', $menu_code);
|
||||
$this->db->where('menu_auth_status', '2');
|
||||
$this->db->from('member_group_menu_auth');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
115
application/models/web/m_member_login.php
Executable file
115
application/models/web/m_member_login.php
Executable file
@@ -0,0 +1,115 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_member_login extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select idx
|
||||
# CREATE : 2018-04-16
|
||||
#---------------------------------------------------------------------------
|
||||
function member_login_member_id_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_ip = $req_data['member_ip'];
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_ip!=', $member_ip);
|
||||
$this->db->where('expire_date>=', $now_date);
|
||||
$this->db->from('member_login');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-06-26
|
||||
#---------------------------------------------------------------------------
|
||||
function member_login_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
$row = $this->db->insert('member_login', $req_data);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-06-26
|
||||
#---------------------------------------------------------------------------
|
||||
function member_login_member_id_member_ip_count($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_ip = $req_data['member_ip'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_ip', $member_ip);
|
||||
$this->db->from('member_login');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : delete
|
||||
# CREATE : 2018-06-26
|
||||
#---------------------------------------------------------------------------
|
||||
function member_login_delete($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_ip = $req_data['member_ip'];
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_ip', $member_ip);
|
||||
$row = $this->db->delete('member_login');
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : update
|
||||
# CREATE : 2018-06-26
|
||||
#---------------------------------------------------------------------------
|
||||
function member_login_member_id_member_ip_update($req_data){
|
||||
# request
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_ip = $req_data['member_ip'];
|
||||
$expire_date = $req_data['expire_date'];
|
||||
|
||||
$update_data['expire_date'] = $expire_date;
|
||||
|
||||
$this->db->where('member_id', $member_id);
|
||||
$this->db->where('member_ip', $member_ip);
|
||||
$row = $this->db->update('member_login', $update_data);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
32
application/models/web/m_member_login_log.php
Executable file
32
application/models/web/m_member_login_log.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_member_login_log extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : insert
|
||||
# CREATE : 2018-04-05
|
||||
#---------------------------------------------------------------------------
|
||||
function member_login_log_insert($req_data){
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$row = $this->db->insert('member_login_log', $req_data);
|
||||
|
||||
return $row;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
37
application/models/web/m_member_setting.php
Executable file
37
application/models/web/m_member_setting.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?
|
||||
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-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
function member_setting_where_not_default_list(){
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_default', 'N');
|
||||
$this->db->from('member_setting');
|
||||
$this->db->order_by('idx', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
211
application/models/web/m_news.php
Executable file
211
application/models/web/m_news.php
Executable file
@@ -0,0 +1,211 @@
|
||||
<?
|
||||
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 : list
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_list($req_data)
|
||||
{
|
||||
// request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
|
||||
$search_type = '';
|
||||
$search_keyword = '';
|
||||
$sort_type = 'desc';
|
||||
if (isset($req_data['search_type']) == true)
|
||||
$search_type = $req_data['search_type'];
|
||||
if (isset($req_data['search_keyword']) == true)
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
if (isset($req_data['sort_type']) == true)
|
||||
$sort_type = $req_data['sort_type'];
|
||||
|
||||
if ($search_type == 'category_code' && $search_keyword != '') {
|
||||
$this->db->where('category_code like "' . $search_keyword . '%"');
|
||||
}
|
||||
|
||||
if ($search_type == 'main_search' && $search_keyword != '') {
|
||||
$keywordAsteriskRemoved = str_replace('*','', $search_keyword);
|
||||
$this->db->group_start()
|
||||
->like('title', $keywordAsteriskRemoved)
|
||||
// ->or_like('content', $keywordAsteriskRemoved)
|
||||
// ->or_like('tag', $keywordAsteriskRemoved)
|
||||
->group_end();
|
||||
// $this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
}
|
||||
|
||||
if ($search_type == 'main_search_and_video_url' && $search_keyword != '') {
|
||||
$this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
$this->db->where('video_url!=', '');
|
||||
}
|
||||
|
||||
$this->db->select('*, "1" as content_type, (select homepage from press where is_del="N" and idx=news.press_idx) as press_homepage, (select category_name from news_section where category_code = SUBSTRING(news.category_code, 1, 2) and depth=1) as category_name');
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('news');
|
||||
$this->db->limit("10", $offset);
|
||||
$this->db->order_by($sort_column, $sort_type);
|
||||
$this->db->order_by('display_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : list - total count
|
||||
// CREATE : 2018-04-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_list_total_count($req_data)
|
||||
{
|
||||
if (isset($req_data['search_type']) == false)
|
||||
$req_data['search_type'] = '';
|
||||
if (isset($req_data['search_keyword']) == false)
|
||||
$req_data['search_keyword'] = '';
|
||||
$search_type = $req_data['search_type'];
|
||||
$search_keyword = $req_data['search_keyword'];
|
||||
|
||||
if ($search_type == 'category_code' && $search_keyword != '')
|
||||
$this->db->where('category_code like "' . $search_keyword . '%"');
|
||||
if ($search_type == 'main_search' && $search_keyword != '')
|
||||
$this->db->where("match(title, content, tag) against('" . $search_keyword . "' in boolean mode)");
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('news');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : select idx
|
||||
// CREATE : 2018-04-16
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_join_news_section_press_select($idx)
|
||||
{
|
||||
$this->db->select('a.*, b.press_name, b.logo_img, b.homepage, (select category_name from news_section where category_code = SUBSTRING(a.category_code, 1, 2) and is_del = "N" and depth=1) as category_name1 , (select category_name from news_section where category_code = SUBSTRING(a.category_code, 1, 4) and is_del = "N" and depth=2) as category_name2 , (select category_name from news_section where category_code = SUBSTRING(a.category_code, 1, 6) and is_del = "N" and depth=3) as category_name3');
|
||||
$this->db->where('a.idx', $idx);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('a.is_display', 'Y');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->from('news as a');
|
||||
$this->db->join('press as b', 'a.press_idx=b.idx');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : update
|
||||
// CREATE : 2018-04-16
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_review_update($req_data)
|
||||
{
|
||||
// request
|
||||
$idx = $req_data['idx'];
|
||||
$type = $req_data['type'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update news
|
||||
set review_count" . $type . " = review_count" . $type . " + " . $value . "
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : select
|
||||
// CREATE : 2018-04-17
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_select($idx)
|
||||
{
|
||||
$this->db->select('*, (select homepage from press where is_del="N" and idx=news.press_idx) as press_homepage, (select category_name from news_section where category_code = SUBSTRING(news.category_code, 1, 2) and depth=1) as category_name');
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('news');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : select
|
||||
// CREATE : 2018-04-17
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_select_idx($idx)
|
||||
{
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('news');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : hit +1 update
|
||||
// CREATE : 2018-04-27
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_hit_count_update($idx)
|
||||
{
|
||||
$sql = "update news
|
||||
set hit_count = hit_count + 1
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : update
|
||||
// CREATE : 2018-04-28
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_share_count_update($req_data)
|
||||
{
|
||||
// request
|
||||
$idx = $req_data['idx'];
|
||||
$value = $req_data['value'];
|
||||
|
||||
$sql = "update news
|
||||
set share_count = share_count + " . $value . "
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// PURPOSE : comment_count +1 update
|
||||
// CREATE : 2018-05-11
|
||||
// ---------------------------------------------------------------------------
|
||||
function news_comment_count_update($idx)
|
||||
{
|
||||
$sql = "update news
|
||||
set comment_count = comment_count + 1
|
||||
where idx= " . $idx;
|
||||
$row = $this->db->query($sql);
|
||||
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
?>
|
||||
30
application/models/web/m_news_section.php
Executable file
30
application/models/web/m_news_section.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?
|
||||
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 : 카테고리정보
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function news_section_select($category_code){
|
||||
|
||||
$this->db->where('category_code', $category_code);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('news_section');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
183
application/models/web/m_partner.php
Executable file
183
application/models/web/m_partner.php
Executable file
@@ -0,0 +1,183 @@
|
||||
<?
|
||||
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 : list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function partner_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
|
||||
$search_type = ''; $search_key = '';
|
||||
if(isset($req_data['search_type']) == true) $search_type = $req_data['search_type'];
|
||||
if(isset($req_data['search_key']) == true) $search_key = $req_data['search_key'];
|
||||
|
||||
if($search_type!='' && $search_key !='') $this->db->where($search_type, $search_key);
|
||||
|
||||
|
||||
$this->db->where('member_group_idx', $member_group_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('partner');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by($sort_column, 'desc');
|
||||
$this->db->order_by('display_sort', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function partner_life_aritcle_count_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
|
||||
//var_dump($req_data);
|
||||
|
||||
$search_type = ''; $search_key = '';
|
||||
if(isset($req_data['search_type']) == true) $search_type = $req_data['search_type'];
|
||||
if(isset($req_data['search_key']) == true) $search_key = $req_data['search_key'];
|
||||
|
||||
if($search_type!='' && $search_key !='') $this->db->where($search_type, $search_key);
|
||||
|
||||
$this->db->select('*, (select count(*) from life where is_del="N" and is_display ="Y" and partner.idx=life.partner_idx) as article_count');
|
||||
$this->db->where('member_group_idx', $member_group_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('partner');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by($sort_column, 'desc');
|
||||
$this->db->order_by('display_sort', 'desc');
|
||||
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list - total count
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function partner_list_total_count($req_data){
|
||||
# request
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
|
||||
$search_type = ''; $search_key = '';
|
||||
if(isset($req_data['search_type']) == true) $search_type = $req_data['search_type'];
|
||||
if(isset($req_data['search_key']) == true) $search_key = $req_data['search_key'];
|
||||
|
||||
if($search_type!='' && $search_key !='') $this->db->where($search_type, $search_key);
|
||||
|
||||
$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 : all list
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function partner_all_list($req_data){
|
||||
# request
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
|
||||
$this->db->where('member_group_idx', $member_group_idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('partner');
|
||||
$this->db->order_by($sort_column, 'asc');
|
||||
$this->db->order_by('reg_date', 'desc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function partner_select($idx){
|
||||
|
||||
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('partner');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-30
|
||||
#---------------------------------------------------------------------------
|
||||
function partner_join_category_channel_select($idx){
|
||||
|
||||
|
||||
$this->db->select('a.*, b.category_name, c.channel_name');
|
||||
$this->db->where('a.idx', $idx);
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('c.is_del', 'N');
|
||||
$this->db->from('partner as a');
|
||||
$this->db->join('category as b', 'a.category_idx=b.idx');
|
||||
$this->db->join('channel as c', 'a.channel_idx=c.idx');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
58
application/models/web/m_popup.php
Executable file
58
application/models/web/m_popup.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class m_popup extends CI_Model{
|
||||
|
||||
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->database();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function popup_where_menu_code_list($req_data){
|
||||
# request
|
||||
$menu_code = $req_data['menu_code'];
|
||||
$now_date = $req_data['now_date'];
|
||||
|
||||
$this->db->where('menu_code', $menu_code);
|
||||
$this->db->where('start_date <=', $now_date);
|
||||
$this->db->where('end_date >=', $now_date);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('popup');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : select
|
||||
# CREATE : 2018-04-17
|
||||
#---------------------------------------------------------------------------
|
||||
function popup_select($idx){
|
||||
$this->db->where('idx', $idx);
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_display', 'Y');
|
||||
$this->db->from('popup');
|
||||
$res = $this->db->get();
|
||||
$row = $res->row_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
30
application/models/web/m_press.php
Executable file
30
application/models/web/m_press.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?
|
||||
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 : 언론사 - all list
|
||||
# CREATE : 2018-04-09
|
||||
#---------------------------------------------------------------------------
|
||||
function press_all_list(){
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('is_direct', 'Y');
|
||||
$this->db->from('press');
|
||||
$this->db->order_by('display_sort', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
171
application/models/web/m_ranking.php
Executable file
171
application/models/web/m_ranking.php
Executable file
@@ -0,0 +1,171 @@
|
||||
<?
|
||||
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 : list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$ranking_type = $req_data['ranking_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('ranking_type', $ranking_type);
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->from('ranking');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking_news join
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_join_news_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$ranking_type = $req_data['ranking_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$this->db->select('a.*, b.content, b.org_url, b.press_name, b.hit_count, b.comment_count, b.review_count1, b.display_date, (select homepage from press where is_del="N" and idx=b.press_idx) as press_homepage');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('a.ranking_type', $ranking_type);
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->from('ranking as a');
|
||||
$this->db->join('news as b', 'a.content_idx=b.idx');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : ranking life join
|
||||
# CREATE : 2018-04-29
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_join_life_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$ranking_type = $req_data['ranking_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$this->db->select('a.*, b.partner_idx, b.content, b.editor_name, b.hit_count, b.comment_count, b.like_count, b.display_date');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('a.ranking_type', $ranking_type);
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->from('ranking as a');
|
||||
$this->db->join('life as b', 'a.content_idx=b.idx');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('a.rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_join_news_total_count($req_data){
|
||||
# request
|
||||
$ranking_type = $req_data['ranking_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.ranking_type', $ranking_type);
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->from('ranking as a');
|
||||
$this->db->join('news as b', 'a.content_idx = b.idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_join_life_total_count($req_data){
|
||||
# request
|
||||
$ranking_type = $req_data['ranking_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$this->db->where('a.is_del', 'N');
|
||||
$this->db->where('b.is_del', 'N');
|
||||
$this->db->where('b.is_display', 'Y');
|
||||
$this->db->where('a.ranking_type', $ranking_type);
|
||||
$this->db->where('a.content_type', $content_type);
|
||||
$this->db->from('ranking as a');
|
||||
$this->db->join('life as b', 'a.content_idx = b.idx');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : count
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function ranking_total_count($req_data){
|
||||
# request
|
||||
$ranking_type = $req_data['ranking_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->where('ranking_type', $ranking_type);
|
||||
$this->db->where('content_type', $content_type);
|
||||
$this->db->from('ranking');
|
||||
$row = $this->db->count_all_results();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
59
application/models/web/m_realtime_keyword.php
Executable file
59
application/models/web/m_realtime_keyword.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?
|
||||
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 : all list
|
||||
# CREATE : 2018-04-09
|
||||
#---------------------------------------------------------------------------
|
||||
function realtime_keyword_all_list(){
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('realtime_keyword');
|
||||
$this->db->order_by('rank', 'asc');
|
||||
$this->db->limit('20');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-11
|
||||
#---------------------------------------------------------------------------
|
||||
function realtime_keyword_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('realtime_keyword');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('rank', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
39
application/models/web/m_recommend_app.php
Executable file
39
application/models/web/m_recommend_app.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?
|
||||
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-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
function recommend_app_list($req_data){
|
||||
# request
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
|
||||
|
||||
$this->db->where('is_direct', 'Y');
|
||||
$this->db->where('is_del', 'N');
|
||||
$this->db->from('recommend_app');
|
||||
$this->db->limit($limit, $offset);
|
||||
$this->db->order_by('display_sort', 'asc');
|
||||
$res = $this->db->get();
|
||||
|
||||
$row = $res->result_array();
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
62
application/models/web/m_relation_article.php
Executable file
62
application/models/web/m_relation_article.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?
|
||||
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 : list
|
||||
# CREATE : 2018-04-16
|
||||
#---------------------------------------------------------------------------
|
||||
function relation_article_join_news_list($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
$this->db->select('b.*, (select homepage from press where is_del="N" and idx=b.press_idx) as press_homepage');
|
||||
$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', 'b.idx = a.relation_article_idx');
|
||||
$this->db->order_by('a.idx', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : list
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
function relation_article_join_column_list($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
|
||||
$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', 'b.idx = a.relation_article_idx');
|
||||
$this->db->order_by('a.idx', 'asc');
|
||||
$res = $this->db->get();
|
||||
$row = $res->result_array();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user