88 lines
2.8 KiB
PHP
Executable File
88 lines
2.8 KiB
PHP
Executable File
<?
|
|
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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
?>
|