<?php
/*
===========================注册模块控制器
*/
class cls_tab_sys_bingfa extends cls_base_table
{
	//每日数量
	function get_today($msg_key,$msg_num=1){
		global $obj_db;
		$msg_key=date("Ymd",TIME)."_".$msg_key;
		$obj_rs=$obj_db->get_one("select * from ".DB_PRE."sys_bingfa where bingfa_key='".$msg_key."'");
		if(!empty($obj_rs)){
			if($obj_rs["bingfa_num"]>=$msg_num) return $obj_rs["bingfa_num"];
			$obj_db->execute("update ".DB_PRE."sys_bingfa set bingfa_num=".$obj_rs["bingfa_num"]."+1 where bingfa_key='".$msg_key."'");
			$lng_num=$obj_rs["bingfa_num"];
		}else{
			$arr_fields=array("bingfa_key"=>$msg_key,"bingfa_num"=>1,"bingfa_addtime"=>TIME);
			parent::on_insert(DB_PRE."sys_bingfa",$arr_fields);
			$lng_num=0;
		}
		return $lng_num;
	}
	//总数量
	function get_total($msg_key,$msg_num=1){
		global $obj_db;
		$msg_key="total_".$msg_key;
		$obj_rs=$obj_db->get_one("select * from ".DB_PRE."sys_bingfa where bingfa_key='".$msg_key."'");
		if(!empty($obj_rs)){
			if($obj_rs["bingfa_num"]>=$msg_num) return $obj_rs["bingfa_num"];
			$lng_num=$obj_rs["bingfa_num"];
		}else{
			$arr_fields=array("bingfa_key"=>$msg_key,"bingfa_num"=>1,"bingfa_addtime"=>TIME);
			parent::on_insert(DB_PRE."sys_bingfa",$arr_fields);
			$lng_num=0;
		}
		return $lng_num;
	}

}
?>
