load->database(); $this->load->library('session'); } #--------------------------------------------------------------------------- # PURPOSE : ranking life - list # CREATE : 2018-03-21 #--------------------------------------------------------------------------- function ranking_join_life_list($req_data){ # request $offset = $req_data['offset']; $limit = $req_data['limit']; $search_type = $req_data['search_type']; $search_keyword = $req_data['search_keyword']; $search_ranking_type = $req_data['search_ranking_type']; $search_category_code1 = $req_data['search_category_code1']; $search_category_code2 = $req_data['search_category_code2']; $search_life_type = $req_data['search_life_type']; $search_theme_type = $req_data['search_theme_type']; $content_type = $req_data['content_type']; if($search_type!='' && $search_keyword!=''){ $this->db->like('b.'.$search_type, $search_keyword); } if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type); if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1); if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2); if($search_life_type!='') $this->db->where('b.life_type', $search_life_type); if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type); $this->db->select('a.idx, a.rank, a.title, a.main_img, a.ranking_type, a.reg_date, a.content_idx, b.life_type, b.editor_name, b.hit_count, b.like_count, b.comment_count, b.share_count, c.category_name as category_name1, d.channel_name as category_name2'); $this->db->where('a.content_type', $content_type); $this->db->where('a.is_del', 'N'); $this->db->where('b.is_del', 'N'); $this->db->where('c.is_del', 'N'); $this->db->where('d.is_del', 'N'); $this->db->from('ranking as a'); $this->db->join('life as b', 'a.content_idx = b.idx'); $this->db->join('category as c', 'c.idx = b.category_idx'); $this->db->join('channel as d', 'd.idx = b.channel_idx'); $this->db->order_by('a.reg_date desc'); $this->db->limit($limit, $offset); $res = $this->db->get(); $row = $res->result_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : ranking life - list - total count # CREATE : 2018-03-21 #--------------------------------------------------------------------------- function ranking_join_life_list_total_count($req_data){ # request $search_type = $req_data['search_type']; $search_keyword = $req_data['search_keyword']; $search_ranking_type = $req_data['search_ranking_type']; $search_category_code1 = $req_data['search_category_code1']; $search_category_code2 = $req_data['search_category_code2']; $search_life_type = $req_data['search_life_type']; $search_theme_type = $req_data['search_theme_type']; $content_type = $req_data['content_type']; if($search_type!='' && $search_keyword!=''){ $this->db->like('b.'.$search_type, $search_keyword); } if($search_ranking_type!='') $this->db->where('a.ranking_type', $search_ranking_type); if($search_category_code1!='') $this->db->where('c.idx', $search_category_code1); if($search_category_code2!='') $this->db->where('d.idx', $search_category_code2); if($search_life_type!='') $this->db->where('b.life_type', $search_life_type); if($search_theme_type!='') $this->db->where('b.theme_type', $search_theme_type); $this->db->where('a.content_type', $content_type); $this->db->where('a.is_del', 'N'); $this->db->where('b.is_del', 'N'); $this->db->where('c.is_del', 'N'); $this->db->where('d.is_del', 'N'); $this->db->from('ranking as a'); $this->db->join('life as b', 'a.content_idx = b.idx'); $this->db->join('category as c', 'c.idx = b.category_idx'); $this->db->join('channel as d', 'd.idx = b.channel_idx'); $row = $this->db->count_all_results(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : 랭킹 type list - select # CREATE : 2018-03-21 #--------------------------------------------------------------------------- function ranking_join_life_type_list($req_data){ # request $content_type = $req_data['content_type']; $ranking_type = $req_data['ranking_type']; $this->db->select('a.*, b.hit_count, b.share_count, b.comment_count, b.editor_name'); $this->db->where('a.content_type', $content_type); $this->db->where('a.ranking_type', $ranking_type); $this->db->where('a.is_del', 'N'); $this->db->where('b.is_del', 'N'); $this->db->from('ranking as a'); $this->db->join('life as b', 'a.content_idx = b.idx'); $res = $this->db->get(); $row = $res->result_array(); return $row; } #--------------------------------------------------------------------------- # PURPOSE : 랭킹 - select # CREATE : 2018-03-21 #--------------------------------------------------------------------------- function ranking_join_life_select($req_data){ # request $idx = $req_data; $this->db->select('a.*, b.hit_count, b.share_count, b.comment_count, b.editor_name'); $this->db->where('a.idx', $idx); $this->db->where('a.is_del', 'N'); $this->db->where('b.is_del', 'N'); $this->db->from('ranking as a'); $this->db->join('life as b', 'a.content_idx = b.idx'); $res = $this->db->get(); $row = $res->result_array(); return $row; } } ?>