first commit
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user