<?
defined('BASEPATH') OR exit('No direct script access allowed');

class m_hit_log extends CI_Model{

	// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
	function __construct(){
		parent::__construct();

        $this->load->database();
        $this->load->library('session');
	}


    #---------------------------------------------------------------------------
    # PURPOSE :	insert
    # CREATE  :	2018-04-26
    #---------------------------------------------------------------------------
	function hit_log_insert($req_data){

        $now_date       = date("Y-m-d H:i:s");
        $req_data['reg_date']   = $now_date;

        $row = $this->db->insert('hit_log', $req_data);
        return $row;
    }




    #---------------------------------------------------------------------------
    # PURPOSE : 1시간전에 글을 읽었는지 확인
    # CREATE  :	2018-04-27
    #--------------------------------------------------------------------------
	function hit_log_where_member_id_content_idx_count($req_data){
	    # request
        $reg_date       = $req_data['reg_date'];
        $content_type   = $req_data['content_type'];
        $content_idx    = $req_data['content_idx'];
        $member_id      = $req_data['member_id'];

        $this->db->where('member_id', $member_id);
        $this->db->where('content_idx', $content_idx);
        $this->db->where('content_type', $content_type);
        $this->db->where('reg_date >=', $reg_date);
        $this->db->from('hit_log');
        $row = $this->db->count_all_results();

        return $row;
    }

}
?>
