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