<?php

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

class topic_views extends base_model {
	
	function __construct(&$conf) {
		parent::__construct($conf);
		$this->table = 'topic_views';
		$this->primarykey = array('fid','tid');
		
		// hook topic_views_construct_end.php
	}
	public function get_list($cond=array(),$rank=array('views'=>-1),$start=0,$limit=20){
		$list=$this->index_fetch($cond,$rank,$start,$limit);
		$ids=$newtopiclist=array();
		foreach($list as $v){
			$ids[]=array($v['fid'],$v['tid']);
		}
		$topiclist=$this->topic->mget($ids);

		foreach($topiclist as $k=>$v){
			if(empty($v)) continue;
			$this->topic->format($v);
			$newtopiclist[$v['tid']]=$v;
		}
		return $newtopiclist;
	}
}
?>