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,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'];
}
}

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

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

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

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

View File

@@ -0,0 +1,239 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_bbs_question extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 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;
}
}
?>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

@@ -0,0 +1,68 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_review_log extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-17
#---------------------------------------------------------------------------
function review_log_where_member_id_content_idx_select($req_data){
# request
$member_id = $req_data['member_id'];
$content_idx = $req_data['content_idx'];
$this->db->where('member_id', $member_id);
$this->db->where('content_idx', $content_idx);
$this->db->from('review_log');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : delete
# CREATE : 2018-04-17
#---------------------------------------------------------------------------
function review_log_delete($idx){
$this->db->where('idx', $idx);
$row = $this->db->delete('review_log');
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function review_log_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('review_log', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,106 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_search_keyword extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_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('search_keyword');
$this->db->limit($limit, $offset);
$this->db->order_by('search_count', 'desc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : where keyword select
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_where_keyword_select($req_data){
# request
$keyword = $req_data['keyword'];
$this->db->where('is_del', 'N');
$this->db->where('keyword', $keyword);
$this->db->from('search_keyword');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : search_count +1 update
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_search_count_update($idx){
$sql = "update search_keyword
set search_count = search_count + 1
where idx= ".$idx;
$row = $this->db->query($sql);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-04-16
#---------------------------------------------------------------------------
function search_keyword_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('search_keyword', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,32 @@
<?
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 : insert
# CREATE : 2018-05-02
#---------------------------------------------------------------------------
function search_keyword_log_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('search_keyword_log', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,96 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_search_keyword_relation extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : where keyword, relation_keyword select
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function search_keyword_relation_where_keyword_relation_keyword_select($req_data){
# request
$keyword = $req_data['keyword'];
$relation_keyword = $req_data['relation_keyword'];
$this->db->where('keyword', $keyword);
$this->db->where('relation_keyword', $relation_keyword);
$this->db->from('search_keyword_relation');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : search_count +1 update
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function search_keyword_relation_search_count_update($idx){
$sql = "update search_keyword_relation
set search_count = search_count + 1
where idx= ".$idx;
$row = $this->db->query($sql);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function search_keyword_relation_keyword_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('search_keyword_relation', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function search_keyword_relation_list($req_data){
# request
$keyword = $req_data['keyword'];
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$this->db->where('keyword', $keyword);
$this->db->from('search_keyword_relation');
$this->db->order_by('search_count', 'desc');
$this->db->limit($limit, $offset);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,33 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_site_info extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function site_info_select($idx){
$this->db->where('idx', $idx);
$this->db->from('site_info');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,70 @@
<?
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 : insert
# CREATE : 2018-04-27
#---------------------------------------------------------------------------
function spam_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('spam', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function spam_where_comment_idx_count($comment_idx){
$this->db->where('comment_idx', $comment_idx);
$this->db->from('spam');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : count
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function spam_where_member_id_comment_idx_count($req_data){
$comment_idx = $req_data['comment_idx'];
$member_id = $req_data['member_id'];
$this->db->where('write_id', $member_id);
$this->db->where('comment_idx', $comment_idx);
$this->db->from('spam');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,34 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_spam_media_log extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function spam_media_log_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('spam_media_log', $req_data);
return $row;
}
}
?>

View File

@@ -0,0 +1,37 @@
<?
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 : list
# CREATE : 2018-05-28
#---------------------------------------------------------------------------
function t_weather_all_list(){
$this->db->from('t_weather');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

174
application/models/web/m_tag.php Executable file
View File

@@ -0,0 +1,174 @@
<?
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 : total_count
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function tag_join_life_list_total_count($req_data){
# request
$tag = $req_data['tag'];
$content_type = $req_data['content_type'];
$this->db->where('b.is_del', 'N');
$this->db->where('b.is_display', 'Y');
$this->db->where('a.tag', $tag);
$this->db->where('a.content_type', $content_type);
$this->db->from('tag as a');
$this->db->join('life as b', 'a.content_idx = b.idx');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : join life list
# CREATE : 2018-05-01
#---------------------------------------------------------------------------
function tag_join_life_list($req_data){
# request
$tag = $req_data['tag'];
$content_type = $req_data['content_type'];
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$this->db->where('b.is_del', 'N');
$this->db->where('b.is_display', 'Y');
$this->db->where('a.tag', $tag);
$this->db->where('a.content_type', $content_type);
$this->db->from('tag as a');
$this->db->join('life as b', 'a.content_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 : join tag
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function tag_join_tag_list($req_data){
# request
$tag = $req_data['tag'];
$content_type = $req_data['content_type'];
$this->db->select('b.tag, count(*) as cnt');
$this->db->where('a.content_type', $content_type);
$this->db->where('a.tag', $tag);
$this->db->where('d.is_del', 'N');
$this->db->where('d.is_display', 'Y');
$this->db->from('tag as a');
$this->db->join('tag as b', 'a.content_type=b.content_type and a.content_idx=b.content_idx');
$this->db->join('life as d', 'b.content_idx=d.idx');
$this->db->group_by('b.tag');
$query = $this->db->get_compiled_select();
$this->db->from('('.$query.') as c');
$this->db->where('c.tag!=', $tag);
$this->db->order_by('c.cnt', 'DESC');
$this->db->limit(5, 0);
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : join life
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function tag_join_life_where_tag_count($req_data){
# request
$tag = $req_data['tag'];
$this->db->where('a.content_type', '3');
$this->db->where('a.tag', $tag);
$this->db->where('d.is_del', 'N');
$this->db->where('d.is_display', 'Y');
$this->db->from('tag as a');
$this->db->join('life as d', 'a.content_idx=d.idx');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : join life
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function tag_join_life_where_tag_list_limit1($req_data){
# request
$tag = $req_data['tag'];
$this->db->where('a.content_type', '3');
$this->db->where('a.tag', $tag);
$this->db->where('d.is_del', 'N');
$this->db->where('d.is_display', 'Y');
$this->db->from('tag as a');
$this->db->join('life as d', 'a.content_idx=d.idx');
$this->db->limit(1, 0);
$this->db->order_by('d.display_date', 'desc');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : join life
# CREATE : 2018-05-11
#---------------------------------------------------------------------------
function tag_join_life_where_display_date_count($req_data){
# request
$reg_date = $req_data['now_date'];
$tag = $req_data['tag'];
$this->db->where('d.display_date >=', $reg_date);
$this->db->where('a.content_type', '3');
$this->db->where('a.tag', $tag);
$this->db->where('d.is_del', 'N');
$this->db->where('d.is_display', 'Y');
$this->db->from('tag as a');
$this->db->join('life as d', 'a.content_idx=d.idx');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,49 @@
<?
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 : where in theme_type list
# CREATE : 2018-04-09
#---------------------------------------------------------------------------
function theme_join_vw_content_where_in_theme_type_list($req_data){
# request
$theme_types = $req_data['theme_types'];
$this->db->select('a.*, b.column_name, b.content, b.partner_idx,b.sub_title,b.head_title,b.hit_count,b.editor_name,b.press_name, b.video_url, b.video_playtime, b.main_img');
$this->db->where('a.is_del', 'N');
$this->db->where('a.is_display', 'Y');
$this->db->where('b.is_display', 'Y');
$this->db->where('b.is_del', 'N');
$this->db->where_in('a.theme_type', $theme_types);
$this->db->from('theme 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.content_type', 'asc');
$this->db->order_by('a.theme_type', 'asc');
$this->db->order_by('a.rank', 'asc');
$res = $this->db->get();
log_message('info', $this->db->last_query());
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,49 @@
<?
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 : where in theme_type list
# CREATE : 2018-04-09
#---------------------------------------------------------------------------
function theme_join_vw_content_where_in_theme_type_list($req_data){
# request
$theme_types = $req_data['theme_types'];
$this->db->select('a.*, b.column_name, b.content, b.partner_idx,b.sub_title,b.head_title,b.hit_count,b.editor_name,b.press_name, b.video_url, b.video_playtime');
$this->db->where('a.is_del', 'N');
$this->db->where('a.is_display', 'Y');
$this->db->where('b.is_display', 'Y');
$this->db->where('b.is_del', 'N');
$this->db->where_in('a.theme_type', $theme_types);
$this->db->from('theme 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.content_type', 'asc');
$this->db->order_by('a.theme_type', 'asc');
$this->db->order_by('a.rank', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,48 @@
<?
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 : where in theme_type list
# CREATE : 2018-04-09
#---------------------------------------------------------------------------
function theme_join_vw_content_where_in_theme_type_list($req_data){
# request
$theme_types = $req_data['theme_types'];
$this->db->select('a.*, b.column_name, b.content, b.partner_idx,b.sub_title,b.head_title,b.hit_count,b.editor_name');
$this->db->where('a.is_del', 'N');
$this->db->where('a.is_display', 'Y');
$this->db->where('b.is_display', 'Y');
$this->db->where('b.is_del', 'N');
$this->db->where_in('a.theme_type', $theme_types);
$this->db->from('theme 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.content_type', 'asc');
$this->db->order_by('a.theme_type', 'asc');
$this->db->order_by('a.rank', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,54 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_tmp_find_key extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-05-05
#---------------------------------------------------------------------------
function tmp_find_key_insert($req_data){
$row = $this->db->insert('tmp_find_key', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : count
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function tmp_find_key_where_type_content_type_key_auth_key_count($req_data){
# request
$type = $req_data['type'];
$content = $req_data['content'];
$type_key = $req_data['type_key'];
$auth_key = $req_data['auth_key'];
$this->db->where('type', $type);
$this->db->where('content', $content);
$this->db->where('type_key', $type_key);
$this->db->where('auth_key', $auth_key);
$this->db->from('tmp_find_key');
$row = $this->db->count_all_results();
return $row;
}
}
?>

View File

@@ -0,0 +1,70 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_tmp_social_member extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : insert
# CREATE : 2018-04-20
#---------------------------------------------------------------------------
function tmp_social_member_insert($req_data){
$now_date = date("Y-m-d H:i:s");
$req_data['reg_date'] = $now_date;
$row = $this->db->insert('tmp_social_member', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : count
# CREATE : 2018-04-20
#---------------------------------------------------------------------------
function tmp_social_member_where_id_count($req_data){
# request
$social_id = (string)$req_data['id'];
$social_type = $req_data['social_type'];
$this->db->where('social_type', $social_type);
$this->db->where('social_id', $social_id);
$this->db->from('tmp_social_member');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-21
#---------------------------------------------------------------------------
function tmp_social_member_select($id){
$this->db->where('social_id', $id);
$this->db->from('tmp_social_member');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,37 @@
<?
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 : where diplay_date select
# CREATE : 2018-04-09
#---------------------------------------------------------------------------
function today_word_where_display_date_select($display_date){
$this->db->where('is_del', 'N');
// $this->db->where('is_display', 'Y');
$this->db->where('display_date', $display_date);
$this->db->from('today_word')->order_by('display_date', 'desc')->limit(1);
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,262 @@
<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_vw_content extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-04-09
#---------------------------------------------------------------------------
function vw_content_select($req_data){
# request
$content_type = $req_data['content_type'];
$idx = $req_data['idx'];
$sql="select * from vw_content where content_type= '".$content_type."' COLLATE utf8_general_ci and idx=".$idx;
$res = $this->db->query($sql);
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function vw_content_list($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$offset = $req_data['offset'];
$limit = $req_data['limit'];
if($search_keyword!='') $arr_search_keyword = explode(" ", $search_keyword);
$where_query = '';
if($search_type == 'main_search_and_video_url' && $search_keyword!='') {
$where_query1 = '';
$i=1;
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query.=" and video_url!='' and (".$where_query1.")";
}
if($search_type == 'main_search' && $search_keyword!='') {
$where_query1 = '';
$i=1;
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query.=" and (".$where_query1.")";
}
$sql="select vw_content.*, @num:=@num+1 as row_num
from vw_content, (select @num:=0) as a
where is_del= 'N'
and is_display = 'Y'".$where_query." order by display_date desc limit ".$offset.",".$limit;
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list - total count
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function vw_content_list_total_count($req_data){
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
if($search_keyword!='') $arr_search_keyword = explode(" ", $search_keyword);
if($search_type == 'main_search_and_video_url' && $search_keyword!='') {
$i=1;$where_query1 = '';
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query1="(".$where_query1.")";
$this->db->where($where_query1);
$this->db->where('video_url!=', '');
}
if($search_type == 'main_search' && $search_keyword!='') {
$i=1;$where_query1 = '';
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query1="(".$where_query1.")";
$this->db->where($where_query1);
}
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$this->db->from('vw_content');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function vw_content_next_select($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$row_num = $req_data['row_num'];
$where_query = '';
if($search_type == 'main_search' && $search_keyword!='') {
if($search_keyword!='') $arr_search_keyword = explode(" ", $search_keyword);
$where_query1 = '';
$i=1;
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query.=" and (".$where_query1.")";
}
$sql="select * from (select vw_content.*, @num:=@num+1 as row_num
from vw_content,(select @num:=0) as a
where is_del= 'N'
and is_display = 'Y'".$where_query." order by display_date desc) as a
where a.row_num > '".$row_num."' order by a.row_num asc limit 1";
$res = $this->db->query($sql);
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : select
# CREATE : 2018-05-04
#---------------------------------------------------------------------------
function vw_content_prev_select($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$row_num = $req_data['row_num'];
$where_query = '';
if($search_type == 'main_search' && $search_keyword!='') {
if($search_keyword!='') $arr_search_keyword = explode(" ", $search_keyword);
$where_query1 = '';
$i=1;
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query.=" and (".$where_query1.")";
}
$sql="select * from (select vw_content.*, @num:=@num+1 as row_num
from vw_content,(select @num:=0) as a
where is_del= 'N'
and is_display = 'Y'".$where_query." order by display_date desc) as a
where a.row_num < '".$row_num."' order by a.row_num desc limit 1";
$res = $this->db->query($sql);
$row = $res->row_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : list
# CREATE : 2018-05-03
#---------------------------------------------------------------------------
function vw_content_where_not_idx_list($req_data){
# request
$search_type = $req_data['search_type'];
$search_keyword = $req_data['search_keyword'];
$idx = $req_data['idx'];
$offset = $req_data['offset'];
$limit = $req_data['limit'];
$where_query = '';
if($search_type == 'main_search' && $search_keyword!='') {
if($search_keyword!='') $arr_search_keyword = explode(" ", $search_keyword);
$where_query1 = '';
$i=1;
foreach ($arr_search_keyword as $val) {
if($val == '') continue;
if($i!=1) $where_query1.=' or';
$where_query1.=' (title like "%'.$val.'%" or content like "%'.$val.'%" or tag like "%'.$val.'%")';
$i++;
}
$where_query.=" and (".$where_query1.")";
}
$sql="select vw_content.*, @num:=@num+1 as row_num
from vw_content, (select @num:=0) as a
where is_del= 'N' and idx!='".$idx."'
and is_display = 'Y'".$where_query." order by display_date desc limit ".$offset.",".$limit;
$res = $this->db->query($sql);
$row = $res->result_array();
return $row;
}
}
?>

View File

@@ -0,0 +1,87 @@
<?
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 : join relation_article join news list
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function weather_join_relation_article_join_news_list(){
$this->db->where('a.is_del', 'N');
$this->db->where('a.display_status', '1');
$this->db->where('b.content_type', '5');
$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');
$this->db->join('news as c', 'c.idx = b.relation_article_idx');
$this->db->order_by('a.rank', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : join relation_article limit 1
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function weather_join_relation_article_limit1(){
$this->db->select('a.*, (select relation_article_idx from relation_article where content_type="5" and a.idx=content_idx order by idx asc limit 1) as relation_article_idx');
$this->db->where('a.is_del', 'N');
$this->db->where('a.display_status', '1');
$this->db->from('weather as a');
$this->db->order_by('a.rank', 'asc');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : join relation_article join news where news_idx select
# CREATE : 2018-04-04
#---------------------------------------------------------------------------
function weather_join_relation_article_join_news_where_news_idx_select($news_idx){
$this->db->select('a.*');
$this->db->where('a.is_del', 'N');
$this->db->where('a.display_status', '1');
$this->db->where('b.content_type', '5');
$this->db->where('c.is_del', 'N');
$this->db->where('c.idx', $news_idx);
$this->db->from('weather as a');
$this->db->join('relation_article as b', 'a.idx = b.content_idx');
$this->db->join('news as c', 'c.idx = b.relation_article_idx');
$res = $this->db->get();
$row = $res->row_array();
return $row;
}
}
?>