<?php
$menumark = 'cashout_list';
switch ($act) {
	//#####################@ 提现记录增加sql @#####################//
	case 'addsql':
	    $cashout_money=$_POST['cashout_money'];
		$cash_info['cashout_bankuname']=$_POST['user_tname'];
		$cash_info['cashout_bankid']=$_POST['user_alipay'];
		$cash_info['user_id'] = $_s_user_id;
		$cash_info['user_name'] = $_s_user_name;
		$cash_info['cashout_type'] = 1;
		$cash_info['cashout_atime'] = time();
		$cash_info['cashout_ip'] = pe_ip();
		$cash_info['cashout_num'] =date('YmdHis',TIME).random(4);
		$cashout_fee= $cashout_money * 0.05;
		if($cashout_money > 50){
		$cash_info['cashout_money'] = $cashout_money;
		$cash_info['cashout_paymoney'] = $cashout_money;
		$cash_info['cashout_fee'] = 0.00;
		}else{
		$cash_info['cashout_money'] =$cashout_money;
		$cash_info['cashout_fee'] = $cashout_fee;
		$cash_info['cashout_paymoney'] =$cashout_money - $cashout_fee;
		}
		$info['user_money']=$user['user_money']-$cashout_money;
		if($db->pe_update('user',array('user_id'=>$_s_user_id),$info)){
			if ($db->pe_insert('cashout', $cash_info)){
				pe_success('提现申请成功!等待管理员审核','user.php?mod=report&act=js');
			}else {
				pe_success('提现申请失败...');		
			}
		}else {
				pe_success('提现申请失败!!!...');		
		}
	break;
	
	//#####################@ 提现记录列表 @#####################//
	case 'list':
		$info_list = $db->pe_selectall('cashout', array('user_id'=>$_s_user_id, 'order by'=>'`cashout_id` desc'), '*', array(20, $_g_page));

		$user = $db->pe_select('user', array('user_id'=>$_s_user_id));
		$action = "user.php?mod=cashout&act=addsql";
		$seo = pe_seo('提现记录');
		include(pe_tpl('cashout_list.html'));
	break;
}
pe_result();
?>