<?php
$menumark = 'index';
switch ($act) {
	//#####################@ 首页 @#####################//
	case 'notice':
		$num=0;
		$where=array('userid'=>$_s_user_id,'status'=>1);
		$num=$db->pe_num('sitenotice',$where);
		include(pe_tpl('sitenotice.html'));
	break;
	case 'list':
		$arrnotice= $db->pe_selectall('sitenotice', array('userid'=>$_s_user_id,'order by'=>'status asc,id desc'));
		$seo = pe_seo('站内通知');
		include(pe_tpl('sitenotice_list.html'));
	break;
	case 'view':
		$r=$db->pe_select('sitenotice', array('id'=>$_g_id));
		$v = $db->pe_select('sitenotice_data', array('id'=>$r['noticeid']));
		if($v){
			$db->pe_update('sitenotice',array('id'=>$_g_id),array('status'=>9));
		}
		$info['package_name']=$v['title'];
		$info['package_text']=$v['content'];
		$seo = pe_seo('查看站内通知');
		include(pe_tpl('package_tg_show.html'));
	break;
	default:
		$tx_day=date('d',time());
		$tx_mon=date('m',time());
		$tx_year=date('Y',time());
		if($tx_day==01){
		$tx_time=date('Y-m-d',time());
		}elseif($tx_day==02){
		$tx_time=date('Y-m-d',time());
		}elseif($tx_day==03){
		$tx_time=date('Y-m-d',time());
		}else{
		$next_mon=date('m',strtotime('+1 month'));
		if($next_mon==12){
		$next_year=date('Y',strtotime('+1 year'));
		}else{
		$next_year=date('Y',time());
		}
		$tx_time="$next_year-$next_mon-01";
		}
		if($user['user_money']>=5.00 && $tx_day==01){
		$cash=1;
		}elseif($user['user_money']>=5.00 && $tx_day==02){
		$cash=2;
		}elseif($user['user_money']>=5.00 && $tx_day==03){
		$cash=3;
		}else{
		$cash=4;
		}    
		$arrWeekday=array(0=>'星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
        $getWeek=strtotime('-0 days');
		$getWeek_1=strtotime('-1 days');
		$getWeek_2=strtotime('-2 days');
		$getWeek_3=strtotime('-3 days');
		$getWeek_4=strtotime('-4 days');
		$getWeek_5=strtotime('-5 days');
		$getWeek_6=strtotime('-6 days');
		$getWeek_7=strtotime('-7 days');
		$getWeek_8=strtotime('-8 days');
		$getdate = date('Y-m-d' , strtotime('-0 day'));
        $getdate_1 = date('Y-m-d' , strtotime('-1 day'));
        $getdate_2 = date('Y-m-d' , strtotime('-2 day')); 
        $getdate_3 = date('Y-m-d' , strtotime('-3 day')); 
        $getdate_4 = date('Y-m-d' , strtotime('-4 day')); 
        $getdate_5 = date('Y-m-d' , strtotime('-5 day')); 
        $getdate_6 = date('Y-m-d' , strtotime('-6 day')); 
        $getdate_7 = date('Y-m-d' , strtotime('-7 day')); 
        $getdate_8 = date('Y-m-d' , strtotime('-8 day'));  		
		$weeknum = date("w", $getWeek);
		$weeknum_1 = date("w", $getWeek_1);
		$weeknum_2 = date("w", $getWeek_2);
		$weeknum_3 = date("w", $getWeek_3);
		$weeknum_4 = date("w", $getWeek_4);
		$weeknum_5 = date("w", $getWeek_5);
		$weeknum_6 = date("w", $getWeek_6);
		$weeknum_7 = date("w", $getWeek_7);
		$weeknum_8 = date("w", $getWeek_8);
        $nowweek = $arrWeekday[$weeknum];
		$nowweek_1 = $arrWeekday[$weeknum_1];
		$nowweek_2 = $arrWeekday[$weeknum_2];
		$nowweek_3 = $arrWeekday[$weeknum_3];
		$nowweek_4 = $arrWeekday[$weeknum_4];
		$nowweek_5 = $arrWeekday[$weeknum_5];
		$nowweek_6 = $arrWeekday[$weeknum_6];
		$nowweek_7 = $arrWeekday[$weeknum_7];
		$nowweek_8 = $arrWeekday[$weeknum_8];
		$nowdate = date("Y-m-d", time());
		if($getdate){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money= $sheet['tj_money'];
		}
		if($getdate_1){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_1'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_1= $sheet['tj_money'];
		}
		if($getdate_2){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_2'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_2= $sheet['tj_money'];
		}
		if($getdate_3){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_3'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_3= $sheet['tj_money'];
		}
		if($getdate_4){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_4'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_4= $sheet['tj_money'];
		}
		if($getdate_5){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_5'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_5= $sheet['tj_money'];
		}
		if($getdate_6){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_6'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_6= $sheet['tj_money'];
		}
        if($getdate_7){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_7'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_7= $sheet['tj_money'];
		}
		if($getdate_8){
		$sqlwhere = " and (`tj_uid` = '$_s_user_id') and `tj_date` = '$getdate_8'";
		$sheet = $db->pe_select('sheet', $sqlwhere);
		$now_money_8= $sheet['tj_money'];
		}
		
		$user = $db->pe_select('user', array('user_id'=>$_s_user_id));
		$signtime=date("Y-m-d",$user['user_sign_time']);
		$nowtime=date("Y-m-d",time());
		if($signtime == $nowtime){
		$sign_state=1;
		}else{
		$sign_state=0;
		}
		$menumark = 'package';
		$cache_packagetype = cache::get('packagetype');
		if(empty($_g_tid))
			$info_list = $db->pe_selectall('package');
		else {
			$info_list = $db->pe_selectall('package',array('package_type'=>$_g_tid));
			}
		$sql = "SELECT SUM(order_tjmoney) sum FROM ".dbpre."order where user_tjid='$_s_user_id' and order_isbuy='0' and order_state!='notpay'";
		$res = mysql_query($sql);
		$row = mysql_fetch_assoc($res);
		$money_sum=$row['sum'];	
		//佣金列表
		$sqlwhere .= " order by `brokerage_id` desc";
		$info = $db->pe_selectall('brokerage', $sqlwhere, '*', array(20, $_g_page));

		$seo = pe_seo('我的首页');
		include(pe_tpl('index.html'));
	break;
}
pe_result();
?>