$table
$table :
Model Class
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Report_model extends CI_Model
{
private $table = 'report';
public function __construct()
{
$this->db = $this->load->database('dev', TRUE);
parent::__construct();
}
/**
* 举报录入
* @param unknown $reportData
*/
public function Addreport($reportData = array())
{
$this->db->insert($this->table, $reportData);
return $this->db->insert_id();
}
/**
* 获取用户举报记录
*/
public function getReport($parm, $limit, $start)
{
$this->db->limit($limit, $start);
$this->db->order_by('time', 'desc');
$result = $this->db->get($this->table);
return $result->result_array();
}
/**
* 修改
*/
public function updateData($roleData, $roleId = 0)
{
$this->db->where('id', $roleId);
$query = $this->db->update($this->table, $roleData);
return $query ? $roleId : false;
}
/**
* 查询总条数
* */
public function getReportCount($where = '')
{
// $where = $this->_getwhere($condition);
// $this->db->where($where);
return $this->db->count_all_results($this->table);
}
/**
*获取菜单下单个广告
* */
public function getRow($menuId = 0)
{
$this->db->where('id', $menuId);
$result = $this->db->get($this->table);
return $result->row_array();
}
/**
*获取脸部结果
* */
public function getfaceresult($menuId = 0)
{
$this->db->where('id', $menuId);
$result = $this->db->get('face_result');
return $result->row_array();
}
/**
*获取舌部结果
* */
public function gettongueresult($menuId = 0)
{
$this->db->where('id', $menuId);
$result = $this->db->get('tongue_result');
return $result->row_array();
}
/**
*获取用户信息
* */
public function getuserinfo($menuId = 0)
{
$this->db->where('id', $menuId);
$result = $this->db->get('user_info_history');
return $result->row_array();
}
/**
*获取菜单下单个广告
* */
public function getquesttionRow( $menuId=0)
{
$this->db->where('id', $menuId);
$result = $this->db->get('question_result');
return $result->row_array();
}
/**
* 获取每一天的数据
*/
public function getdaycount($stime = '', $etime = '',$client_info='')
{
date_default_timezone_set('UTC');
if (!empty($stime)){
$stime = date('Y-m-d H:i:s',$stime);
$this->db->where('time >' ,$stime);
}
if (!empty($etime)){
$etime = date('Y-m-d H:i:s',$etime);
$this->db->where('time <' ,$etime);
}
if (!empty($client_info)){
$this->db->where('client_info',$client_info);
}
return $this->db->count_all_results($this->table);
}
/**
* 删除
* */
public function delete($cateId = 0)
{
$this->db->where('id', $cateId);
return $this->db->delete($this->table);
}
}
?>