<?php

/*
 * Copyright (C) xgcms.com
 */

class member_visitor extends base_model {
	
	function __construct(&$conf) {
		parent::__construct($conf);
		$this->table = 'member_visitor';
		$this->primarykey = array('uid','vuid');
		
		// hook member_visitor_construct_end.php
	}
	public function get_last_visitor($uid,$num=10){
		$list=$this->index_fetch(array('uid'=>$uid),array('dateline'=>-1),0,$num);
		$uids=$time=array();
		foreach($list as $v){
			$uids[]=$v['vuid'];
			$time[$v['vuid']]=misc::_humandate($v['dateline']);
		}
		$uids=array_unique($uids);
		$userlist=$this->member->mget($uids);
		foreach($userlist as &$u){
		   $this->member->format($u);
		   $u['visittime']=$time[$u['uid']];
		}
		return $userlist;
	}
	
}

?>