<?php
require(dirname(__FILE__) .'/check.php');
$skin->CheckIframe();


/* **** 版权所有 ****

 程序开发：网钛科技
 网钛CMS官网：http://otcms.com
 网钛IDC官网：http://idccms.com
 ＱＱ：877873666
 微信：QQ877873666
 邮箱：877873666@qq.com

 **** 版权所有 **** */



//打开用户表，并检测用户是否登录
$MB->Open(',MB_foreUsername','login');

$skin->WebTop();


echo('
<script language="javascript" type="text/javascript" src="js/inc/calc.js?v='. OT_VERSION .'"></script>
<script language="javascript" type="text/javascript" src="js/inc/list.js?v='. OT_VERSION .'"></script>
<script language="javascript" type="text/javascript" src="js/vpsApiUsers.js?v='. OT_VERSION .'"></script>
');


switch ($mudi){
	case 'sel':
		$MB->IsSecMenuRight('alertBack',351,$dataType);
		sel();
		break;

	case 'add': // case 'rev':
		$MB->IsSecMenuRight('alertBack',353,$dataType);
		AddOrRev();
		break;

	case 'manage':
		$MB->IsSecMenuRight('alertBack',351,$dataType);
		manage();
		break;

	case 'tixingManage':
		$MB->IsSecMenuRight('alertBack',357,$dataType);
		TixingManage();
		break;

	case 'show':
		$MB->IsSecMenuRight('alertClose',354,$dataType);
		show();
		break;

	case 'cpManage':
		$MB->IsSecMenuRight('alertClose',354,$dataType);
		CpManage();
		break;

	case 'import':
		$MB->IsSecMenuRight('alertBack',356,$dataType);
		importWeb();
		break;

	default:
		die('err');
}

$skin->WebBottom();

$MB->Close();
$DB->Close();





// 选择
function sel(){
	global $DB,$MB,$skin,$mudi,$dataType,$dataTypeCN;

	$mudi2		= OT::GetStr('mudi2');
	$dataMode	= OT::GetStr('dataMode');
	$dataModeStr= OT::GetStr('dataModeStr');
	$backURL	= OT::GetStr('backURL');
		if ($mudi2 != 'import'){ $mudi2 = 'add'; }

	$apiArr = IdcArea::VpsApiArr('','name');	// 获取接口类型数组

	$showexe = $DB->query('select VT_ID,VT_theme from '. OT_dbPref .'vpsType where VT_ID in (select distinct VAD_typeID from '. OT_dbPref .'vpsApiData where VAD_state=1) order by VT_rank ASC');
	while ($row = $showexe->fetch()){
		echo('
		<table width="99%" align="center" cellpadding="0" cellspacing="0" summary="" style="margin-top:15px;"><tr><td>
		<fieldset style="padding:10px 10px 18px 10px;"><legend class="font2_1">'. $row['VT_theme'] .'&ensp;</legend>
		');

		$dataexe = $DB->query('select VAD_ID,VAD_theme,VAD_apiID,VAD_useMenuStr,VAD_guajibaoNum from '. OT_dbPref .'vpsApiData where VAD_typeID='. $row['VT_ID'] .' and VAD_state=1 order by VAD_rank ASC');
		while ($row2 = $dataexe->fetch()){
			$themeAddi = '';
			if ($row2['VAD_apiID'] > 0){
				$themeAddi .= '<img src="images/usb.png" style="margin:0 5px;" title="API接口：'. $apiArr[$row2['VAD_apiID']] .'" alt="API接口：'. $apiArr[$row2['VAD_apiID']] .'" />';
			}
			if (strpos(''. $row2['VAD_useMenuStr'],'|guajibao|') !== false){
				$themeAddi .= '&ensp;<span style="color:blue;">[剩<span style="color:red;">'. $row2['VAD_guajibaoNum'] .'</span>台]</span> ';
			}
			echo('
			<div class="tabItem"><a href="?mudi='. $mudi2 .'&proDataID='. $row2['VAD_ID'] .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&backURL='. urlencode($backURL) .'">'. $row2['VAD_theme'] . $themeAddi .'</a></div>
			');
		}
		unset($dataexe);

		echo('
		</fieldset>
		</table>
		');
	}
	unset($showexe);

}



// 新增、修改
function AddOrRev(){
	global $DB,$MB,$skin,$mudi,$dataType,$dataTypeCN;

	$mudi2		= OT::GetStr('mudi2');
	$dataMode	= OT::GetStr('dataMode');
	$dataModeStr= OT::GetStr('dataModeStr');
	$backURL	= OT::GetStr('backURL');
	$dataID		= OT::GetInt('dataID');
	$proDataID	= OT::GetInt('proDataID');

	$guajibaoStr = '';
	if ($mudi == 'rev' || $mudi2 == 'copy'){
		$revexe=$DB->query('select * from '. OT_dbPref .'vpsApiUsers where VAU_ID='. $dataID);
		if (! $row = $revexe->fetch()){
			JS::AlertBackEnd('无该记录！');
		}
		$VAU_time			= $row['VAU_time'];
		$VAU_endTime		= $row['VAU_endTime'];
		$VAU_proDataID		= $row['VAU_proDataID'];
		$VAU_proDataName	= $row['VAU_proDataName'];
		$VAU_userID			= $row['VAU_userID'];
		$VAU_username		= $row['VAU_username'];
		$VAU_vpsName		= $row['VAU_vpsName'];
		$VAU_vpsPwd			= Encrypt::SyEnDe('de',$row['VAU_vpsPwd']);
		$VAU_system			= $row['VAU_system'];
		$VAU_vpsEndTime		= $row['VAU_vpsEndTime'];
		$VAU_payMode		= $row['VAU_payMode'];
		$VAU_price			= $row['VAU_price'];
		$VAU_cost			= $row['VAU_cost'];
		$VAU_note			= $row['VAU_note'];
		$VAU_adminNote		= $row['VAU_adminNote'];
		$VAU_state			= $row['VAU_state'];
		unset($revexe);

		if ($mudi2 == 'copy'){
			$VAU_ipStr			= '';
			$VAU_isUserPay		= 1;
			$dataID = 0;
			$mudiCN = '再次开通';
		}else{
			$VAU_ipStr			= $row['VAU_ipStr'];
			$VAU_isUserPay		= $row['VAU_isUserPay'];
			$mudiCN = '修改';
		}
	}else{
		$VAU_time			= TimeDate::Get();
		$VAU_endTime		= '';
		$VAU_proDataID		= $proDataID;
		$VAU_proDataName	= '';
		$VAU_userID			= 0;
		$VAU_username		= $MB->mMbRow['MB_foreUsername'];
		$VAU_vpsName		= '';
		$VAU_vpsPwd			= IdcArea::IdcRndPwd('vpsApi');
		$VAU_system			= '';
		$VAU_vpsEndTime		= '';
		$VAU_ipStr			= '';
		$VAU_payMode		= '';
		$VAU_price			= '';
		$VAU_cost			= '';
		$VAU_note			= '';
		$VAU_isUserPay		= 1;
		$VAU_adminNote		= '';
		$VAU_state			= 10;

		$mudiCN = '添加';
	}

	$proexe = $DB->query('select VAD_apiID,VAD_companyID,VAD_typeID,VAD_theme,VAD_useTimeStr,VAD_priceMonth,VAD_costMonth,VAD_priceDay,VAD_costDay,VAD_priceWeek,VAD_costWeek,VAD_price3Month,VAD_cost3Month,VAD_price6Month,VAD_cost6Month,VAD_priceYear,VAD_costYear,VAD_price2Year,VAD_cost2Year,VAD_price3Year,VAD_cost3Year,VAD_price4Year,VAD_cost4Year,VAD_price5Year,VAD_cost5Year,VAD_minPrice,VAD_comProID,VAD_useMenuStr from '. OT_dbPref .'vpsApiData where VAD_ID='. $proDataID);
	if (! $row = $proexe->fetch()){
		JS::AlertBackEnd('云服务器类型无该记录！');
	}else{
		$VAD_apiID			= $row['VAD_apiID'];
		$VAD_companyID		= $row['VAD_companyID'];
		$VAD_typeID			= $row['VAD_typeID'];
		$VAD_theme			= $row['VAD_theme'];
		$VAD_useTimeStr		= $row['VAD_useTimeStr'] .'';
		$VAD_priceMonth		= $row['VAD_priceMonth'];
		$VAD_costMonth		= $row['VAD_costMonth'];
		$VAD_priceDay		= $row['VAD_priceDay'];
		$VAD_costDay		= $row['VAD_costDay'];
		$VAD_priceWeek		= $row['VAD_priceWeek'];
		$VAD_costWeek		= $row['VAD_costWeek'];
		$VAD_price3Month	= $row['VAD_price3Month'];
		$VAD_cost3Month		= $row['VAD_cost3Month'];
		$VAD_price6Month	= $row['VAD_price6Month'];
		$VAD_cost6Month		= $row['VAD_cost6Month'];
		$VAD_priceYear		= $row['VAD_priceYear'];
		$VAD_costYear		= $row['VAD_costYear'];
		$VAD_price2Year		= $row['VAD_price2Year'];
		$VAD_cost2Year		= $row['VAD_cost2Year'];
		$VAD_price3Year		= $row['VAD_price3Year'];
		$VAD_cost3Year		= $row['VAD_cost3Year'];
		$VAD_price4Year		= $row['VAD_price4Year'];
		$VAD_cost4Year		= $row['VAD_cost4Year'];
		$VAD_price5Year		= $row['VAD_price5Year'];
		$VAD_cost5Year		= $row['VAD_cost5Year'];
		$VAD_minPrice		= $row['VAD_minPrice'];
		$VAD_comProID		= $row['VAD_comProID'];
		$VAD_useMenuStr		= $row['VAD_useMenuStr'] .'';
		if (strpos($VAD_useMenuStr,'|guajibao|') !== false){
			$num = AppVpsApiDeal::GuajibaoNum($proDataID, $VAD_comProID);
			$guajibaoStr = '&ensp;<a href="http://api.ipcomserver.com/user/vps-serverID.asp?id='. $VAD_comProID .'" target="_blank" style="color:blue;">[预估剩 <span style="color:red;font-weight:bold;">'. $num .'</span> 台]</a>';
		}

		$classID = $DB->GetOne('select VT_classID from '. OT_dbPref .'vpsType where VT_ID='. $VAD_typeID);			
		if ($classID > 0){
			$classexe = $DB->query('select VC_prefName,VC_useNum,VC_numLen from '. OT_dbPref .'vpsClass where VC_ID='. $classID);
			if ($row2 = $classexe->fetch()){
				$VC_prefName	= $row2['VC_prefName'];
				$VC_useNum		= $row2['VC_useNum']+1;
				$VC_numLen		= $row2['VC_numLen'];
				$VAU_vpsName	= $row2['VC_prefName'] . Str::FixLen($VC_useNum, $row2['VC_numLen']);
			}
		}
	}
	unset($proexe);

	$vpsSysArr = Cache::PhpFile('vpsSys');

	$itemStr = '';
	if ($VAD_apiID == 1 || $VAD_apiID == 6){
		if ($VAD_apiID == 1 && (! AppXingwai::Jud())){
			JS::AlertBackEnd('请先购买“IDC接口_星外”插件，才能使用。');
		}
		$itemStr = '
			<tr>
				<td align="right">'. Skin::RedSign() .'选择母机：</td>
				<td align="left">
					<select id="comServID" name="comServID">
					<option value="0">默认</option>
					';
					$prev7DayDate		= TimeDate::Add("d",-7,TimeDate::Get('date'));

					$servexe = $DB->query('select XS_num,XS_theme,XS_isSel,XS_startNum,XS_maxNum from '. OT_dbPref .'xingwaiServ where XS_state=1 and XS_useArea like "%[vpsApi'. $proDataID .']%" order by XS_rank ASC');
					while ($row = $servexe->fetch()){
						$currNum = $DB->GetOne('select count(VAU_ID) from '. OT_dbPref .'vpsApiUsers where VAU_comServID='. $row['XS_num'] .' and VAU_state in (10,12) and VAU_endTime>='. $prev7DayDate);
						$itemStr .= '<option value="'. $row['XS_num'] .'" '. Is::Selected($row['XS_isSel'],1) .'>'. $row['XS_theme'] .' （'. ($row['XS_startNum']+$currNum) .'/'. $row['XS_maxNum'] .'）'. ($row['XS_isSel'] == 1 ? '[默认]' : '') .'</option>';
					}
					unset($servexe);
					$itemStr .= '
					</select>
				</td>
			</tr>
			<tr>
				<td align="right">'. Skin::RedSign() .'云服务器密码：</td>
				<td align="left">
					<input type="text" id="vpsPwd" name="vpsPwd" size="50" style="width:120px;" value="'. $VAU_vpsPwd .'" onkeyup="if (this.value!=FiltAbcNum_(this.value)){this.value=FiltAbcNum_(this.value)}" />&ensp;&ensp;
					<input type="button" value="随机生成" onclick="$id(\'vpsPwd\').value=IdcRndPwd(\'vpsApi\');" />
				</td>
			</tr>
			';
	}elseif ($VAD_apiID == 2){
		if (! AppJingan::Jud()){
			JS::AlertBackEnd('请先购买“IDC接口_景安网络”插件，才能使用。');
		}
		$sysOption = IdcArea::JinganSystemOption($VAD_companyID,$VAU_system);

		$itemStr = '
			<tr>
				<td align="right">'. Skin::RedSign() .'操作系统：</td>
				<td align="left">
					<select id="system" name="system">
					<option value=""></option>
					'. $sysOption .'
					</select>
				</td>
			</tr>
			<tr style="display:none;">
				<td align="right">'. Skin::RedSign() .'云服务器密码：</td>
				<td align="left">
					<input type="text" id="vpsPwd" name="vpsPwd" size="50" style="width:120px;" value="'. $VAU_vpsPwd .'" onkeyup="if (this.value!=FiltAbcNum_(this.value)){this.value=FiltAbcNum_(this.value)}" />&ensp;&ensp;
					<input type="button" value="随机生成" onclick="$id(\'vpsPwd\').value=IdcRndPwd(\'vpsApi\');" />
				</td>
			</tr>
			';
	}elseif ($VAD_apiID == 0){
		$itemStr = '
			<tr>
				<td align="right">'. Skin::RedSign() .'云服务器密码：</td>
				<td align="left">
					<input type="text" id="vpsPwd" name="vpsPwd" size="50" style="width:120px;" value="'. $VAU_vpsPwd .'" />&ensp;&ensp;
					<input type="button" value="随机生成" onclick="$id(\'vpsPwd\').value=IdcRndPwd(\'vpsApi\');" />
				</td>
			</tr>
			<tr>
				<td align="right">'. Skin::RedSign() .'开通时间：</td>
				<td align="left">
					<input type="text" id="time" name="time" size="22" style="width:170px;" value="'. $VAU_time .'" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss"})\' class="Wdate" />
				</td>
			</tr>
			<tr>
				<td align="right" valign="top" style="padding-top:6px;">'. Skin::RedSign() .'IP地址：</td>
				<td align="left">
					<textarea id="ipStr" name="ipStr" style="width:400px;height:60px;">'. $VAU_ipStr .'</textarea>
					<span class="font2_2">（一行一个IP）</span>
				</td>
			</tr>
			<tr>
				<td align="right" valign="top" style="padding-top:6px;">上级API到期时间：</td>
				<td align="left">
					<input type="text" id="vpsEndTime" name="vpsEndTime" size="22" style="width:170px;" value="'. $VAU_vpsEndTime .'" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss"})\' class="Wdate" />
					<span class="font2_2">（留空的话该时间等于到期时间）</span>
				</td>
			</tr>
			';
	}

	echo('
	<form id="dealForm" name="dealForm" method="post" action="vpsApiUsers_deal.php?mudi='. $mudi .'&nohrefStr=close" onsubmit="return CheckForm()">
	<input type="hidden" id="dataMode" name="dataMode" value="'. $dataMode .'" />
	<input type="hidden" id="dataModeStr" name="dataModeStr" value="'. $dataModeStr .'" />
	<input type="hidden" id="dataType" name="dataType" value="'. $dataType .'" />
	<input type="hidden" id="dataTypeCN" name="dataTypeCN" value="'. $dataTypeCN .'" />
	<input type="hidden" id="dataID" name="dataID" value="'. $dataID .'" />
	<input type="hidden" id="proDataID" name="proDataID" value="'. $VAU_proDataID .'" />
	<input type="hidden" id="apiID" name="apiID" value="'. $VAD_apiID .'" />

	<input type="hidden" id="payModeOld" name="payModeOld" value="'. $VAU_payMode .'" />
	<input type="hidden" id="usernameOld" name="usernameOld" value="'. $VAU_username .'" />
	<input type="hidden" id="userIdOld" name="userIdOld" value="'. $VAU_userID .'" />
	<input type="hidden" id="classID" name="classID" value="'. $classID .'" />
	<input type="hidden" id="prefName" name="prefName" value="'. $VC_prefName .'" />
	<input type="hidden" id="useNum" name="useNum" value="'. $VC_useNum .'" />
	<input type="hidden" id="numLen" name="numLen" value="'. $VC_numLen .'" />

	<input type="hidden" id="price24Hour" name="price24Hour" value="'. $VAD_priceMonth .'" />
	<input type="hidden" id="cost24Hour" name="cost24Hour" value="'. $VAD_costMonth .'" />
	<input type="hidden" id="price48Hour" name="price48Hour" value="'. $VAD_priceYear .'" />
	<input type="hidden" id="cost48Hour" name="cost48Hour" value="'. $VAD_costYear .'" />
	<input type="hidden" id="priceMonth" name="priceMonth" value="'. $VAD_priceMonth .'" />
	<input type="hidden" id="costMonth" name="costMonth" value="'. $VAD_costMonth .'" />
	<input type="hidden" id="priceDay" name="priceDay" value="'. $VAD_priceDay .'" />
	<input type="hidden" id="costDay" name="costDay" value="'. $VAD_costDay .'" />
	<input type="hidden" id="priceWeek" name="priceWeek" value="'. $VAD_priceWeek .'" />
	<input type="hidden" id="costWeek" name="costWeek" value="'. $VAD_costWeek .'" />
	<input type="hidden" id="price3Month" name="price3Month" value="'. $VAD_price3Month .'" />
	<input type="hidden" id="cost3Month" name="cost3Month" value="'. $VAD_cost3Month .'" />
	<input type="hidden" id="price6Month" name="price6Month" value="'. $VAD_price6Month .'" />
	<input type="hidden" id="cost6Month" name="cost6Month" value="'. $VAD_cost6Month .'" />
	<input type="hidden" id="priceYear" name="priceYear" value="'. $VAD_priceYear .'" />
	<input type="hidden" id="costYear" name="costYear" value="'. $VAD_costYear .'" />
	<input type="hidden" id="price2Year" name="price2Year" value="'. $VAD_price2Year .'" />
	<input type="hidden" id="cost2Year" name="cost2Year" value="'. $VAD_cost2Year .'" />
	<input type="hidden" id="price3Year" name="price3Year" value="'. $VAD_price3Year .'" />
	<input type="hidden" id="cost3Year" name="cost3Year" value="'. $VAD_cost3Year .'" />
	<input type="hidden" id="price4Year" name="price4Year" value="'. $VAD_price4Year .'" />
	<input type="hidden" id="cost4Year" name="cost4Year" value="'. $VAD_cost4Year .'" />
	<input type="hidden" id="price5Year" name="price5Year" value="'. $VAD_price5Year .'" />
	<input type="hidden" id="cost5Year" name="cost5Year" value="'. $VAD_cost5Year .'" />
	'. Area::BackUrlInput($backURL) .'
	');

	$skin->TableTop('share_'. $mudi .'.gif','',$mudiCN .'云服务器');
		echo('
		<table width="98%" align="center" cellpadding="0" cellspacing="0" summary="" class="padd3td">
		<tr>
			<td width="160"></td>
			<td></td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'产品名称：</td>
			<td align="left">'. $VAD_theme . AdmIdc::JinganBaoxiaoInfo($VAD_apiID, $proDataID, 'vpsApi', '') . $guajibaoStr .'</td>
		</tr>
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">用户名：</td>
			<td align="left">
				<input type="text" id="username" name="username" size="50" style="width:120px;" value="'. $VAU_username .'" onblur="CheckUserInfo(this.value,\'&proType=vpsApi&proID='. $VAU_proDataID .'&minPrice='. $VAD_minPrice .'\')" />&ensp;&ensp;
				<input type="button" value="选择用户" onclick="OpenSelUserBox(\'username\',\'username\',\'vpsApiUsers\')" /><!-- 文本框ID，调用字段名，表名 -->
				<input type="button" value="创建临时用户" onclick="OpenCreateUserBox(\'username\',\'username\',\'vpsApiUsers\')" />
				<span id="usernameRes" style="color:red;"></span>
				<span id="selUserBox" style="display:none;"></span>
				<span id="createUserBox" style="display:none;"></span>
				<script language="javascript" type="text/javascript">CheckUserInfo($id("username").value,"");</script>
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'机器编码：</td>
			<td align="left">
			');
			if ($vpsSysArr['VS_prefIsRev'] == 1){
				echo('
				<input type="text" id="vpsName" name="vpsName" size="50" style="width:120px;" value="'. $VAU_vpsName .'" />&ensp;&ensp;
				<input type="button" value="唯一性检测" onclick="CheckVpsName()" />
				<label><input type="checkbox" name="isAutoName" value="1" checked="checked" />如被占用，自动命名</label>&ensp;&ensp;
				');
			}else{
				echo($VAU_vpsName .'<input type="hidden" id="vpsName" name="vpsName" value="'. $VAU_vpsName .'" /><input type="hidden" name="isAutoName" value="1" />');
			}
			echo('
			</td>
		</tr>
		'. $itemStr .'
		<tr>
			<td align="right">'. Skin::RedSign() .'付款方式：</td>
			<td align="left">
				<select id="payMode" name="payMode" onchange="CheckPayMode()">
					<option value=""></option>
					');
					/*
					echo('<option value="24hour" '. Is::Selected($VAU_payMode,'24hour') .'>试用24小时</option>');
					if ($VAD_apiID == 1 || $VAD_apiID == 6){
						echo('
						<option value="48hour" '. Is::Selected($VAU_payMode,'48hour') .'>试用48小时</option>
						<option value="day" '. Is::Selected($VAU_payMode,'day') .'>日付 （价格：'. $VAD_priceDay .'，成本：'. $VAD_costDay .'）</option>
						<option value="week" '. Is::Selected($VAU_payMode,'week') .'>周付 （价格：'. $VAD_priceWeek .'，成本：'. $VAD_costWeek .'）</option>
						');
					}
					echo('
					<option value="month" '. Is::Selected($VAU_payMode,'month') .'>月付 （价格：'. $VAD_priceMonth .'，成本：'. $VAD_costMonth .'）</option>
					<option value="3month" '. Is::Selected($VAU_payMode,'3month') .'>季付 （价格：'. $VAD_price3Month .'，成本：'. $VAD_cost3Month .'）</option>
					<option value="6month" '. Is::Selected($VAU_payMode,'6month') .'>半年付 （价格：'. $VAD_price6Month .'，成本：'. $VAD_cost6Month .'）</option>
					<option value="year" '. Is::Selected($VAU_payMode,'year') .'>一年付 （价格：'. $VAD_priceYear .'，成本：'. $VAD_costYear .'）</option>
					<option value="2year" '. Is::Selected($VAU_payMode,'2year') .'>二年付 （价格：'. $VAD_price2Year .'，成本：'. $VAD_cost2Year .'）</option>
					<option value="3year" '. Is::Selected($VAU_payMode,'3year') .'>三年付 （价格：'. $VAD_price3Year .'，成本：'. $VAD_cost3Year .'）</option>
					<option value="4year" '. Is::Selected($VAU_payMode,'4year') .'>四年付 （价格：'. $VAD_price4Year .'，成本：'. $VAD_cost4Year .'）</option>
					<option value="5year" '. Is::Selected($VAU_payMode,'5year') .'>五年付 （价格：'. $VAD_price5Year .'，成本：'. $VAD_cost5Year .'）</option>
					');
					*/
					if ($VAD_apiID == 2){
						if (strpos($VAD_useTimeStr,'|24hour|') !== false){ echo('<option value="24hour" '. Is::Selected($VAU_payMode,'24hour') .'>试用1天，后转正为月付</option>'); }
						if (strpos($VAD_useTimeStr,'|48hour|') !== false){ echo('<option value="48hour" '. Is::Selected($VAU_payMode,'48hour') .'>试用1天，后转正为年付</option>'); }
					}else{
						if (strpos($VAD_useTimeStr,'|24hour|') !== false){ echo('<option value="24hour" '. Is::Selected($VAU_payMode,'24hour') .'>试用24小时</option>'); }
						if (strpos($VAD_useTimeStr,'|48hour|') !== false){ echo('<option value="48hour" '. Is::Selected($VAU_payMode,'48hour') .'>试用48小时</option>'); }
					}
					if (strpos($VAD_useTimeStr,'|day|') !== false){ echo('<option value="day" '. Is::Selected($VAU_payMode,'day') .'>日付 （价格：'. $VAD_priceDay .'，成本：'. $VAD_costDay .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|week|') !== false){ echo('<option value="week" '. Is::Selected($VAU_payMode,'week') .'>周付 （价格：'. $VAD_priceWeek .'，成本：'. $VAD_costWeek .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|month|') !== false){ echo('<option value="month" '. Is::Selected($VAU_payMode,'month') .'>月付 （价格：'. $VAD_priceMonth .'，成本：'. $VAD_costMonth .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|3month|') !== false){ echo('<option value="3month" '. Is::Selected($VAU_payMode,'3month') .'>季付 （价格：'. $VAD_price3Month .'，成本：'. $VAD_cost3Month .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|6month|') !== false){ echo('<option value="6month" '. Is::Selected($VAU_payMode,'6month') .'>半年付 （价格：'. $VAD_price6Month .'，成本：'. $VAD_cost6Month .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|year|') !== false){ echo('<option value="year" '. Is::Selected($VAU_payMode,'year') .'>一年付 （价格：'. $VAD_priceYear .'，成本：'. $VAD_costYear .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|2year|') !== false){ echo('<option value="2year" '. Is::Selected($VAU_payMode,'2year') .'>二年付 （价格：'. $VAD_price2Year .'，成本：'. $VAD_cost2Year .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|3year|') !== false){ echo('<option value="3year" '. Is::Selected($VAU_payMode,'3year') .'>三年付 （价格：'. $VAD_price3Year .'，成本：'. $VAD_cost3Year .'）</option>'); }
					/*
					if (strpos($VAD_useTimeStr,'|4year|') !== false){ echo('<option value="4year" '. Is::Selected($VAU_payMode,'4year') .'>四年付 （价格：'. $VAD_price4Year .'，成本：'. $VAD_cost4Year .'）</option>'); }
					if (strpos($VAD_useTimeStr,'|5year|') !== false){ echo('<option value="5year" '. Is::Selected($VAU_payMode,'5year') .'>五年付 （价格：'. $VAD_price5Year .'，成本：'. $VAD_cost5Year .'）</option>'); }
					*/
				echo('
				</select>
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'销售价格：</td>
			<td align="left">
				<input type="text" id="price" name="price" size="10" style="width:60px;" value="'. $VAU_price .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
				&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;
				成本：<input type="text" id="cost" name="cost" size="10" style="width:60px;" value="'. $VAU_cost .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
			</td>
		</tr>
		<tr id="moneyNoteBox">
			<td align="right">'. Skin::RedSign() .'不扣款说明：</td>
			<td align="left">
				<input type="text" id="moneyNote" name="moneyNote" size="22" style="width:209px;" value=""/>
				<select onchange="if (this.value!=\'\'){$id(\'moneyNote\').value = this.value;}">
					<option value="">候选项</option>
					'. Info::TypeOptionList('moneyNote', '在【IDC设置】-【不扣款说明管理】里设置候选项') .'
				</select>
				<span class="font2_2">(会显示在财务信息里)</span>
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'扣款：</td>
			<td align="left">
				<label><input type="radio" id="isUserPay0" name="isUserPay" value="0" '. Is::Checked($VAU_isUserPay,0) .' onclick="CheckKaitongPay();" />不扣款</label>&ensp;&ensp;&ensp;&ensp;
				<label><input type="radio" id="isUserPay1" name="isUserPay" value="1" '. Is::Checked($VAU_isUserPay,1) .' onclick="CheckKaitongPay();CalcUserRemMoney(\'userPayRemMoney\',\'add\');" />从用户金额中扣款</label>&ensp;&ensp;<span id="userPayRemMoney" style="color:red;"></span>&ensp;&ensp;
				<script language="javascript" type="text/javascript">CheckKaitongPay();CalcUserRemMoney(\'userPayRemMoney\',\'add\');</script>
			</td>
		</tr>
		<tr style="display:none;">
			<td align="right">'. Skin::RedSign() .'状态：</td>
			<td align="left">
				<label><input type="radio" name="state" value="10" '. Is::Checked($VAU_state,10) .' />正常</label>&ensp;&ensp;&ensp;&ensp;
				<label><input type="radio" name="state" value="0" '. Is::Checked($VAU_state,0) .' />停止</label>&ensp;&ensp;&ensp;&ensp;
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">前台管理员备注：</td>
			<td align="left">
				<textarea id="note" name="note" style="width:400px;height:60px;">'. $VAU_note .'</textarea>
				<span class="font2_2">（前台会员可见）</span>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">内部备注：</td>
			<td align="left">
				<textarea id="adminNote" name="adminNote" style="width:400px;height:60px;">'. $VAU_adminNote .'</textarea>
				<span class="font2_2">（仅限后台用户查看）</span>
			</td>
		</tr>
		</table>
		');
	$skin->TableBottom();

	echo('
	<table style="height:16px;" cellpadding="0" cellspacing="0" summary=""><tr><td></td></tr></table>

	<center><input type="image" src="'. AdmTpl::ImgSrc('button_'. $mudi) .'" /></center>

	</form>
	');

}



function manage(){
	global $DB,$MB,$skin,$mudi,$dataType,$dataTypeCN,$pageCount,$recordCount;

	$todayDate = TimeDate::Get('date');

	$dataMode		= OT::GetStr('dataMode');
	$dataModeStr	= OT::GetStr('dataModeStr');

	$refProName		= OT::GetRegExpStr('refProName','sql');
	$refUsername	= OT::GetRegExpStr('refUsername','sql');
	$refQQ			= OT::GetRegExpStr('refQQ','sql');
	$refVpsName		= OT::GetRegExpStr('refVpsName','sql+,');
	$refState		= OT::GetInt('refState',-1);
	$refIsAuth		= OT::GetInt('refIsAuth');
	$refIsGuanlian	= OT::GetInt('refIsGuanlian');
	$refIpStr		= OT::GetRegExpStr('refIpStr','sql+.');
	$refAdminNote	= OT::GetRegExpStr('refAdminNote','sql');
	$refAdminName	= OT::GetRegExpStr('refAdminName','sql');
	$refCalcPrice	= OT::GetInt('refCalcPrice');
	$refDel			= OT::GetInt('refDel');
	$refMorePro		= OT::GetInt('refMorePro');
	$judOverDay		= OT::GetInt('judOverDay');
	$judLessDay		= OT::GetInt('judLessDay');
	$refMark		= OT::GetInt('refMark');
	$refNoMail		= OT::GetInt('refNoMail');
	$refNoPhone		= OT::GetInt('refNoPhone');
	$refNoWeixin	= OT::GetInt('refNoWeixin');
	$refApiRestart	= OT::GetInt('refApiRestart');
	$refApiManage	= OT::GetInt('refApiManage');
	$refDate1		= OT::GetStr('refDate1');
		if (! strtotime($refDate1)){ $refDate1=''; }
	$refDate2		= OT::GetStr('refDate2');
		if (! strtotime($refDate2)){ $refDate2=''; }
	$refEndDate1		= OT::GetStr('refEndDate1');
		if (strtotime($refEndDate1)==false){$refEndDate1='';}
	$refEndDate2		= OT::GetStr('refEndDate2');
		if (strtotime($refEndDate2)==false){$refEndDate2='';}
	$refVpsEndDate1		= OT::GetStr('refVpsEndDate1');
		if (strtotime($refVpsEndDate1)==false){$refVpsEndDate1='';}
	$refVpsEndDate2		= OT::GetStr('refVpsEndDate2');
		if (strtotime($refVpsEndDate2)==false){$refVpsEndDate2='';}

	$sqlFieldStr = 'VAU_ID,VAU_apiID,VAU_companyID,VAU_proDataID,VAU_proDataName,VAU_userID,VAU_username,VAU_vpsName,VAU_vpsEndTime,VAU_comServID,VAU_system,VAU_osName,VAU_ipStr,VAU_vpsPort,VAU_vpsUser,VAU_vpsPwd,VAU_payMode,VAU_price,VAU_cost,VAU_time,VAU_endTime,VAU_state,VAU_adminNote,UE_realname,UE_qq,UE_ww,VAU_event,VAU_adminID,VAU_adminName,VAU_isAuth,VAU_isAutoXufei';
	$SQLstr='select '. $sqlFieldStr .' from '. OT_dbPref .'vpsApiUsers as VAU left join '. OT_dbPref .'users as UE on VAU.VAU_userID=UE.UE_ID where 1=1';

	if ($refProName!=''){ $SQLstr .= " and VAU_proDataName like '%". $DB->ForStr($refProName,false) ."%'"; }
	if ($refUsername!=''){ $SQLstr .= " and VAU_username like '%". $DB->ForStr($refUsername,false) ."%'"; }
	if ($refQQ!=''){ $SQLstr .= " and (UE_realname like '%". $DB->ForStr($refQQ,false) ."%' or UE_qq like '%". $DB->ForStr($refQQ,false) ."%' or UE_ww like '%". $DB->ForStr($refQQ,false) ."%')"; }
	if ($refVpsName!=''){
		if (strpos($refVpsName,',') !== false){
			$SQLstr .= " and VAU_vpsName in ('". str_replace(',',"','",$refVpsName) ."')";
		}else{
			$SQLstr .= " and VAU_vpsName like '%". $DB->ForStr($refVpsName,false) ."%'";
		}
	}
	if ($refState == 99){ $SQLstr .= ' and VAU_lastApiTime like "%01:00:00%"'; }
	elseif ($refState>-1){ $SQLstr .= ' and VAU_state='. $refState .''; }
	if ($refIsAuth == 1){ $SQLstr .= " and VAU_isAuth=1"; }
	if ($refIsGuanlian == 1){ $SQLstr .= " and VAU_event like '%|auth|%'"; }
	if ($refIpStr!=''){ $SQLstr .= " and VAU_ipStr like '%". $DB->ForStr($refIpStr,false) ."%'"; }
	if ($refAdminNote!=''){ $SQLstr .= " and VAU_adminNote like '%". $DB->ForStr($refAdminNote,false) ."%'"; }
	if ($refAdminName!=''){ $SQLstr .= " and VAU_adminName like '%". $DB->ForStr($refAdminName,false) ."%'"; }
	if ($refDate1!=''){ $SQLstr .= ' and VAU_time>='. $DB->ForTime($refDate1); }
	if ($refDate2!=''){ $SQLstr .= ' and VAU_time<'. $DB->ForTime(TimeDate::Add('d',1,$refDate2)); }
	if ($refEndDate1!=''){ $SQLstr .= ' and VAU_endTime>='. $DB->ForTime($refEndDate1); }
	if ($refEndDate2!=''){ $SQLstr .= ' and VAU_endTime<'. $DB->ForTime(TimeDate::Add('d',1,$refEndDate2)); }
	if ($refVpsEndDate1!=''){ $SQLstr .= ' and VAU_vpsEndTime>='. $DB->ForTime($refVpsEndDate1); }
	if ($refVpsEndDate2!=''){ $SQLstr .= ' and VAU_vpsEndTime<'. $DB->ForTime(TimeDate::Add('d',1,$refVpsEndDate2)); }
	if ($refDel == 1){ $SQLstr .= ' and (VAU_endTime<='. $DB->ForTime(TimeDate::Add('d', -8, $todayDate)) .' or VAU_state in (0,3,6,9))'; }
	if ($judOverDay == 1){
		$vpsSysArr = Cache::PhpFile('vpsSys');
		$SQLstr .= ' and to_days(VAU_endTime) - to_days(VAU_vpsEndTime) > '. $vpsSysArr['VS_overApiDay'];
	}elseif ($judLessDay == 1){
		$vpsSysArr = Cache::PhpFile('vpsSys');
		$SQLstr .= ' and to_days(VAU_vpsEndTime) - to_days(VAU_endTime) > '. $vpsSysArr['VS_lessApiDay'];
	}
	if ($refMark == 1){ $SQLstr .= ' and VAU_event like "%|mark|%"'; }
	if ($refNoMail == 1){ $SQLstr .= ' and VAU_event like "%|noMail|%"'; }
	if ($refNoPhone == 1){ $SQLstr .= ' and VAU_event like "%|noPhone|%"'; }
	if ($refNoWeixin == 1){ $SQLstr .= ' and VAU_event like "%|noWeixin|%"'; }
	if ($refApiRestart == 1){ $SQLstr .= ' and VAU_event like "%[restart]%"'; }
	if ($refApiManage == 1){ $SQLstr .= ' and VAU_event like "%[manage]%"'; }

	$orderName = OT::ListDefVal(OT::GetStr('orderName'), 'VAU_proDataName|VAU_comServID|VAU_username|VAU_vpsName|UE_realname|UE_qq|UE_ww|VAU_state|VAU_adminID|VAU_ipStr|VAU_price|VAU_endTime|VAU_time|VAU_vpsEndTime|VAU_osName', 'VAU_ID');
	$orderSort = OT::ListDefVal(OT::GetStr('orderSort'), 'ASC', 'DESC');

	$proDataArr = array();
//	$proDataStr = '';
	$proexe = $DB->query('select VAD_ID,VAD_theme from '. OT_dbPref .'vpsApiData order by VAD_rank ASC');
	while ($row = $proexe->fetch()){
		$proDataArr[$row['VAD_ID']]	= $row['VAD_theme'];
//		$proDataStr .= '<option value="'. $row['VAD_ID'] .'">'. $row['VAD_theme'] .'</option>';
	}
	unset($proexe);

	AdmIdc::TixingTypeTab('vpsApi');

	/* 旧版提醒，后期删除
	$tixingNum = $DB->GetOne('select count(VAT_ID) from '. OT_dbPref .'vpsApiTixing where VAT_state=0');
	if ($tixingNum > 0){
		$skin->TableTop2('share_list.gif','',''. '前10条待确认（共'. $tixingNum .'条）&ensp;&ensp;<label style="font-weight:normal;"><input type="checkbox" id="skipEndTime" name="skipEndTime" value="1" />忽略到期时间不匹配</label>&ensp;&ensp;<label style="font-weight:normal;"><input type="checkbox" id="skipState" name="skipState" value="1" />忽略状态不匹配</label>');
		$skin->TableItemTitle('4%,15%,12%,10%,11%,15%,15%,5%,13%','序号,'. $skin->ShowArrow('产品名称','VAU_proDataName',$orderName,$orderSort) .','. $skin->ShowArrow('IP地址','VAU_ipStr',$orderName,$orderSort) .','. $skin->ShowArrow('用户名','VAT_username',$orderName,$orderSort) .','. $skin->ShowArrow('价格/费用','VAT_price',$orderName,$orderSort) .','. $skin->ShowArrow('原到期/开通时间','VAT_startTime',$orderName,$orderSort) .','. $skin->ShowArrow('延期至/到期时间','VAT_endTime',$orderName,$orderSort) .','. $skin->ShowArrow('类型','VAT_type',$orderName,$orderSort) .',财务&ensp;详细&ensp;同意&ensp;拒绝');

		$showexe=$DB->query('select VAT_ID,VAT_type,VAT_userID,VAT_username,VAT_payMode,VAT_price,VAT_cost,VAT_startTime,VAT_endTime,VAT_dataID,VAU_companyID,VAU_proDataName,VAU_ipStr,VAU_cost,VAU_vpsName from '. OT_dbPref .'vpsApiTixing as VAT left join '. OT_dbPref .'vpsApiUsers as VAU on VAT.VAT_dataID=VAU.VAU_ID where VAT_state=0 order by VAT_ID DESC limit 10');
		echo('<tbody class="tabBody padd3td">');
		$number = 1;
		while ($row = $showexe->fetch()){
			if ($number % 2 == 1){ $bgcolor='class="tabColorTr"'; }else{ $bgcolor=''; }

			echo('
			<tr id="tixingData'. $row['VAT_ID'] .'" '. $bgcolor .'>
				<td align="center">'. $number .'</td>
				<td align="center">'. $row['VAU_proDataName'] . AdmIdc::CompanyInfoImg($row['VAU_companyID']) .'</td>
				<td align="center" style="word-break:break-all;">'. IdcArea::IpStr($row['VAU_ipStr']) .'</td>
				<td align="center">'. $row['VAT_username'] . AdmArea::UserInfoImg($row['VAT_userID']) .'</td>
				<td align="center" title="成本：'. $row['VAT_cost'] .'">'. IdcInfo::PayMode($row['VAT_payMode']) .'：'. $row['VAT_price'] .'</td>
				<td align="center">'. $row['VAT_startTime'] .'</td>
				<td align="center">'. $row['VAT_endTime'] .'</td>
				<td align="center">'. $row['VAT_type'] .'</td>
				<td align="center">
					<img src="images/img_money.gif" class="pointer" onclick=\'OT_OpenMoneyRecord("&refVpsName='. $row['VAU_vpsName'] .'")\' alt="财务信息" title="财务信息" />&ensp;&ensp;
					<img src="images/img_det.gif" style="cursor:pointer" onclick=\'var a=window.open("?mudi=show&nohrefStr=close&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataID='. $row['VAT_dataID'] .'")\' alt="详细" title="详细" />&ensp;&ensp;
					<img src="images/img_yes.gif" class="pointer" onclick=\'TixingDeal("同意","'. $row['VAT_type'] .'","vpsApiUsers_deal.php?mudi=tixingDeal&mode=yes&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&theme='. urlencode($row['VAU_proDataName']) .'&dataID='. $row['VAT_ID'] .'")\' alt="同意" title="同意" />&ensp;
					<img src="images/img_err.gif" class="pointer" onclick=\'TixingDeal("拒绝","'. $row['VAT_type'] .'","vpsApiUsers_deal.php?mudi=tixingDeal&mode=no&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&theme='. urlencode($row['VAU_proDataName']) .'&dataID='. $row['VAT_ID'] .'")\' alt="拒绝" title="拒绝" />
				</td>
			</tr>
			');
			$number ++;
		
		}
		unset($showexe);

		echo('
		</table>
		<div style="height:10px;"></div>
		');
	}
	*/

	$todayDate			= TimeDate::Get('date');
	$prev1DayDate		= TimeDate::Add("d",-1,$todayDate);
	$prev3DayDate		= TimeDate::Add("d",-3,$todayDate);
	$prev7DayDate		= TimeDate::Add("d",-7,$todayDate);
	$currMonthDate		= TimeDate::Get('Y-m-1');
	$prevWeekDate		= TimeDate::Add("d",-7,$currMonthDate);
	$prevMonthDate		= TimeDate::Add("m",-1,$currMonthDate);
	$prevMonthDateEnd	= TimeDate::Add("d",-1,$currMonthDate);
	$next3DayDate		= TimeDate::Add("d",3,$todayDate);
	$nextWeekDate		= TimeDate::Add("d",7,$todayDate);
	$nextMonthDate		= TimeDate::Add("d",30,$todayDate);

	$skin->TableTop('share_refer.gif','',$dataTypeCN .'查询');
		echo('
		<form id="refForm" name="refForm" method="get" action="">
		<input type="hidden" name="mudi" value="'. $mudi .'" />
		<input type="hidden" name="dataType" value="'. $dataType .'" />
		<input type="hidden" name="dataTypeCN" value="'. $dataTypeCN .'" />

		<table width="99%" align="center" border="0" cellSpacing="0" cellPadding="0" summary="" class="padd5td">
		<tr>
			<td style="width:22%;">
				&ensp;&ensp;产品名称：<input type="text" name="refProName" size="20" value="'. $refProName .'" style="width:120px;" />
			</td>
			<td style="width:22%;">
				&ensp;&ensp;用户名：<input type="text" name="refUsername" size="20" value="'. $refUsername .'" style="width:120px;" />
			</td>
			<td style="width:28%;">
				昵称/QQ/旺旺：<input type="text" name="refQQ" size="20" value="'. $refQQ .'" style="width:120px;" />
			</td>
			<td style="width:28%;">
				&ensp;&ensp;开通日期：<input type="text" name="refDate1" size="10" value="'. $refDate1 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />&ensp;至&ensp;<input type="text" name="refDate2" size="10" value="'. $refDate2 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />
			</td>
		</tr>
		<tr>
			<td>
				&ensp;&ensp;机器编码：<input type="text" name="refVpsName" size="20" value="'. $refVpsName .'" style="width:120px;" />
			</td>
			<td>
				&ensp;&ensp;IP地址：<input type="text" name="refIpStr" size="20" value="'. $refIpStr .'" style="width:120px;" />
				<label><input type="checkbox" name="refIsAuth" value="1" '. Is::Checked($refIsAuth,1) .' title="已实名" />实名</label>
				<label><input type="checkbox" name="refIsGuanlian" value="1" '. Is::Checked($refIsGuanlian,1) .' title="加入关联实名认证名单" />关联</label>
			</td>
			<td>
				&ensp;&ensp;&ensp;&ensp;内部备注：<input type="text" name="refAdminNote" size="20" value="'. $refAdminNote .'" style="width:120px;" />
			</td>
			<td>
				&ensp;&ensp;到期日期：<input type="text" name="refEndDate1" size="10" value="'. $refEndDate1 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />&ensp;至&ensp;<input type="text" name="refEndDate2" size="10" value="'. $refEndDate2 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />
			</td>
		</tr>
		<tr>
			<td>
				&ensp;&ensp;&ensp;&ensp;操作员：<input type="text" name="refAdminName" size="20" value="'. $refAdminName .'" style="width:120px;" />
			</td>
			<td colspan="2">
				&ensp;&ensp;状态：<select name="refState">
					<option value="">&ensp;</option>
					<option value="15" '. Is::Selected($refState,15) .'>续费中</option>
					<option value="12" '. Is::Selected($refState,12) .'>试用中</option>
					<option value="10" '. Is::Selected($refState,10) .'>正常</option>
					<option value="9" '. Is::Selected($refState,9) .'>已退款</option>
					<option value="6" '. Is::Selected($refState,6) .'>开通失败</option>
					<option value="5" '. Is::Selected($refState,5) .'>开通中</option>
					<option value="3" '. Is::Selected($refState,3) .'>待开通</option>
					<option value="0" '. Is::Selected($refState,0) .'>停止</option>
					<option value="99" '. Is::Selected($refState,99) .'>API同步失败</option>
					</select>&ensp;&ensp;
				&ensp;<label title="星标重点关注，可用于重点提醒"><input type="checkbox" name="refMark" value="1" '. Is::Checked($refMark,1) .' />星标(<span style="color:red;font-size:16px;font-weight:bold;">'. $DB->GetOne('select count(VAU_ID) from '. OT_dbPref .'vpsApiUsers where VAU_event like "%|mark|%"') .'</span>)</label>
				&ensp;<label title="禁止邮件通知"><input type="checkbox" name="refNoMail" value="1" '. Is::Checked($refNoMail,1) .' />禁邮</label>
				&ensp;<label title="禁止短信通知"><input type="checkbox" name="refNoPhone" value="1" '. Is::Checked($refNoPhone,1) .' />禁短</label>
				&ensp;<label title="禁止公众号通知"><input type="checkbox" name="refNoWeixin" value="1" '. Is::Checked($refNoWeixin,1) .' />禁公</label>
				<!-- &ensp;<label title="API授权【重启】"><input type="checkbox" name="refApiRestart" value="1" '. Is::Checked($refApiRestart,1) .' />重启</label> -->
				&ensp;<label title="API授权【管理】"><input type="checkbox" name="refApiManage" value="1" '. Is::Checked($refApiManage,1) .' />管理</label>
			</td>
			<td>
				&ensp;&ensp;&ensp;API到期：<input type="text" name="refVpsEndDate1" size="10" value="'. $refVpsEndDate1 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />&ensp;至&ensp;<input type="text" name="refVpsEndDate2" size="10" value="'. $refVpsEndDate2 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />
			</td>
		</tr>
		<tr>
			<td align="center" style="padding:5px;padding-top:20px" colspan="4">
				<input type="image" src="'. AdmTpl::ImgSrc('button_refer') .'" onclick=\'RefFormSubmit("refer");\' />
				&ensp;&ensp;
				<img src="'. AdmTpl::ImgSrc('button_reset') .'" onclick=\'document.location.href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'"\' style="cursor:pointer" alt="" />
				&ensp;&ensp;
				<img src="'. AdmTpl::ImgSrc('button_excel') .'" style="cursor:pointer;" onclick=\'RefFormSubmit("export");\' />
				&ensp;&ensp;<label><input type="checkbox" name="isExportAdmin" value="1" />导出含备注和API</label>
				&ensp;&ensp;<label><input type="checkbox" name="refCalcPrice" value="1" '. Is::Checked($refCalcPrice,1) .' />计算价格</label>
				&ensp;&ensp;<label><input type="checkbox" name="refDel" value="1" '. Is::Checked($refDel,1) .' />可删除记录</label>
				'. AdmIdc::MoreProInfo($refMorePro, 'vpsApi', str_replace(array(' and VAU_lastApiTime like "%01:00:00%"',$sqlFieldStr, 'VAU_','vpsApiUsers'), array(' and 1=2','count([OT_pref]ID)','[OT_pref]','[OT_tab]'), $SQLstr)) .'

				<div style="margin-top:15px;">
					<div class="right">
						<input type="button" value="已付未续" onclick=\'document.location.href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&judOverDay=1"\' />
						<input type="button" value="未付已续" onclick=\'document.location.href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&judLessDay=1"\' />
					</div>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refDate1='. $todayDate .'&refDate2='. $todayDate .'" style="color:red;">[今日新开通]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refDate1='. $prevWeekDate .'&refDate2='. $todayDate .'" style="color:red;">[一周新开通]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refDate1='. $currMonthDate .'&refDate2='. $todayDate .'" style="color:red;">[本月新开通]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refDate1='. $prevMonthDate .'&refDate2='. $prevMonthDateEnd .'" style="color:red;">[上月新开通]</a>
					&ensp;&ensp;&ensp;
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refEndDate1='. $todayDate .'&refEndDate2='. $todayDate .'" style="color:red;">[今天到期]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refEndDate1='. $todayDate .'&refEndDate2='. $next3DayDate .'" style="color:red;">[三天到期]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refEndDate1='. $todayDate .'&refEndDate2='. $nextWeekDate .'" style="color:red;">[一周到期]</a>
					&ensp;&ensp;&ensp;
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refEndDate1='. $prev3DayDate .'&refEndDate2='. $prev1DayDate .'" style="color:red;">[过期3天]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refEndDate1='. $prev7DayDate .'&refEndDate2='. $prev1DayDate .'" style="color:red;">[过期7天]</a>
					<a href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&refEndDate1=2016-01-01&refEndDate2='. $prev7DayDate .'" style="color:red;">[过期7天以上]</a>
				</div>
			</td>
		</tr>
		</table>
		</form>
		');

	$skin->TableBottom();

	echo('
	<div style="padding:10px 6px 6px 6px;">
		<div style="float:right;">
			<input type="button" value="批量更新apiID" onclick=\'var a=window.open("vpsApiUsers_deal.php?mudi=updateApiID&nohrefStr=close");\' style="color:blue;" />
			<input type="button" value="批量API同步更新" onclick=\'var a=window.open("vpsApiUsers_deal.php?mudi=apiUpdate");\' style="color:blue;" />
		</div>
		<input type="button" value="开通云服务器" onclick=\'document.location.href="?mudi=sel&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&backURL="+ encodeURIComponent(document.location.href);\' />
		&ensp;
		<input type="button" value="云服务器导入" onclick=\'document.location.href="?mudi=sel&mudi2=import&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&backURL="+ encodeURIComponent(document.location.href);\' />
		&ensp;&ensp;&ensp;&ensp;&ensp;
		'. AppJingan::VpsApiUsersItem() .'
	</div>

	<form id="listForm" name="listForm" method="post" action="vpsApiUsers_deal.php?mudi=moreDel" onsubmit="return CheckListForm()">
	<script language="javascript" type="text/javascript">document.write (\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'" />\')</script>
	<input type="hidden" name="dataMode" value="'. $dataMode .'" />
	<input type="hidden" name="dataModeStr" value="'. $dataModeStr .'" />
	<input type="hidden" name="dataType" value="'. $dataType .'" />
	<input type="hidden" name="dataTypeCN" value="'. $dataTypeCN .'" />
	');

	$skin->TableTop2('share_list.gif','',''. $dataTypeCN .'管理');
	$skin->TableItemTitle('3%,4%,13%,9%,10%,10%,9%,12%,11%,6%,6%,7%','<input type="checkbox" id="selAll" name="selAll" onclick="CheckBoxAll()" />,序号,'. $skin->ShowArrow('产品名称','VAU_proDataName',$orderName,$orderSort) .'/'. $skin->ShowArrow('母机','VAU_comServID',$orderName,$orderSort) .','. $skin->ShowArrow('用户名','VAU_username',$orderName,$orderSort) .'/'. $skin->ShowArrow('机器编码','VAU_vpsName',$orderName,$orderSort) .','. $skin->ShowArrow('昵称','UE_realname',$orderName,$orderSort) .'/'. $skin->ShowArrow('QQ','UE_qq',$orderName,$orderSort) .'/'. $skin->ShowArrow('旺旺','UE_ww',$orderName,$orderSort) .','. $skin->ShowArrow('已分配IP地址','VAU_ipStr',$orderName,$orderSort) .','. $skin->ShowArrow('价格','VAU_price',$orderName,$orderSort) .','. $skin->ShowArrow('开通','VAU_time',$orderName,$orderSort) .'/'. $skin->ShowArrow('到期时间','VAU_endTime',$orderName,$orderSort) .'/'. $skin->ShowArrow('系统','VAU_osName',$orderName,$orderSort) .',内部备注/'. $skin->ShowArrow('API到期','VAU_vpsEndTime',$orderName,$orderSort) .','. $skin->ShowArrow('状态','VAU_state',$orderName,$orderSort) .','. $skin->ShowArrow('操作员','VAU_adminID',$orderName,$orderSort) .',再开&ensp;管理');

	$pageSize	= $MB->mMbRow['MB_itemNum'];		//每页条数
	$page		= OT::GetInt('page');
	$showRow=$DB->GetLimit($SQLstr .' order by '. $orderName .' '. $orderSort,$pageSize,$page);
	if (! $showRow){
		$skin->TableNoData();
	}else{
		$recordCount=$DB->GetRowCount();
		$pageCount=ceil($recordCount/$pageSize);
		if ($page < 1 || $page > $pageCount){$page=1;}

		$servArr = array();
		$servexe = $DB->query('select XS_ID,XS_num,XS_theme from '. OT_dbPref .'xingwaiServ');
		while ($srs = $servexe->fetch()){
			$servArr[$srs['XS_num']] = $srs['XS_theme'];
		}
		unset($servexe);

		echo('
		<tbody class="tabBody padd3td">
		');
		$number=1+($page-1)*$pageSize;
		$rowCount = count($showRow);
		for ($i=0; $i<$rowCount; $i++){
			if ($i % 2 == 1){ $bgcolor='class="tabColorTr"'; }else{ $bgcolor=''; }

			$proName = isset($proDataArr[$showRow[$i]['VAU_proDataID']])?$proDataArr[$showRow[$i]['VAU_proDataID']]:'<span style="text-decoration:line-through;colr:#666;">'. $showRow[$i]['VAU_proDataName'] .'</span>';
			$priceStr = IdcInfo::PayMode($showRow[$i]['VAU_payMode']) .'：'. $showRow[$i]['VAU_price'];
			$endTimeStr = TimeDate::Get('date2',$showRow[$i]['VAU_endTime']) .'&ensp;<span style="color:red;">['. TimeDate::DiffDayCN($showRow[$i]['VAU_endTime']) .']</span>';

			$noteAddi = $servStr = '';
			// if ($showRow[$i]['VAU_state'] >= 10){
			if (strtotime($showRow[$i]['VAU_vpsEndTime'])){
				$noteAddi = '<span style="color:'. (strtotime($showRow[$i]['VAU_endTime'])>strtotime($showRow[$i]['VAU_vpsEndTime'])?'red':'#000') .';" title="上级API到期时间：'. $showRow[$i]['VAU_vpsEndTime'] .'">'. TimeDate::Get('date2',$showRow[$i]['VAU_vpsEndTime']) .'&ensp;<span style="color:red;">['. TimeDate::DiffDayCN($showRow[$i]['VAU_vpsEndTime']) .']</span></span>';
			}
			if ($showRow[$i]['VAU_comServID'] > 0){
				$servStr = '<div style="color:#c9c9c9;;padding-top:2px;">'. (isset($servArr[$showRow[$i]['VAU_comServID']]) ? $servArr[$showRow[$i]['VAU_comServID']] : '母机ID：'. $showRow[$i]['VAU_comServID']) .'</div>';
			}
			$oneIpArr = explode('<br />',IdcArea::IpStr($showRow[$i]['VAU_ipStr']));

			echo('
			<tr id="data'. $showRow[$i]['VAU_ID'] .'" '. $bgcolor .'>
				<td align="center" class="selCheckbox"><input type="checkbox" name="selDataID[]" value="'. $showRow[$i]['VAU_ID'] .'" /></td>
				<td align="center" title="ID:'. $showRow[$i]['VAU_ID'] .'">'. $number .'</td>
				<td align="center">
					'. $proName . AdmIdc::CompanyInfoImg($showRow[$i]['VAU_companyID']) . $servStr .'
					<div style="margin-top:5px;">'.
						Adm::SwitchAddi('vpsApiUsers', $showRow[$i]['VAU_ID'], '星标', strpos(''. $showRow[$i]['VAU_event'],'|mark|')!==false?'|mark|':'', 'event', 'eet_mark', '|mark|','星标显著该记录，可用于重点提醒') .
						Adm::SwitchAddi('vpsApiUsers', $showRow[$i]['VAU_ID'], '禁邮', strpos(''. $showRow[$i]['VAU_event'],'|noMail|')!==false?'|noMail|':'', 'event', 'eet_mail', '|noMail|','禁止邮件通知') .
						Adm::SwitchAddi('vpsApiUsers', $showRow[$i]['VAU_ID'], '禁短', strpos(''. $showRow[$i]['VAU_event'],'|noPhone|')!==false?'|noPhone|':'', 'event', 'eet_phone', '|noPhone|','禁止短信通知') .
						Adm::SwitchAddi('vpsApiUsers', $showRow[$i]['VAU_ID'], '禁公', strpos(''. $showRow[$i]['VAU_event'],'|noWeixin|')!=false?'|noWeixin|':'', 'event', 'eet_weixin', '|noWeixin|','禁止公众号通知') .'
					</div>
					<textarea id="copyStr'. $showRow[$i]['VAU_ID'] .'" name="copyStr'. $showRow[$i]['VAU_ID'] .'" style="width:98%;height:60px;display:none;" readonly="true">'.
						'您好，您的 '. Str::RegExp($proName . PHP_EOL .'IP：'. IdcArea::IpStr($showRow[$i]['VAU_ipStr'], ',') . PHP_EOL . $priceStr . PHP_EOL .'到期时间：'. $endTimeStr,'html') . PHP_EOL .'请问要续费吗？'.
					'</textarea>
					<textarea id="copyInfo'. $showRow[$i]['VAU_ID'] .'" name="copyInfo'. $showRow[$i]['VAU_ID'] .'" style="width:98%;height:60px;display:none;" readonly="true">'.
						'IP：'. $oneIpArr[0] . PHP_EOL .
						'端口：'. IdcArea::VpsDefPort($showRow[$i]['VAU_system'],$showRow[$i]['VAU_vpsPort']) . PHP_EOL .
						'用户名：'. IdcArea::VpsDefUsername($showRow[$i]['VAU_system'],$showRow[$i]['VAU_vpsUser']) . PHP_EOL .
						'密码：'. Encrypt::SyEnDe('de',$showRow[$i]['VAU_vpsPwd']) .
					'</textarea>
				</td>
				<td align="center">
					<div style="color:blue;">'. $showRow[$i]['VAU_username'] . AdmArea::UserShimingImg($showRow[$i]['VAU_userID']) . AdmArea::UserInfoImg($showRow[$i]['VAU_userID']) .'</div>
					'. $showRow[$i]['VAU_vpsName'] .'
				</td>
				<td align="center">
					'. $showRow[$i]['UE_realname'] . AdmArea::UserQQ($showRow[$i]['UE_qq']) .'
					<div>'. AdmArea::UserWw($showRow[$i]['UE_ww']) .'</div>
				</td>
				<td align="center"><!--  style="word-break:break-all;" -->
					'. IdcArea::IpStr($showRow[$i]['VAU_ipStr']) .'
					<div>'. IdcInfo::AuthCN($showRow[$i]['VAU_isAuth']) . ($showRow[$i]['VAU_isAuth'] == 1 ? '&ensp;'. Adm::SwitchAddi('vpsApiUsers', $showRow[$i]['VAU_ID'], '关联', strpos(''. $showRow[$i]['VAU_event'],'|auth|')!==false?'|auth|':'', 'event', 'eet_auth', '|auth|','加入到关联认证名单') : '') .'</div>
				</td>
				<td align="center" title="成本：'. $showRow[$i]['VAU_cost'] .'">
					'. $priceStr .'
					<div style="color:#c9c9c9;cursor:pointer;margin-top:5px;" onclick=\'OT_OpenMoneyRecord("&refVpsName='. $showRow[$i]['VAU_vpsName'] .'&refUsername='. $showRow[$i]['VAU_username'] .'")\'>[此产品财务]</div>
				</td>
				<td align="left" style="padding-left:8px;word-break:break-all;">
					<div style="color:'. (TimeDate::Diff('d',$showRow[$i]['VAU_time'],$todayDate)==0?'red':'') .';">'. TimeDate::Get('datetime2',$showRow[$i]['VAU_time']) .'</div>
					'. $endTimeStr .'
					<div style="color:#c9c9c9;">'. $showRow[$i]['VAU_osName'] .'</div>
				</td>
				<td align="center" style="word-break:break-all;">
					<div style="color:blue;">'. $showRow[$i]['VAU_adminNote'] .'</div>
					'. $noteAddi .'
				</td>
				<td align="center">'. IdcInfo::State($showRow[$i]['VAU_state']) .'</td>
				<td align="center" title="操作员ID：'. $showRow[$i]['VAU_adminID'] .'">
					'. $showRow[$i]['VAU_adminName'] .'
					'. ($showRow[$i]['VAU_isAutoXufei'] == 1 ? '<div style="padding-top:5px;color:green;">自动续费</div>' : '') .'
				</td>
				<td align="center">
					<img src="images/img_copy.gif" class="pointer" onclick=\'document.location.href="?mudi=add&mudi2=copy&proDataID='. $showRow[$i]['VAU_proDataID'] .'&dataID='. $showRow[$i]['VAU_ID'] .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&backURL="+ encodeURIComponent(document.location.href)\' alt="在开台配置一样的机器" />&ensp;
					<span onmouseover=\'$id("func'. $showRow[$i]['VAU_ID'] .'Box").style.display="";\' onmouseout=\'$id("func'. $showRow[$i]['VAU_ID'] .'Box").style.display="none";\'>
						<img src="images/img_set.gif" style="cursor:pointer" onclick=\'var a=window.open("?mudi=show&nohrefStr=close&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataID='. $showRow[$i]['VAU_ID'] .'")\' alt="" />
						<div id="func'. $showRow[$i]['VAU_ID'] .'Box" class="vpsQuickMenu" style="display:none;"><div class="vqmBox">
							<div class="vqmTitle">快捷菜单：</div>
							<div><a href="?mudi=cpManage&dataID='. $showRow[$i]['VAU_ID'] .'" class="font1_2" target="_blank">用户区面板</a></div>
							'. ($showRow[$i]['VAU_apiID'] > 0 ? '<div><a class="font1_2 pointer" title="IP和API到期与上级同步" onclick=\'if(confirm("你确定【'. $oneIpArr[0] .'】要API同步？")==true){DataDeal.location.href="vpsApiUsers_deal.php?mudi=sync&mudi2=api&theme='. urlencode($showRow[$i]['VAU_vpsName']) .'&dataID='. $showRow[$i]['VAU_ID'] .'"}\' >API同步</a></div>' : '') .'
							<div><a class="font1_2 pointer" onclick=\'ValueToCopy("copyStr'. $showRow[$i]['VAU_ID'] .'");\' >拷续费提醒</a></div>
							<div><a class="font1_2 pointer" onclick=\'ValueToCopy("copyInfo'. $showRow[$i]['VAU_ID'] .'");\' >拷远程信息</a></div>
							'. ($showRow[$i]['VAU_apiID'] == 6 ? '<div><a href="idcServVps.php?mudi=show&nohrefStr=close&dataTypeCN='. urlencode('机器') .'&dataID=-99&vpsName='. $showRow[$i]['VAU_vpsName'] .'" class="font1_2" target="_blank">主控机器区</a></div>' : '') .'
						</div></div>
					</span>
				</td>
			</tr>
			');
			$number ++;
		}
		echo('
		</tbody>
		<tr class="tabColorB padd5">
			<td align="left" colspan="20">
				<input type="button" value="全选" onclick="AllSelBox()" class="form_button1" />
				<input type="button" value="反选" onclick="RevSelBox()" class="form_button1" />
				&ensp;
				<input type="submit" value="批量删除" />
				<span class="font2_2">（到期时间超过8天，或者状态为 停止、开通失败、待开通、已退款 才能删除。）</span>
				'. ($refCalcPrice == 1 ? '计算总额：'. $DB->GetOne(str_replace($sqlFieldStr,'sum(VAU_price)',$SQLstr)) .'元' : '') .'
			</td>
		</tr>
		');
	}
	unset($showRow);

	echo('</form>');

	$skin->TableBottom2($pageCount, $pageSize, $recordCount);
}


// 提醒管理 废除，后期删除
function TixingManage(){
	global $DB,$MB,$skin,$mudi,$dataType,$dataTypeCN,$pageCount,$recordCount;

	$dataMode		= OT::GetStr('dataMode');
	$dataModeStr	= OT::GetStr('dataModeStr');

	$refProName		= OT::GetRegExpStr('refProName','sql');
	$refUsername	= OT::GetRegExpStr('refUsername','sql');
	$refAdminName	= OT::GetRegExpStr('refAdminName','sql');
	$refType		= OT::GetRegExpStr('refType','sql');
	$refVpsName		= OT::GetRegExpStr('refVpsName','sql');
	$refState		= OT::GetInt('refState',-1);
	$refIpStr		= OT::GetRegExpStr('refIpStr','sql+.');
	$refDate1		= OT::GetStr('refDate1');
		if (! strtotime($refDate1)){ $refDate1=''; }
	$refDate2		= OT::GetStr('refDate2');
		if (! strtotime($refDate2)){ $refDate2=''; }
	$refEndDate1		= OT::GetStr('refEndDate1');
		if (strtotime($refEndDate1)==false){$refEndDate1='';}
	$refEndDate2		= OT::GetStr('refEndDate2');
		if (strtotime($refEndDate2)==false){$refEndDate2='';}

	$SQLstr='select VAT_ID,VAT_type,VAT_userID,VAT_username,VAT_payMode,VAT_price,VAT_cost,VAT_startTime,VAT_endTime,VAT_dataID,VAT_state,VAT_adminID,VAT_adminName,VAT_adminTime,VAU_companyID,VAU_proDataID,VAU_proDataName,VAU_ipStr,VAU_cost,VAU_vpsName from '. OT_dbPref .'vpsApiTixing as VAT left join '. OT_dbPref .'vpsApiUsers as VAU on VAT.VAT_dataID=VAU.VAU_ID where 1=1';

	if ($refProName!=''){ $SQLstr .= " and VAT_proDataName like '%". $DB->ForStr($refProName,false) ."%'"; }
	if ($refUsername!=''){ $SQLstr .= " and VAT_username like '%". $DB->ForStr($refUsername,false) ."%'"; }
	if ($refAdminName!=''){ $SQLstr .= " and VAT_adminName like '%". $DB->ForStr($refAdminName,false) ."%'"; }
	if ($refType!=''){ $SQLstr .= " and VAT_type=". $DB->ForStr($refType); }
	if ($refVpsName!=''){ $SQLstr .= " and VAU_vpsName like '%". $DB->ForStr($refVpsName,false) ."%'"; }
	if ($refState>-1){ $SQLstr .= ' and VAT_state='. $refState .''; }
	if ($refIpStr!=''){ $SQLstr .= " and VAU_ipStr like '%". $DB->ForStr($refIpStr,false) ."%'"; }
	if ($refDate1!=''){ $SQLstr .= ' and VAT_startTime>='. $DB->ForTime($refDate1); }
	if ($refDate2!=''){ $SQLstr .= ' and VAT_startTime<'. $DB->ForTime(TimeDate::Add('d',1,$refDate2)); }
	if ($refEndDate1!=''){ $SQLstr .= ' and VAT_endTime>='. $DB->ForTime($refEndDate1); }
	if ($refEndDate2!=''){ $SQLstr .= ' and VAT_endTime<'. $DB->ForTime(TimeDate::Add('d',1,$refEndDate2)); }

	$orderName = OT::ListDefVal(OT::GetStr('orderName'), 'VAU_proDataName|VAU_ipStr|VAT_username|VAT_price|VAT_startTime|VAT_endTime|VAT_type|VAT_state|VAT_adminName|VAT_adminTime', 'VAT_ID');
	$orderSort = OT::ListDefVal(OT::GetStr('orderSort'), 'ASC', 'DESC');

	$proDataArr = array();
//	$proDataStr = '';
	$proexe = $DB->query('select VAD_ID,VAD_theme from '. OT_dbPref .'vpsApiData order by VAD_rank ASC');
	while ($row = $proexe->fetch()){
		$proDataArr[$row['VAD_ID']]	= $row['VAD_theme'];
//		$proDataStr .= '<option value="'. $row['VAD_ID'] .'">'. $row['VAD_theme'] .'</option>';
	}
	unset($proexe);

	echo('<div style="padding:6px;color:red;">提醒：后期该功能会迁移至【IDC设置→产品待确认管理】</div>');
	
	$skin->TableTop('share_refer.gif','',$dataTypeCN .'查询');
		echo('
		<form id="refForm" name="refForm" method="get" action="">
		<input type="hidden" name="mudi" value="'. $mudi .'" />
		<input type="hidden" name="dataType" value="'. $dataType .'" />
		<input type="hidden" name="dataTypeCN" value="'. $dataTypeCN .'" />

		<table width="99%" align="center" border="0" cellSpacing="0" cellPadding="0" summary="" class="padd5td">
		<tr>
			<td style="width:22%;">
				&ensp;&ensp;产品名称：<input type="text" name="refProName" size="20" value="'. $refProName .'" style="width:120px;" />
			</td>
			<td style="width:22%;">
				&ensp;&ensp;用户名：<input type="text" name="refUsername" size="20" value="'. $refUsername .'" style="width:120px;" />
			</td>
			<td style="width:28%;">
				&ensp;&ensp;&ensp;&ensp;操作者：<input type="text" name="refAdminName" size="20" value="'. $refAdminName .'" style="width:60px;" />
				&ensp;&ensp;&ensp;&ensp;类型：<select name="refType">
					<option value="">&ensp;</option>
					<option value="开通" '. Is::Selected($refType,'开通') .'>开通</option>
					<option value="续费" '. Is::Selected($refType,'续费') .'>续费</option>
					</select>
			</td>
			<td style="width:28%;">
				&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;状态：<select name="refState">
					<option value="">&ensp;</option>
					<option value="0" '. Is::Selected($refState,0) .'>未处理</option>
					<option value="1" '. Is::Selected($refState,1) .'>已同意</option>
					<option value="2" '. Is::Selected($refState,2) .'>已拒绝</option>
					</select>
			</td>
		</tr>
		<tr>
			<td>
				&ensp;&ensp;机器编码：<input type="text" name="refVpsName" size="20" value="'. $refVpsName .'" style="width:120px;" />
			</td>
			<td>
				&ensp;&ensp;IP地址：<input type="text" name="refIpStr" size="20" value="'. $refIpStr .'" style="width:120px;" />
			</td>
			<td>
				&ensp;&ensp;开通日期：<input type="text" name="refDate1" size="10" value="'. $refDate1 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />&ensp;至&ensp;<input type="text" name="refDate2" size="10" value="'. $refDate2 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />
			</td>
			<td>
				&ensp;&ensp;到期日期：<input type="text" name="refEndDate1" size="10" value="'. $refEndDate1 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />&ensp;至&ensp;<input type="text" name="refEndDate2" size="10" value="'. $refEndDate2 .'" onfocus="WdatePicker({dateFmt:\'yyyy-MM-dd\'})" />
			</td>
		</tr>
		<tr>
			<td align="center" style="padding:5px;padding-top:20px" colspan="4">
				<input type="image" src="'. AdmTpl::ImgSrc('button_refer') .'" />
				&ensp;&ensp;&ensp;&ensp;
				<img src="'. AdmTpl::ImgSrc('button_reset') .'" onclick=\'document.location.href="?mudi='. $mudi .'&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'"\' style="cursor:pointer" alt="" />
			</td>
		</tr>
		</table>
		</form>
		');

	$skin->TableBottom();

	echo('
	<br />

	<div style="padding:5px;"><label style="font-weight:normal;"><input type="checkbox" id="skipEndTime" name="skipEndTime" value="1" />忽略到期时间不匹配</label>&ensp;&ensp;<label style="font-weight:normal;"><input type="checkbox" id="skipState" name="skipState" value="1" />忽略状态不匹配</label></div>
	<form id="listForm" name="listForm" method="post" action="" onsubmit="return CheckListForm()">
	<script language="javascript" type="text/javascript">document.write (\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'" />\')</script>
	<input type="hidden" name="dataMode" value="'. $dataMode .'" />
	<input type="hidden" name="dataModeStr" value="'. $dataModeStr .'" />
	<input type="hidden" name="dataType" value="'. $dataType .'" />
	<input type="hidden" name="dataTypeCN" value="'. $dataTypeCN .'" />
	');

	$skin->TableTop2('share_list.gif','',''. $dataTypeCN .'管理');
	$skin->TableItemTitle('4%,14%,10%,9%,9%,8%,8%,5%,5%,7%,8%,13%','序号,'. $skin->ShowArrow('产品名称','VAU_proDataName',$orderName,$orderSort) .','. $skin->ShowArrow('IP地址','VAU_ipStr',$orderName,$orderSort) .','. $skin->ShowArrow('用户名','VAT_username',$orderName,$orderSort) .','. $skin->ShowArrow('价格/费用','VAT_price',$orderName,$orderSort) .','. $skin->ShowArrow('原到期/开通','VAT_startTime',$orderName,$orderSort) .','. $skin->ShowArrow('延期至/到期','VAT_endTime',$orderName,$orderSort) .','. $skin->ShowArrow('类型','VAT_type',$orderName,$orderSort) .','. $skin->ShowArrow('状态','VAT_state',$orderName,$orderSort) .','. $skin->ShowArrow('操作者','VAT_adminName',$orderName,$orderSort) .','. $skin->ShowArrow('操作时间','VAT_adminTime',$orderName,$orderSort) .',财务&ensp;详细&ensp;同意&ensp;拒绝');

	$pageSize	= $MB->mMbRow['MB_itemNum'];		//每页条数
	$page		= OT::GetInt('page');
	$showRow=$DB->GetLimit($SQLstr .' order by '. $orderName .' '. $orderSort,$pageSize,$page);
	if (! $showRow){
		$skin->TableNoData();
	}else{
		$recordCount=$DB->GetRowCount();
		$pageCount=ceil($recordCount/$pageSize);
		if ($page < 1 || $page > $pageCount){$page=1;}

		echo('
		<tbody class="tabBody padd3td">
		');
		$number=1+($page-1)*$pageSize;
		$rowCount = count($showRow);
		for ($i=0; $i<$rowCount; $i++){
			if ($i % 2 == 1){ $bgcolor='class="tabColorTr"'; }else{ $bgcolor=''; }
			$proName = isset($proDataArr[$showRow[$i]['VAU_proDataID']])?$proDataArr[$showRow[$i]['VAU_proDataID']]:'<span style="text-decoration:line-through;colr:#666;">'. $showRow[$i]['VAU_proDataName'] .'</span>';
			if ($showRow[$i]['VAT_state'] != 0){
				$dealBtnStr = '
					<img src="images/img_yes.gif" class="gray" alt="同意" title="同意" />&ensp;
					<img src="images/img_err.gif" class="gray" alt="拒绝" title="拒绝" />
					';
			}else{
				$dealBtnStr = '
					<img src="images/img_yes.gif" class="pointer" onclick=\'TixingDeal("同意","'. $showRow[$i]['VAT_type'] .'","vpsApiUsers_deal.php?mudi=tixingDeal&mode=yes&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&theme='. urlencode($showRow[$i]['VAU_proDataName']) .'&dataID='. $showRow[$i]['VAT_ID'] .'")\' alt="同意" title="同意" />&ensp;
					<img src="images/img_err.gif" class="pointer" onclick=\'TixingDeal("拒绝","'. $showRow[$i]['VAT_type'] .'","vpsApiUsers_deal.php?mudi=tixingDeal&mode=no&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&theme='. urlencode($showRow[$i]['VAU_proDataName']) .'&dataID='. $showRow[$i]['VAT_ID'] .'")\' alt="拒绝" title="拒绝" />
					';
			}

			echo('
			<tr id="tixingData'. $showRow[$i]['VAT_ID'] .'" '. $bgcolor .'>
				<td align="center">'. $number .'</td>
				<td align="center">'. $showRow[$i]['VAU_proDataName'] . AdmIdc::CompanyInfoImg($showRow[$i]['VAU_companyID']) .'</td>
				<td align="center" style="word-break:break-all;">'. IdcArea::IpStr($showRow[$i]['VAU_ipStr']) .'</td>
				<td align="center">'. $showRow[$i]['VAT_username'] . AdmArea::UserInfoImg($showRow[$i]['VAT_userID']) .'</td>
				<td align="center" title="成本：'. $showRow[$i]['VAT_cost'] .'">'. IdcInfo::PayMode($showRow[$i]['VAT_payMode']) .'：'. $showRow[$i]['VAT_price'] .'</td>
				<td align="center">'. $showRow[$i]['VAT_startTime'] .'</td>
				<td align="center">'. $showRow[$i]['VAT_endTime'] .'</td>
				<td align="center">'. $showRow[$i]['VAT_type'] .'</td>
				<td align="center">'. IdcInfo::TixingStateCN($showRow[$i]['VAT_state']) .'</td>
				<td align="center" title="管理员ID：'. $showRow[$i]['VAT_adminID'] .'">'. $showRow[$i]['VAT_adminName'] .'</td>
				<td align="center">'. $showRow[$i]['VAT_adminTime'] .'</td>
				<td align="center">
					<img src="images/img_money.gif" class="pointer" onclick=\'OT_OpenMoneyRecord("&refVpsName='. $showRow[$i]['VAU_vpsName'] .'")\' alt="财务信息" title="财务信息" />&ensp;&ensp;
					<img src="images/img_det.gif" style="cursor:pointer" onclick=\'var a=window.open("?mudi=show&nohrefStr=close&dataMode='. $dataMode .'&dataModeStr='. $dataModeStr .'&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'&dataID='. $showRow[$i]['VAT_dataID'] .'")\' alt="详细" title="详细" />&ensp;&ensp;
					'. $dealBtnStr .'
				</td>
			</tr>
			');
			$number ++;
		}
		echo('
		</tbody>
		');
	}
	unset($showRow);

	$skin->TableBottom2($pageCount, $pageSize, $recordCount);

}



function show(){
	global $DB,$skin,$mudi,$dataType,$dataTypeCN,$pageCount,$recordCount,$dbPathPart;

	$dataMode	= OT::GetStr('dataMode');
	$dataModeStr= OT::GetStr('dataModeStr');
	$dataType	= OT::GetStr('dataType');
	$dataTypeCN	= OT::GetStr('dataTypeCN');
	$dataID		= OT::GetInt('dataID');
	
	$vpsRow = $DB->GetRow('select * from '. OT_dbPref .'vpsApiUsers where VAU_ID='. $dataID);
		if (! $vpsRow){ JS::AlertCloseEnd('指定ID错误'); }

	$proRow = $DB->GetRow('select * from '. OT_dbPref .'vpsApiData where VAD_ID='. $vpsRow['VAU_proDataID']);
		if (! $proRow){ JS::AlertCloseEnd('搜索不到该记录所属的产品相关信息'); }

	$payModeCN = IdcInfo::PayMode($vpsRow['VAU_payMode']);
	$vpsApiArr = IdcArea::VpsApiArr($proRow['VAD_apiID']);	// , 'right'

	echo('
	<script language="javascript" type="text/javascript">
	document.title="'. $dataTypeCN .'（机器编码：'. $vpsRow['VAU_vpsName'] .'，IP：'. IdcArea::IpArr($vpsRow['VAU_ipStr'], 0) .'，名称：'. $vpsRow['VAU_proDataName'] .'，渠道商：'. $vpsApiArr['name'] .'）详细信息";
	</script>

	<input type="hidden" id="payModeCN" name="payModeCN" value="'. $payModeCN .'" />
	<table width="1150" align="center" cellpadding="0" cellspacing="0" border="0" summary=""><tr><td>
	');

	// 会员信息
	list($userRemMoney, $userGroupID) = AdmIdc::UserInfoTab($vpsRow['VAU_userID']);

	// 待处理提醒信息
	AdmIdc::TixingTab('vpsApi', $dataID, $vpsRow['VAU_proDataName'], $vpsRow['VAU_vpsName'], IdcArea::IpStr($vpsRow['VAU_ipStr']));

	// 产品信息和管理面板
	AdmIdc::ProManageTab('vpsApi', $dataID, $vpsRow, $proRow);

	if ($vpsRow['VAU_isNewPrice'] == 1){
		$newPriceMonth	= floatval($vpsRow['VAU_priceMonth']);
		$newCostMonth	= floatval($vpsRow['VAU_costMonth']);
		$newPrice3Month = floatval($vpsRow['VAU_price3Month']);
		$newCost3Month	= floatval($vpsRow['VAU_cost3Month']);
		$newPrice6Month	= floatval($vpsRow['VAU_price6Month']);
		$newCost6Month	= floatval($vpsRow['VAU_cost6Month']);
		$newPriceYear	= floatval($vpsRow['VAU_priceYear']);
		$newCostYear	= floatval($vpsRow['VAU_costYear']);
		$pMonthStr = '(单独价:'. $newPriceMonth .'元)<span style="color:#999;">原价:'. $proRow['VAD_priceMonth'] .'元</span>';
		$p3MonthStr = '(单独价:'. $newPrice3Month .'元)<span style="color:#999;">原价:'. $proRow['VAD_price3Month'] .'元</span>';
		$p6MonthStr = '(单独价:'. $newPrice6Month .'元)<span style="color:#999;">原价:'. $proRow['VAD_price6Month'] .'元</span>';
		$pYearStr = '(单独价:'. $newPriceYear .'元)<span style="color:#999;">原价:'. $proRow['VAD_priceYear'] .'元</span>';
		$p2YearStr = '(单独价:'. $newPriceYear*2 .'元)<span style="color:#999;">原价:'. $proRow['VAD_priceYear']*2 .'元</span>';
		$p3YearStr = '(单独价:'. $newPriceYear*3 .'元)<span style="color:#999;">原价:'. $proRow['VAD_priceYear']*3 .'元</span>';
	}else{
		$newPriceMonth	= floatval($proRow['VAD_priceMonth']);
		$newCostMonth	= floatval($proRow['VAD_costMonth']);
		$newPrice3Month = floatval($proRow['VAD_price3Month']);
		$newCost3Month	= floatval($proRow['VAD_cost3Month']);
		$newPrice6Month	= floatval($proRow['VAD_price6Month']);
		$newCost6Month	= floatval($proRow['VAD_cost6Month']);
		$newPriceYear	= floatval($proRow['VAD_priceYear']);
		$newCostYear	= floatval($proRow['VAD_costYear']);
		$newPrice2Year	= floatval($proRow['VAD_price2Year']);
		$newCost2Year	= floatval($proRow['VAD_cost2Year']);
		$newPrice3Year	= floatval($proRow['VAD_price3Year']);
		$newCost3Year	= floatval($proRow['VAD_cost3Year']);
		$pMonthStr = '('. $newPriceMonth .'元)';
		$p3MonthStr = '('. $newPrice3Month .'元)';
		$p6MonthStr = '('. $newPrice6Month .'元)';
		$pYearStr = '('. $newPriceYear .'元)';
		$p2YearStr = '('. $newPrice2Year .'元)';
		$p3YearStr = '('. $newPrice3Year .'元)';
		if ($userGroupID > 0){
			// 走代理折扣价
			$agentArr = AppAgent::CheckPrice('vpsApi', $proRow['VAD_ID'], $userGroupID, $proRow['VAD_minPrice']);
			if ($agentArr['isAgent'] == 1){
				$pMonthStr = '('. $agentArr['agentName'] .'价:'. $agentArr['agentPrice'] .'元)<span style="color:#999;">原价:'. $newPriceMonth .'元</span>';
				$p3MonthStr = '('. $agentArr['agentName'] .'价:'. $agentArr['agentPrice']*3 .'元)<span style="color:#999;">原价:'. $newPrice3Month .'元</span>';
				$p6MonthStr = '('. $agentArr['agentName'] .'价:'. $agentArr['agentPrice']*6 .'元)<span style="color:#999;">原价:'. $newPrice6Month .'元</span>';
				$pYearStr = '('. $agentArr['agentName'] .'价:'. $agentArr['agentPrice']*10 .'元)<span style="color:#999;">原价:'. $newPriceYear .'元</span>';
				$p2YearStr = '('. $agentArr['agentName'] .'价:'. $agentArr['agentPrice']*20 .'元)<span style="color:#999;">原价:'. $newPrice2Year .'元</span>';
				$p3YearStr = '('. $agentArr['agentName'] .'价:'. $agentArr['agentPrice']*30 .'元)<span style="color:#999;">原价:'. $newPrice3Year .'元</span>';
				$newPriceMonth	= $agentArr['agentPrice'];
				$newPrice3Month = $agentArr['agentPrice']*3;
				$newPrice6Month	= $agentArr['agentPrice']*6;
				$newPriceYear	= $agentArr['agentPrice']*10;
				$newPrice2Year	= $agentArr['agentPrice']*20;
				$newPrice3Year	= $agentArr['agentPrice']*30;
			}
		}
	}
	echo('
	<input type="hidden" id="userRemMoney" name="userRemMoney" value="'. $userRemMoney .'" />
	');

	$skin->TableTop2('share_list.gif','',''. $dataTypeCN .'管理');
	$skin->TableItemTitle('15%,85%','类型,操作');

	echo('
	<tbody class="tabBody padd8td">
	');

	// 查看/修改资料
	AdmIdc::TrZiliao('vpsApi', $dataID, $vpsRow);


	// 状态：0停止 3待开通 5开通中 6开通失败 8退款中 9已退款 10正常 12试用中 15续费中
	if ($vpsRow['VAU_state'] == 12 && in_array('zhuanzheng',$vpsApiArr['right'])){
		// 转正区  状态为：12试用中
		if ($vpsRow['VAU_payMode'] == '24hour'){
			$payMode = 'month';
			$payCN = '月付';
		}elseif ($vpsRow['VAU_payMode'] == '48hour'){
			$payMode = 'year';
			$payCN = '年付';
		}else{
			$payMode = '';
			$payCN = '['. $vpsRow['VAU_payMode'] .']';
		}
		if ($vpsRow['VAU_apiID'] == 2){
			$zzAlert = '<a href="https://mc.kuaiyun.cn/vps/testToSaleDetail_FastCloud_Under?ywbh='. $vpsRow['VAU_workId'] .'" target="_blank" style="color:red;">（提醒：景安VPS API转正不走包销，请<u>点击此处手动走包销转正</u>）</a>';
		}else{
			$zzAlert = '';
		}
		echo('
		<tr>
			<td align="center" style="font-weight:bold;color:red;">转正</td>
			<td align="left">
				<form method="post" id="zzForm" name="zzForm" action="vpsApiUsers_deal.php?mudi=moreDeal&mudi2=zhuanzheng" onsubmit="return CheckMoreForm(\'zhuanzheng\')">
				<script language="javascript" type="text/javascript">document.write(\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'">\')</script>
				<input type="hidden" name="dataID" value="'. $dataID .'" />
				<input type="hidden" id="zzMode" name="payMode" value="'. $payMode .'" />
				转正模式：<select id="isApi" name="isApi">
					<option value=""></option>
					'. ($vpsRow['VAU_apiID'] > 0 ? '<option value="1">上级API一起转正</option>' : '') .'
					<option value="0">只转正本站数据</option>
				</select>
				<input type="submit" value="马上转正为'. $payCN .'" />
				&ensp;&ensp;'. $zzAlert .'
				</form>
				');
				if ($vpsRow['VAU_apiID'] == 2){
					echo('
					<div style="padding-top:5px;">
						获取<input type="text" id="bxOrderNum" name="bxOrderNum" value="1" style="width:20px;" />个包销订单号：
						<input type="button" value="月包销" style="margin-right:2px;" onclick=\'DataDeal.location.href="vpsApiUsers_deal.php?mudi=getBaoxiaoOrder&proID='. $vpsRow['VAU_proDataID'] .'&num="+ $id("bxOrderNum").value +"&month=1";\' />
						<input type="button" value="年包销" style="margin-right:2px;" onclick=\'DataDeal.location.href="vpsApiUsers_deal.php?mudi=getBaoxiaoOrder&proID='. $vpsRow['VAU_proDataID'] .'&num="+ $id("bxOrderNum").value +"&month=12";\' />
						<span id="bxOrder" style="color:green;"></span>
						'. AdmIdc::JinganBaoxiaoInfo($proRow['VAD_apiID'], $vpsRow['VAU_proDataID'], 'vpsApi', '') .'
					</div>
					');
				}
			echo('
			</td>
		</tr>
		');
	}

	if ($vpsRow['VAU_isAuth'] != 1 && in_array('shiming',$vpsApiArr['right'])){
		// 实名认证   状态：非实名认证
		echo('
		<tr>
			<td align="center">实名认证</td>
			<td align="left">
				<form method="post" id="updateForm" name="updateForm" action="vpsApiUsers_deal.php?mudi=moreDeal&mudi2=auth" onsubmit="return CheckMoreForm(\'auth\')">
				<script language="javascript" type="text/javascript">document.write(\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'">\')</script>
				<input type="hidden" name="dataID" value="'. $dataID .'" />
				<input type="hidden" name="workId" value="'. $vpsRow['VAU_workId'] .'" />
				关联认证：<select id="proWorkID" name="proWorkID">
				');
				$typeexe = $DB->query('select VAU_ID,VAU_proDataName,VAU_workId,VAU_ipStr,VAU_username from '. OT_dbPref .'vpsApiUsers where VAU_isAuth=1 and VAU_event like "%|auth|%"');
				if ($typeDt = $typeexe->fetch()){
					echo('<option value=""></option>');
					do{
						echo('<option value="'. $typeDt['VAU_workId'] .'">'. $typeDt['VAU_proDataName'] .'，用户名：'. $typeDt['VAU_username'] .'，IP：'. IdcArea::IpArr($typeDt['VAU_ipStr'], 0) .'</option>');
					}while ($typeDt = $typeexe->fetch());
				}else{
					echo('<option value="">抱歉！暂无关联认证记录</option>');
				}
				unset($typeexe);

				echo('
				</select>
				&ensp;<input type="submit" value="确定认证" />
				</form>
			</td>
		</tr>
		');
	}

	if (in_array($vpsRow['VAU_state'],array(10,15)) && in_array('xufei',$vpsApiArr['right'])){
		// 续费   状态：10正常 15续费中
		$apiAddi1 = $apiAddi2 = '';
		if ($vpsRow['VAU_apiID'] > 0){
			$apiAddi1 = '<div style="margin-top:3px;color:red;">(上级会扣款)</div>';
			if ($vpsRow['VAU_apiID'] == 2){
				$apiAddi2 .= AdmIdc::JinganBaoxiaoInfo($vpsRow['VAU_apiID'], $vpsRow['VAU_proDataID'], 'vpsApi', 'xufei');
			}
			$apiAddi2 .= '<div class="font2_2">（直接选时间会向上级API延期产品的到期时间，但手工指定时间并不会影响到上级API的时间！）</div>';
		}
		echo('
		<tr>
			<td align="center">单独设置续费价格</td>
			<td align="left" style="line-height:2;">
				<form method="post" id="newPriceForm" name="newPriceForm" action="vpsApiUsers_deal.php?mudi=moreDeal&mudi2=newPrice" onsubmit="return CheckMoreForm(\'newPrice\')">
				<script language="javascript" type="text/javascript">document.write(\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'">\')</script>
				<input type="hidden" name="dataID" value="'. $dataID .'" />
				<input type="hidden" id="priceMonthOld" name="priceMonthOld" value="'. $proRow['VAD_priceMonth'] .'" />
				<input type="hidden" id="price3MonthOld" name="price3MonthOld" value="'. $proRow['VAD_price3Month'] .'" />
				<input type="hidden" id="price6MonthOld" name="price6MonthOld" value="'. $proRow['VAD_price6Month'] .'" />
				<input type="hidden" id="priceYearOld" name="priceYearOld" value="'. $proRow['VAD_priceYear'] .'" />
				<input type="hidden" id="costMonthOld" name="costMonthOld" value="'. $proRow['VAD_costMonth'] .'" />
				<input type="hidden" id="cost3MonthOld" name="cost3MonthOld" value="'. $proRow['VAD_cost3Month'] .'" />
				<input type="hidden" id="cost6MonthOld" name="cost6MonthOld" value="'. $proRow['VAD_cost6Month'] .'" />
				<input type="hidden" id="costYearOld" name="costYearOld" value="'. $proRow['VAD_costYear'] .'" />
				<input type="hidden" id="rateMonth" name="rateMonth" value="'. $proRow['VAD_rateMonth'] .'" />
				<input type="hidden" id="rate3Month" name="rate3Month" value="'. $proRow['VAD_rate3Month'] .'" />
				<input type="hidden" id="rate6Month" name="rate6Month" value="'. $proRow['VAD_rate6Month'] .'" />
				<input type="hidden" id="rateYear" name="rateYear" value="'. $proRow['VAD_rateYear'] .'" />
				<input type="hidden" id="rate2Year" name="rate2Year" value="'. $proRow['VAD_rate2Year'] .'" />
				<input type="hidden" id="rate3Year" name="rate3Year" value="'. $proRow['VAD_rate3Year'] .'" />
				<input type="hidden" id="rate4Year" name="rate4Year" value="'. $proRow['VAD_rate4Year'] .'" />
				<input type="hidden" id="rate5Year" name="rate5Year" value="'. $proRow['VAD_rate5Year'] .'" />
				<div style="float:left;padding-top:10px;">
					<label><input type="checkbox" id="isNewPrice" name="isNewPrice" value="1" '. Is::Checked($vpsRow['VAU_isNewPrice'],1) .' onclick="CheckNewPrice()" />开启单独续费价格</label>
				</div>
				<div id="newPriceBox" style="float:left;display:none;">
				<div style="float:left;padding-left:15px;">
					月付：<input type="text" id="priceMonth" name="priceMonth" size="10" style="width:60px;" value="'. $newPriceMonth .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
					<input type="button" value="自动算" onclick="CalcPriceCost()" /><br />
					成本：<input type="text" id="costMonth" name="costMonth" size="10" style="width:60px;" value="'. $newCostMonth .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
				</div>
				<div style="float:left;padding-left:15px;">
					季付：<input type="text" id="price3Month" name="price3Month" size="10" style="width:60px;" value="'. $newPrice3Month .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" /><br />
					成本：<input type="text" id="cost3Month" name="cost3Month" size="10" style="width:60px;" value="'. $newCost3Month .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
				</div>
				<div style="float:left;padding-left:15px;">
					半年付：<input type="text" id="price6Month" name="price6Month" size="10" style="width:60px;" value="'. $newPrice6Month .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" /><br />
					&ensp;&ensp;成本：<input type="text" id="cost6Month" name="cost6Month" size="10" style="width:60px;" value="'. $newCost6Month .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
				</div>
				<div style="float:left;padding-left:15px;">
					年付：<input type="text" id="priceYear" name="priceYear" size="10" style="width:60px;" value="'. $newPriceYear .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" /><br />
					成本：<input type="text" id="costYear" name="costYear" size="10" style="width:60px;" value="'. $newCostYear .'" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
				</div>
				</div>
				<div style="float:left;padding-left:15px;">
					<input type="submit" value="保存" style="height:45px;" />
				</div>
				</form>
			</td>
		</tr>
		<tr>
			<td align="center">续费'. $apiAddi1 .'</td>
			<td align="left">
				<form method="post" id="xufeiForm" name="xufeiForm" action="vpsApiUsers_deal.php?mudi=moreDeal&mudi2=xufei" onsubmit="return CheckMoreForm(\'xufei\')">
				<script language="javascript" type="text/javascript">document.write(\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'">\')</script>
				<input type="hidden" name="dataID" value="'. $dataID .'" />
				<label><input type="radio" name="payMode" value="month" onclick="LoadPrice(\'xufei\')" checked="checked" />一个月<span style="color:red;">'. $pMonthStr .'</span></label>&ensp;
				<label><input type="radio" name="payMode" value="3month" onclick="LoadPrice(\'xufei\')" />一季<span style="color:red;">'. $p3MonthStr .'</span></label>&ensp;
				<label><input type="radio" name="payMode" value="6month" onclick="LoadPrice(\'xufei\')" />半年<span style="color:red;">'. $p6MonthStr .'</span></label>&ensp;
				<label><input type="radio" name="payMode" value="year" onclick="LoadPrice(\'xufei\')" />一年<span style="color:red;">'. $pYearStr .'</span></label>&ensp;
				<label><input type="radio" name="payMode" value="2year" onclick="LoadPrice(\'xufei\')" />两年<span style="color:red;">'. $p2YearStr .'</span></label>&ensp;
				<label><input type="radio" name="payMode" value="3year" onclick="LoadPrice(\'xufei\')" />三年<span style="color:red;">'. $p3YearStr .'</span></label>&ensp;
				'. $apiAddi2 .'
				<div style="padding-top:10px;">
					价格：<input type="text" id="userPrice" name="userPrice" size="10" style="width:70px;" value="" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value);}CalcUserRemMoney(\'userXufeiRemMoney\',\'xufei\');" />元&ensp;&ensp;
					成本：<input type="text" id="userCost" name="userCost" style="width:70px;" value="" />元&ensp;&ensp;
					<span id="xufeiPay0Box">
						不扣款说明：<input type="text" id="xufeiNote" name="moneyNote" size="22" style="width:160px;" value=""/>
						<select onchange="if (this.value!=\'\'){$id(\'xufeiNote\').value = this.value;}">
							<option value="">候选项</option>
							'. Info::TypeOptionList('moneyNote', '在【IDC设置】-【不扣款说明管理】里设置候选项') .'
						</select>
						<span class="font2_2">(会显示在财务信息里)</span>
					</span>
				</div>
				<div style="padding-top:10px;">
					<label><input type="radio" id="isUserPay0" name="isUserPay" value="0" onclick="CheckXufeiPay();" />不扣款</label>&ensp;&ensp;
					<label><input type="radio" id="isUserPay1" name="isUserPay" value="1" checked="checked" onclick="CheckXufeiPay();CalcUserRemMoney(\'userXufeiRemMoney\',\'xufei\');" />从用户金额中扣款</label>
					&ensp;&ensp;<span id="userXufeiRemMoney" style="color:red;"></span>&ensp;&ensp;
					续费：
					<label><input type="checkbox" id="timeObj" name="timeObj" value="1" checked="checked" />到期时间</label>&ensp;
					<label><input type="checkbox" id="apiObj" name="apiObj" value="1" checked="checked" />API到期</label>&ensp;
					&ensp;
					<input type="submit" value="马上续费" />
					<script language="javascript" type="text/javascript">CheckXufeiPay();CalcUserRemMoney("userXufeiRemMoney","xufei");</script>
				</div>
				</form>
			</td>
		</tr>
		');
	}

	if (in_array($vpsRow['VAU_state'],array(10,15)) && in_array('update',$vpsApiArr['right'])){
		// 升级   状态：10正常 15续费中
		$agentName = '会员';
		if ($vpsRow['VAU_isNewPrice'] == 1){
			$currPrice = floatval($vpsRow['VAU_priceMonth']);
			$currCost = floatval($vpsRow['VAU_costMonth']);
			$priceStr = '单独价：'. $currPrice .'，原价：'. floatval($proRow['VAD_priceMonth']) .'';

		}else{
			$currPrice = floatval($proRow['VAD_priceMonth']);
			$currCost = floatval($proRow['VAD_costMonth']);
			$priceStr = '月付：'. $currPrice .'';
			if ($userGroupID > 0){
				$groupName = $DB->GetOne('select UG_theme from '. OT_dbPref .'userGroup where UG_ID='. $userGroupID);

				// 走代理折扣价
				$agentArr = AppAgent::CheckPrice('vpsApi', $vpsRow['VAU_proDataID'], $userGroupID, $proRow['VAD_minPrice']);
				if ($agentArr['isAgent'] == 1){
					$agentName = $agentArr['agentName'];
					$priceStr = $agentArr['agentName'] .'价：'. $agentArr['agentPrice'] .'，原价：'. $currPrice .'';
					$currPrice = $agentArr['agentPrice'];
				}
			}
		}
		echo('
		<tr>
			<td align="center">升级</td>
			<td align="left">
				<form method="post" id="updateForm" name="updateForm" action="vpsApiUsers_deal.php?mudi=moreDeal&mudi2=update" onsubmit="return CheckMoreForm(\'update\')">
				<script language="javascript" type="text/javascript">document.write(\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'">\')</script>
				<input type="hidden" name="dataID" value="'. $dataID .'" />
				<div style="line-height:2;">
					<div class="font2_2">当前产品 月付（'. $priceStr .'，成本：'. $currCost .'）</div>
					更换产品：<select id="proDataID" name="proDataID">
					');

					$monthNum = TimeDate::Diff('m', TimeDate::Get(), $vpsRow['VAU_endTime'], 'ceil');
					$typeexe = $DB->query('select VAD_ID,VAD_theme,VAD_priceMonth,VAD_price3Month,VAD_price6Month,VAD_priceYear,VAD_price2Year,VAD_price3Year,VAD_costMonth,VAD_cost3Month,VAD_cost6Month,VAD_costYear,VAD_cost2Year,VAD_cost3Year,VAD_minPrice from '. OT_dbPref .'vpsApiData where VAD_typeID='. $proRow['VAD_typeID'] .' and VAD_priceMonth>'. $proRow['VAD_priceMonth'] .' order by VAD_priceMonth ASC');
					if ($typeDt = $typeexe->fetch()){
						echo('<option value=""></option>');
						do{
							$typeDt['VAD_priceMonth'] = floatval($typeDt['VAD_priceMonth']);
							$priceStr = '月付：'. $typeDt['VAD_priceMonth'];

							// 走代理折扣价
							$agentArr = AppAgent::LoadPrice('vpsApi', $typeDt['VAD_ID'], $userGroupID, $typeDt['VAD_minPrice']);
							if ($agentArr['isAgent'] == 1){
								$priceStr = $agentName .'价：'. $agentArr['agentPrice'] .'，原价：'. floatval($typeDt['VAD_priceMonth']);
								$typeDt['VAD_priceMonth'] = $agentArr['agentPrice'];
							}

							$pmPriceStr = '';
							if ($vpsRow['VAU_payMode'] != 'month'){
								if ($agentArr['isAgent'] == 1){
									$pmpStr = $payModeCN . $agentName .'价格：'. IdcInfo::VpsAgentPrice($vpsRow['VAU_payMode'], $agentArr['agentPrice']);
								}else{
									$pmpStr = $payModeCN .'价格：'. IdcInfo::VpsPayPrice($vpsRow['VAU_payMode'], $typeDt, 'VAD_');
								}
								$pmPriceStr = '&ensp;'. $pmpStr .'，'. $payModeCN .'成本：'. IdcInfo::VpsPayCost($vpsRow['VAU_payMode'], $typeDt, 'VAD_') .'，';
							}

							$updatePrice = ($typeDt['VAD_priceMonth']-$currPrice)*$monthNum;
							echo('<option value="'. $typeDt['VAD_ID'] .'">'. $typeDt['VAD_theme'] .'&ensp;&ensp;&ensp;（'. $priceStr .'，成本：'. floatval($typeDt['VAD_costMonth']) .'，补'. $monthNum .'个月差价：'. $updatePrice .'）'. $pmPriceStr .'</option>');
						}while ($typeDt = $typeexe->fetch());
					}else{
						echo('<option value="">抱歉！该类型下已没有可升级的产品</option>');
					}
					unset($typeexe);

					echo('
					</select>
					<input type="button" value="读取价格" onclick="LoadUpdatePrice()" />
				</div>
				<div style="padding-top:10px;">
					扣款金额：<input type="text" id="updatePrice" name="userPrice" size="10" style="width:70px;" value="" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value);}CalcUserRemMoney(\'userUpdateRemMoney\',\'update\');" />元&ensp;&ensp;
					新'. $payModeCN .'价格：<input type="text" id="updateNewPrice" name="newPrice" size="10" style="width:70px;" value="" />元&ensp;&ensp;
					新'. $payModeCN .'成本：<input type="text" id="updateNewCost" name="newCost" style="width:70px;" value="" />元&ensp;&ensp;
					<span id="updatePay0Box">
						不扣款说明：<input type="text" id="updateNote" name="moneyNote" size="22" style="width:160px;" value=""/>
						<select onchange="if (this.value!=\'\'){$id(\'updateNote\').value = this.value;}">
							<option value="">候选项</option>
							'. Info::TypeOptionList('moneyNote', '在【IDC设置】-【不扣款说明管理】里设置候选项') .'
						</select>
						<span class="font2_2">(会显示在财务信息里)</span>
					</span>
				</div>
				<div style="padding-top:10px;">
					<label><input type="radio" id="isUpdatePay0" name="isUserPay" value="0" onclick="CheckUpdatePay();" />不扣款</label>&ensp;&ensp;
					<label><input type="radio" id="isUpdatePay1" name="isUserPay" value="1" checked="checked" onclick="CheckUpdatePay();CalcUserRemMoney(\'userUpdateRemMoney\',\'update\');" />从用户金额中扣款</label>&ensp;&ensp;<span id="userUpdateRemMoney" style="color:red;"></span>&ensp;&ensp;
					<input type="submit" value="马上升级" />
					<div class="font2_2">（注意：代理及代理名下用户请让代理或用户自己操作，这儿操作不会返款给上级代理）</div>
					<script language="javascript" type="text/javascript">CheckUpdatePay();CalcUserRemMoney("userUpdateRemMoney","update");</script>
				</div>
				</form>
			</td>
		</tr>
		');
	}

	// 调整价格/成本、调整时间、调整API到期
	AdmIdc::TrTiaozheng('vpsApi', $dataID, $vpsRow);

	// 更改数据库中的状态、转移产品
	AdmIdc::TrStateUser('vpsApi', $dataID, $vpsRow);

	if ($vpsRow['VAU_state'] != 9){
		// 手工退款    状态为 非9已退款
		AdmIdc::TrTuikuan('vpsApi', $dataID, $vpsRow);
	}

	// 删除
	AdmIdc::TrDel('vpsApi', $dataID, $vpsRow);

	echo('
	</tbody>
	</table>
	<div style="height:10px;"></div>
	</td></tr></table>
	');

}



function CpManage(){
	global $DB,$skin,$mudi,$dataType,$dataTypeCN;

	$dataID		= OT::GetInt('dataID');
	
	AppVpsApi::PanelLogin($dataID, -1, '../');
}



// 导入
function importWeb(){
	global $DB,$MB,$skin,$mudi,$dataType,$dataTypeCN;

	$dataMode	= OT::GetStr('dataMode');
	$dataModeStr= OT::GetStr('dataModeStr');
	$backURL	= OT::GetStr('backURL');
	$proDataID	= OT::GetInt('proDataID');

	$proRow = $DB->GetRow('select VAD_apiID,VAD_typeID,VAD_theme,VAD_useTimeStr,VAD_priceMonth,VAD_costMonth,VAD_priceDay,VAD_costDay,VAD_priceWeek,VAD_costWeek,VAD_price3Month,VAD_cost3Month,VAD_price6Month,VAD_cost6Month,VAD_priceYear,VAD_costYear,VAD_price2Year,VAD_cost2Year,VAD_price3Year,VAD_cost3Year,VAD_price4Year,VAD_cost4Year,VAD_price5Year,VAD_cost5Year,VAD_comProID,VAD_comServID,VAD_pcountry,VAD_ptype,VAD_pname from '. OT_dbPref .'vpsApiData where VAD_ID='. $proDataID);
	if (! $proRow){
		JS::AlertBackEnd('云服务器类型无该记录！');
	}else{
		$VAD_apiID			= $proRow['VAD_apiID'];
		$VAD_typeID			= $proRow['VAD_typeID'];
		$VAD_theme			= $proRow['VAD_theme'];
		$VAD_useTimeStr		= $proRow['VAD_useTimeStr'];
		$VAD_priceMonth		= $proRow['VAD_priceMonth'];
		$VAD_costMonth		= $proRow['VAD_costMonth'];
		$VAD_priceDay		= $proRow['VAD_priceDay'];
		$VAD_costDay		= $proRow['VAD_costDay'];
		$VAD_priceWeek		= $proRow['VAD_priceWeek'];
		$VAD_costWeek		= $proRow['VAD_costWeek'];
		$VAD_price3Month	= $proRow['VAD_price3Month'];
		$VAD_cost3Month		= $proRow['VAD_cost3Month'];
		$VAD_price6Month	= $proRow['VAD_price6Month'];
		$VAD_cost6Month		= $proRow['VAD_cost6Month'];
		$VAD_priceYear		= $proRow['VAD_priceYear'];
		$VAD_costYear		= $proRow['VAD_costYear'];
		$VAD_price2Year		= $proRow['VAD_price2Year'];
		$VAD_cost2Year		= $proRow['VAD_cost2Year'];
		$VAD_price3Year		= $proRow['VAD_price3Year'];
		$VAD_cost3Year		= $proRow['VAD_cost3Year'];
		$VAD_price4Year		= $proRow['VAD_price4Year'];
		$VAD_cost4Year		= $proRow['VAD_cost4Year'];
		$VAD_price5Year		= $proRow['VAD_price5Year'];
		$VAD_cost5Year		= $proRow['VAD_cost5Year'];
		$VAD_comProID		= $proRow['VAD_comProID'];
		$VAD_comServID		= $proRow['VAD_comServID'];
		$VAD_pcountry		= $proRow['VAD_pcountry'];
		$VAD_ptype			= $proRow['VAD_ptype'];
		$VAD_pname			= $proRow['VAD_pname'];

		$typeRow = $DB->GetRow('select VT_classID,VT_companyID from '. OT_dbPref .'vpsType where VT_ID='. $VAD_typeID);
		$classID	= $typeRow['VT_classID'];
		$companyID	= $typeRow['VT_companyID'];
		if ($classID > 0){
			$classexe = $DB->query('select VC_prefName,VC_useNum,VC_numLen from '. OT_dbPref .'vpsClass where VC_ID='. $classID);
			if ($row2 = $classexe->fetch()){
				$VC_prefName	= $row2['VC_prefName'];
				$VC_useNum		= $row2['VC_useNum'];
				$VC_numLen		= $row2['VC_numLen'];
				$VAU_vpsName	= $row2['VC_prefName'] . Str::FixLen($row2['VC_useNum']+1, $row2['VC_numLen']);
			}
		}
	}
	unset($proexe);

	$vpsSysArr = Cache::PhpFile('vpsSys');

	echo('
	<form id="dealForm" name="dealForm" method="post" action="vpsApiUsers_deal.php?mudi='. $mudi .'&nohrefStr=close" onsubmit="return CheckImportForm()">
	<input type="hidden" id="dataMode" name="dataMode" value="'. $dataMode .'" />
	<input type="hidden" id="dataModeStr" name="dataModeStr" value="'. $dataModeStr .'" />
	<input type="hidden" id="dataType" name="dataType" value="'. $dataType .'" />
	<input type="hidden" id="dataTypeCN" name="dataTypeCN" value="'. $dataTypeCN .'" />

	<input type="hidden" id="proDataID" name="proDataID" value="'. $proDataID .'" />
	<input type="hidden" id="classID" name="classID" value="'. $classID .'" />
	<input type="hidden" id="companyID" name="companyID" value="'. $companyID .'" />
	<input type="hidden" id="prefName" name="prefName" value="'. $VC_prefName .'" />
	<input type="hidden" id="useNum" name="useNum" value="'. $VC_useNum .'" />
	<input type="hidden" id="numLen" name="numLen" value="'. $VC_numLen .'" />

	<input type="hidden" id="priceMonth" name="priceMonth" value="'. $VAD_priceMonth .'" />
	<input type="hidden" id="costMonth" name="costMonth" value="'. $VAD_costMonth .'" />
	<input type="hidden" id="priceDay" name="priceDay" value="'. $VAD_priceDay .'" />
	<input type="hidden" id="costDay" name="costDay" value="'. $VAD_costDay .'" />
	<input type="hidden" id="priceWeek" name="priceWeek" value="'. $VAD_priceWeek .'" />
	<input type="hidden" id="costWeek" name="costWeek" value="'. $VAD_costWeek .'" />
	<input type="hidden" id="price3Month" name="price3Month" value="'. $VAD_price3Month .'" />
	<input type="hidden" id="cost3Month" name="cost3Month" value="'. $VAD_cost3Month .'" />
	<input type="hidden" id="price6Month" name="price6Month" value="'. $VAD_price6Month .'" />
	<input type="hidden" id="cost6Month" name="cost6Month" value="'. $VAD_cost6Month .'" />
	<input type="hidden" id="priceYear" name="priceYear" value="'. $VAD_priceYear .'" />
	<input type="hidden" id="costYear" name="costYear" value="'. $VAD_costYear .'" />
	<input type="hidden" id="price2Year" name="price2Year" value="'. $VAD_price2Year .'" />
	<input type="hidden" id="cost2Year" name="cost2Year" value="'. $VAD_cost2Year .'" />
	<input type="hidden" id="price3Year" name="price3Year" value="'. $VAD_price3Year .'" />
	<input type="hidden" id="cost3Year" name="cost3Year" value="'. $VAD_cost3Year .'" />
	<input type="hidden" id="price4Year" name="price4Year" value="'. $VAD_price4Year .'" />
	<input type="hidden" id="cost4Year" name="cost4Year" value="'. $VAD_cost4Year .'" />
	<input type="hidden" id="price5Year" name="price5Year" value="'. $VAD_price5Year .'" />
	<input type="hidden" id="cost5Year" name="cost5Year" value="'. $VAD_cost5Year .'" />
	<input type="hidden" id="apiID" name="apiID" value="'. $VAD_apiID .'" />
	<input type="hidden" id="comProID" name="comProID" value="'. $VAD_comProID .'" />
	<input type="hidden" id="comServID" name="comServID" value="'. $VAD_comServID .'" />
	<input type="hidden" id="pcountry" name="pcountry" value="'. $VAD_pcountry .'" />
	<input type="hidden" id="ptype" name="ptype" value="'. $VAD_ptype .'" />
	<input type="hidden" id="pname" name="pname" value="'. $VAD_pname .'" />
	'. Area::BackUrlInput('') .'
	');

	$skin->TableTop('share_other.gif','','导入'. $dataTypeCN);
		echo('
		<table width="98%" align="center" cellpadding="0" cellspacing="0" summary="" class="padd3td">
		<tr>
			<td width="160"></td>
			<td></td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'产品名称：</td>
			<td align="left">
				'. $VAD_theme .'
				&ensp;&ensp;<a href="?mudi=sel&mudi2=import&dataType='. $dataType .'&dataTypeCN='. urlencode($dataTypeCN) .'" class="font2_2" />[更换产品名称]</a>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">用户名：</td>
			<td align="left">
				<input type="text" id="username" name="username" size="50" style="width:120px;" value="" onblur="CheckUserInfo(this.value,\'\')" />&ensp;&ensp;
				<span id="usernameRes" style="color:red;"></span>
				<input type="button" value="选择用户" onclick="OpenSelUserBox(\'username\',\'username\',\'vpsApiUsers\')" />
				<input type="button" value="创建临时用户" onclick="OpenCreateUserBox(\'username\',\'username\',\'vpsApiUsers\')" />
				<span id="selUserBox" style="display:none;"></span>
				<span id="createUserBox" style="display:none;"></span>
				<script language="javascript" type="text/javascript">CheckUserInfo($id("username").value,"");</script>
			</td>
		</tr>
		');
		if ($VAD_apiID == 1 || $VAD_apiID == 6){
			if ($VAD_apiID == 6){
				$vpsNameBtn = '<input type="button" value="读取网钛IDC" onclick="LoadInfo(6)" />';
			}else{
				$vpsNameBtn = '<input type="button" value="读取星外类" onclick="LoadInfo(1)" />';
			}
			echo('
			<tr>
				<td align="right">'. Skin::RedSign() .'机器编码：</td>
				<td align="left">
					<input type="text" id="vpsName" name="vpsName" size="10" style="width:120px;" value="" />
					'. $vpsNameBtn .'
				</td>
			</tr>
			<tr>
				<td align="right">'. Skin::RedSign() .'服务器密码：</td>
				<td align="left">
					<input type="text" id="vpsPwd" name="vpsPwd" size="10" style="width:120px;" />
				</td>
			</tr>
			<tr>
				<td align="right">自助平台网址：</td>
				<td align="left">
					<input type="text" id="vpsCpUrl" name="vpsCpUrl" size="10" style="width:120px;" />
				</td>
			</tr>
			');
		}else{
			echo('
			<tr>
				<td align="right">'. Skin::RedSign() .'机器编码：</td>
				<td align="left">
					'. $VAU_vpsName .'<input type="hidden" id="vpsName" name="vpsName" value="'. $VAU_vpsName .'" /><input type="hidden" name="isAutoName" value="1" />
				</td>
			</tr>
			<!-- <tr>
				<td align="right">'. Skin::RedSign() .'订单编号(景安)：</td>
				<td align="left">
					<input type="text" id="orderId" name="orderId" size="10" style="width:120px;" />
				</td>
			</tr> -->
			<tr>
				<td align="right">'. Skin::RedSign() .'业务编号(景安)：</td>
				<td align="left">
					<input type="text" id="workId" name="workId" size="10" style="width:120px;" />
					<input type="button" value="读取" onclick="LoadInfo(2)" />
				</td>
			</tr>
			<tr>
				<td align="right">'. Skin::RedSign() .'业务标识(景安)：</td>
				<td align="left">
					<input type="text" id="workSign" name="workSign" size="10" style="width:120px;" />
				</td>
			</tr>
			<tr style="display:none;">
				<td align="right">'. Skin::RedSign() .'虚拟主机密码：</td>
				<td align="left">
					<input type="text" id="vpsPwd" name="vpsPwd" size="50" style="width:120px;" value="'. IdcArea::IdcRndPwd('vpsApi') .'" />&ensp;&ensp;
					<input type="button" value="随机生成" onclick="$id(\'vpsPwd\').value=IdcRndPwd(\'vpsApi\');" />
				</td>
			</tr>
			');
		}
		echo('
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">'. Skin::RedSign() .'IP：</td>
			<td align="left">
				<textarea id="ip" name="ip" style="width:200px;height:60px;" ></textarea>
			</td>
		</tr>
		<!-- <tr>
			<td align="right">容量大小：</td>
			<td align="left">
				<input type="text" id="spaceSize" name="spaceSize" size="10" style="width:120px;" />
			</td>
		</tr> -->
		<tr>
			<td align="right">'. Skin::RedSign() .'开通日期：</td>
			<td align="left">
				<input type="text" id="time" name="time" size="22" style="width:170px;" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss"})\' class="Wdate" />
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'到期日期：</td>
			<td align="left">
				<input type="text" id="endTime" name="endTime" size="22" style="width:170px;" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss"})\' class="Wdate" />
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'API到期日期：</td>
			<td align="left">
				<input type="text" id="vpsEndTime" name="vpsEndTime" size="22" style="width:170px;" onfocus=\'WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:ss"})\' class="Wdate" />
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'付款方式：</td>
			<td align="left">
				<select id="payMode" name="payMode" onchange="CheckPayMode()">
					<option value=""></option>
					<option value="24hour">试用24小时</option>
					');
					if ($VAD_apiID == 1 || $VAD_apiID == 6){
						echo('
						<option value="48hour">试用48小时</option>
						<option value="day">日付 （价格：'. $VAD_priceDay .'，成本：'. $VAD_costDay .'）</option>
						<option value="week">周付 （价格：'. $VAD_priceWeek .'，成本：'. $VAD_costWeek .'）</option>
						');
					}
					echo('
					<option value="month">月付 （价格：'. $VAD_priceMonth .'，成本：'. $VAD_costMonth .'）</option>
					<option value="3month">季付 （价格：'. $VAD_price3Month .'，成本：'. $VAD_cost3Month .'）</option>
					<option value="6month">半年付 （价格：'. $VAD_price6Month .'，成本：'. $VAD_cost6Month .'）</option>
					<option value="year">一年付 （价格：'. $VAD_priceYear .'，成本：'. $VAD_costYear .'）</option>
					<option value="2year">二年付 （价格：'. $VAD_price2Year .'，成本：'. $VAD_cost2Year .'）</option>
					<option value="3year">三年付 （价格：'. $VAD_price3Year .'，成本：'. $VAD_cost3Year .'）</option>
					<!-- <option value="4year">四年付 （价格：'. $VAD_price4Year .'，成本：'. $VAD_cost4Year .'）</option>
					<option value="5year">五年付 （价格：'. $VAD_price5Year .'，成本：'. $VAD_cost5Year .'）</option> -->
				</select>
			</td>
		</tr>
		<tr>
			<td align="right">'. Skin::RedSign() .'销售价格：</td>
			<td align="left">
				<input type="text" id="price" name="price" size="10" style="width:60px;" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
				&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;
				成本：<input type="text" id="cost" name="cost" size="10" style="width:60px;" onkeyup="if (this.value!=FiltDecimal(this.value)){this.value=FiltDecimal(this.value)}" />
			</td>
		</tr>
		<tr style="display:none;">
			<td align="right">'. Skin::RedSign() .'状态：</td>
			<td align="left">
				<label><input type="radio" name="state" value="1" />正常</label>&ensp;&ensp;&ensp;&ensp;
				<label><input type="radio" name="state" value="0" />停止</label>&ensp;&ensp;&ensp;&ensp;
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">前台管理员备注：</td>
			<td align="left">
				<textarea id="note" name="note" style="width:400px;height:60px;"></textarea>
				<span class="font2_2">（前台会员可见）</span>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top" style="padding-top:6px;">内部备注：</td>
			<td align="left">
				<textarea id="adminNote" name="adminNote" style="width:400px;height:60px;"></textarea>
				<span class="font2_2">（仅限后台用户查看）</span>
			</td>
		</tr>
		</table>
		');
	$skin->TableBottom();

	echo('
	<table style="height:16px;" cellpadding="0" cellspacing="0" summary=""><tr><td></td></tr></table>

	<center><input type="image" src="'. AdmTpl::ImgSrc('button_submit') .'" /></center>

	</form>
	');
}

?>