<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of house_tag
 *
 * @author Administrator
 */
class broker_login_record_model extends MY_Model {
   

    /**
     * 表名
     * @var type 表名
     */
    private $table;

    public function __construct() {
        parent::__construct(1,1,1); 
        $this->table = 'broker_index_login_record';
    }
    
    
	

	/**
     * 查找经纪人当月购买的套餐数量
     * @param type $uid
     * @param type $startTime
     * @param type $endTime
     * @param type $start
     * @param type $number
     * @return type
     */
    public function findNumByUid($uid) 
	{
		
		$date_start  =strtotime(date('Y-m-d 00:00:00'));
		$date_end    =strtotime(date('Y-m-d 23:59:59'));
		$this->dbback->select('uid');
		$this->dbback->where("uid = $uid && ctime>=$date_start && ctime<=$date_end");
		
		$data_info = $this->dbback->get('broker_index_login_record')->result_array();
		$num =count($data_info);
		
        return $num;
    }


	
   public function insertdata($uid)
    {     
		
        $insert_data = array();
      
        $insert_data['uid']	= $uid;
      
		$insert_data['ctime']		= time();
		
	
        $this->db->insert('broker_index_login_record',$insert_data);	
        
        return $this->db->insert_id();
    }
    

    
}
?>