<?php
//竞投虚假房源举报
class Loan_model extends MY_Model{
    /**
     * 类初始化
     */
	
	private $_mem_key = 'nj_loan_new_model';

    public function __construct() 
    {
        parent::__construct(1,1,2);		

    }
    
    
    //查询推荐的产品
    public function getLoanProduct($kind){
		$mem_key = $this->_mem_key."_is_promot_loan_3".$kind;
		$this->mc->delete($mem_key);
		
		$cache = $this->mc->get($mem_key);        
		
        if(isset($cache['is_ok']) && $cache['is_ok'] == 1 )
        {
            $arr_data = $cache['data'];
        }
        else
        {
			
			//查询字段
			$this->dbback->select("id,kind,name,description,maximum,rate,time,pic");
			//查询条件
			$conf['settype']=4;
			$conf['istop']=1;
			$conf['kind'] = $kind;
			$this->dbback->where($conf);
			$this->dbback->order_by('id', 'desc');
			$this->dbback->limit(1);			
			//查询
			$arr_data = $this->dbback->get('loan_set')->row_array();
			//echo $this->dbback->last_query();
			
			
			
			$this->mc->add($mem_key , array('is_ok'=>1 , 'data'=>$arr_data) ,  600);
		}
        return $arr_data;
    }   



	public function insertRecord($data_array){
        $tbl = 'loan_application_new';
        $this->db->insert($tbl, $data_array);
		return $this->db->insert_id();
    }

    

   
   

  
    
    
    
   
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
}

