first commit

This commit is contained in:
pakerpale
2020-06-10 06:19:03 +09:00
commit cd6b5b7832
6081 changed files with 624389 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,345 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_ranking extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - rank count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_rank_count($req_data){
# request
$ranking_type = $req_data['ranking_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$this->db->where('ranking_type', $ranking_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->from('ranking');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_rank_is_del_update($req_data){
# request
$ranking_type = $req_data['ranking_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('ranking_type', $ranking_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$row = $this->db->update('ranking', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['ranking_date'] = $now_date;
$req_data['reg_id'] = $user_id;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$row = $this->db->insert('ranking', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 content_idx - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_content_idx_select($req_data){
# request
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('ranking');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_update($req_data){
# request
$ranking_type = $req_data['ranking_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('ranking_type', $ranking_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$row = $this->db->update('ranking', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('ranking');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_is_del_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$arr_update_data = array();
foreach($req_data as $key=>$val) {
$arr_update_data[$key]['idx'] = $val;
$arr_update_data[$key]['is_del'] = 'Y';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$this->db->update_batch('ranking', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - select in idx
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_select_in_idx($req_data){
# request
$arr_idx = $req_data;
$this->db->where_in('idx', $arr_idx);
$this->db->where('is_del', 'N');
$this->db->from('ranking');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - update
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function ranking_where_idx_update($req_data){
# request
$idx = $req_data['idx'];
unset($req_data['idx']);
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update('ranking', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 log로 copy - 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_all_copy_ranking_log($content_type){
$sql ="insert into ranking_log";
if($content_type =='1'){
$sql.=" select '', a.ranking_date, b.category_code, '', a.ranking_type, a.content_type, a.rank, a.head_title, a.title, b.press_name, b.reporter_name, a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join news as b on (a.content_idx = b.idx)
where a.content_type = '".$content_type."'";
}else if($content_type =='3'){
$sql.=" select '', a.ranking_date, b.category_idx, b.channel_idx, a.ranking_type, a.content_type, a.rank, a.head_title, a.title, '', '', a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join life as b on (a.content_idx = b.idx)
where a.content_type = '".$content_type."'";
}
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 log로 copy - 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_copy_ranking_log($req_data){
# request
$rank_type = $req_data['rank_type'];
$content_type = $req_data['content_type'];
$sql ="insert into ranking_log";
if($content_type =='1'){
$sql.=" select '', a.ranking_date, b.category_code, '', a.ranking_type, a.content_type, a.rank, a.head_title, a.title, b.press_name, b.reporter_name, a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join news as b on (a.content_idx = b.idx)
where a.ranking_type='".$rank_type."' and a.content_type = '".$content_type."'";
}else if($content_type =='3'){
$sql.=" select '', a.ranking_date, b.category_idx, b.channel_idx, a.ranking_type, a.content_type, a.rank, a.head_title, a.title, '', '', a.sub_content, a.main_img, a.content_idx, b.hit_count, b.comment_count, b.share_count, b.like_count, 'system', now(), 'N'
from ranking as a
join life as b on (a.content_idx = b.idx)
where a.ranking_type='".$rank_type."' and a.content_type = '".$content_type."'";
}
$this->db->query($sql);
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 - is_del update - 스케쥴
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_is_del_where_content_type_update($req_data){
# request
$rank_type = $req_data['rank_type'];
$content_type = $req_data['content_type'];
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$update_data = array();
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('is_del', 'N');
$this->db->where('rank_type', $rank_type);
$this->db->where('content_type', $content_type);
$row = $this->db->update('ranking', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 현재랭킹 지우기
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_where_ranking_date_delete($reg_date){
$this->db->where('ranking_date = ', $reg_date);
$row = $this->db->delete('ranking');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 오래된 랭킹 지우기
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function rank_where_org_ranking_date_delete($reg_date){
$this->db->where('ranking_date <= ', $reg_date);
$row = $this->db->delete('ranking');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 랭킹 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function ranking_all_insert($req_data){
$row = $this->db->insert('ranking', $req_data);
return $row;
}
}
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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