<?php

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

class type_count extends base_model {
	function __construct(&$conf) {
		parent::__construct($conf);
		$this->table = 'type_count';
		$this->primarykey = array('fid','typeid');
	}
	public function inc($fid,$typeid){
		$rs=$this->read($fid,$typeid);
		if(!$rs){
		   $this->create(array('fid'=>$fid,'typeid'=>$typeid,'topics'=>1));	
		}else{
		   $rs['topics']++;
		   $this->update($rs);	
		}
	}
	public function dec($fid,$typeid){
		$rs=$this->read($fid,$typeid);
		if($rs){
		    $rs['topics']--;
		    $this->update($rs);	
		}
	}
	
}
?>