Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
68
application/models/Contents_comment_model.php
Normal file
68
application/models/Contents_comment_model.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Contents_comment class
|
||||
*/
|
||||
|
||||
class Contents_comment_model extends MY_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* 테이블명
|
||||
*/
|
||||
public $_table = 'contents_comment';
|
||||
|
||||
/**
|
||||
* 사용되는 테이블의 프라이머리키
|
||||
*/
|
||||
public $primary_key = 'com_id'; // 사용되는 테이블의 프라이머리키
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function get_admin_list($limit = '', $offset = '', $where = '', $like = '', $findex = '', $forder = '', $sfield = '', $skeyword = '', $sop = 'OR')
|
||||
{
|
||||
$select = 'contents_comment.*, contents.con_title, contents.cat1_id, contents.cat2_id, contents.con_created_at, user.user_id, user.user_username';
|
||||
$join[] = array('table' => 'user', 'on' => 'contents_comment.con_user_id = user.user_id', 'type' => 'inner');
|
||||
$join[] = array('table' => 'contents', 'on' => 'contents_comment.con_id = contents.con_id', 'type' => 'inner');
|
||||
$result = $this->_get_list_common($select, $join, $limit, $offset, $where, $like, $findex, $forder, $sfield, $skeyword, $sop);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function get_api_list($app_id= '', $con_id = '')
|
||||
{
|
||||
$select = 'contents_comment.com_id, contents_comment.con_id, com_content, contents_comment.user_id, com_created_at, com_updated_at, user.user_username, user.user_photo';
|
||||
$this->db->select($select);
|
||||
$this->db->join('user', 'contents_comment.user_id = user.user_id', 'left');
|
||||
$this->db->where('contents_comment.con_id', $con_id);
|
||||
$this->db->where('contents_comment.app_id', $app_id);
|
||||
$this->db->order_by('com_num', 'asc');
|
||||
$this->db->order_by('com_reply', 'asc');
|
||||
$qry = $this->db->get($this->_table);
|
||||
$result = $qry->result_array();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function get_count($con_id)
|
||||
{
|
||||
$this->db->where(array('con_id' => $con_id));
|
||||
$this->db->join('user', 'contents_comment.user_id = user.user_id', 'inner');
|
||||
$result = $this->db->count_all_results($this->_table);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function next_comment_num()
|
||||
{
|
||||
$this->db->select_min('com_num');
|
||||
$result = $this->db->get($this->_table);
|
||||
$row = $result->row_array();
|
||||
$row['com_num'] = (isset($row['com_num']) && is_numeric($row['com_num'])) ? $row['com_num'] : 0;
|
||||
$com_num = $row['com_num'] - 1;
|
||||
|
||||
return $com_num;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user