<?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();
}
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 = '')
{ 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);
}
}
?>