<?php

if(! defined('OT_ROOT')) {
	exit('Access Denied');
}


class AreaApp{

	// 判断是否存在该插件
	public static function Jud($appID){
		global $DB;

		$chkexe = $DB->query('select PS_ID from '. OT_dbPref .'paySoft where PS_appID='. $appID .' and PS_state=1');
		if ($chkexe->fetch()){
			return true;
		}else{
			return false;
		}
		unset($chkexe);
	}


	// 判断邮箱、手机号是否提醒
	public static function UserTixing($UE_authStr, $userSysArr, $level, $mode='js', $addiStr=''){
		if ($userSysArr['US_isAuthMail'] == 1 && strpos(''. $UE_authStr,'|邮箱|') === false && AppMail::Jud()){
			if ($userSysArr['US_isMustMail'] == 1){
				$alertStr = 'alert("'. $addiStr .'您好，您需要先填写/验证下邮箱，才能进行其他操作。\n'. $userSysArr['US_mustMailStr'] .'");document.location.href="'. Users::SysUrl('revInfo','&revType=mail', '', OT_MODE) .'";';
				if ($mode == 'str'){ die($alertStr); }else{ JS::DiyEnd($alertStr); }
			}elseif ($userSysArr['US_isMustMail'] == 2 && $level >= 2){
				$alertStr = 'if (confirm("'. $addiStr .'您好，建议填写/验证下邮箱。\n'. $userSysArr['US_mustMailStr'] .'\n如现在填写/验证邮箱，请点【确定】，否则点【取消】")){ document.location.href="'. Users::SysUrl('revInfo','&revType=mail', '', OT_MODE) .'"; isTop=true; }';
				if ($mode == 'str'){ echo($alertStr); }else{ JS::Diy($alertStr); }
			}
		}
		if ($userSysArr['US_isAuthPhone'] == 1 && strpos(''. $UE_authStr,'|手机|') === false && AppPhone::Jud()){
			if ($userSysArr['US_isMustPhone'] == 1){
				$alertStr = 'if (typeof(isTop) == "undefined"){ alert("'. $addiStr .'您好，您需要先填写/验证下手机号，才能进行其他操作。\n'. $userSysArr['US_mustPhoneStr'] .'");document.location.href="'. Users::SysUrl('revInfo','&revType=phone', '', OT_MODE) .'"; }';
				if ($mode == 'str'){ die($alertStr); }else{ JS::DiyEnd($alertStr); }
			}elseif ($userSysArr['US_isMustPhone'] == 2 && $level >= 2){
				$alertStr = 'if (typeof(isTop) == "undefined"){ if (confirm("'. $addiStr .'您好，建议填写/验证下手机号。\n'. $userSysArr['US_mustPhoneStr'] .'\n如现在填写/验证手机号，请点【确定】，否则点【取消】")){ document.location.href="'. Users::SysUrl('revInfo','&revType=phone', '', OT_MODE) .'"; isTop=true; } }';
				if ($mode == 'str'){ echo($alertStr); }else{ JS::Diy($alertStr); }
			}
		}
		if ($userSysArr['US_isShiming'] >= 2 && strpos(''. $UE_authStr,'|实名认证|') === false){ //  && strpos(''. $UE_authStr,'|实名审核|') === false
			if ($userSysArr['US_isShiming'] == 2){
				$alertStr = 'if (typeof(isTop) == "undefined"){ alert("'. $addiStr .'您好，国家网信办、公安部，要求先进行实名认证，才能进行其他操作。\n如已填写实名信息，请联系管理员审核通过下。\n'. $userSysArr['US_shimingStr'] .'");document.location.href="'. Users::SysUrl('revInfo','&revType=shiming', '', OT_MODE) .'"; }';
				if ($mode == 'str'){ die($alertStr); }else{ JS::DiyEnd($alertStr); }
			}elseif ($level >= 2){
				$alertStr = 'if (typeof(isTop) == "undefined"){ if (confirm("'. $addiStr .'您好，国家网信办、公安部，要求建议进行实名认证。\n如已填写实名信息，请联系管理员审核通过下。\n'. $userSysArr['US_shimingStr'] .'\n如现在进行实名认证，请点【确定】，否则点【取消】")){ document.location.href="'. Users::SysUrl('revInfo','&revType=shiming', '', OT_MODE) .'"; isTop=true; } }';
				if ($mode == 'str'){ echo($alertStr); }else{ JS::Diy($alertStr); }
			}
		}
	}


	// 云存储 上传文件处理
	public static function OssNameArr(){
		return array('qiniu','upyun','aliyun','ftp');
	}

	// 云存储 上传文件处理
	public static function OssTypeCN($oss,$type=''){
		switch ($oss){
			case 'qiniu':	return '七牛云';
			case 'upyun':	return '又拍云';
			case 'aliyun':	return '阿里云';
			case 'ftp':		return 'FTP云存储';
			default :		return $type;
		}
	}

	// 云存储 获取文件名
	public static function OssFileName($filePath,$filePath2=''){
		if (strlen(''. $filePath2) <= 3){
			if (strpos(''. $filePath,'/') !== false){
				$filePath = substr($filePath,strrpos($filePath,'/')+1);
			}
		}
		return $filePath;
	}

	// 云存储 获取网址数组
	public static function OssUrlArr(){
		global $appSysArr;
		if (empty($appSysArr)){ $appSysArr = Cache::PhpFile('appSys'); }

		$retArr = array();
		if ( strlen(''. $appSysArr['AS_qiniuUrl']) > 8 ){
			$retArr['qiniu'] = $appSysArr['AS_qiniuUrl'];
		}
		if ( strlen(''. $appSysArr['AS_upyunUrl']) > 8 ){
			$retArr['upyun'] = $appSysArr['AS_upyunUrl'];
		}
		if ( strlen(''. $appSysArr['AS_aliyunUrl']) > 8 ){
			$retArr['aliyun'] = $appSysArr['AS_aliyunUrl'];
		}
		if ( strlen(''. $appSysArr['AS_ftpUrl']) > 8 ){
			$retArr['ftp'] = $appSysArr['AS_ftpUrl'];
		}
		return $retArr;
	}

	// 云存储 网址属于哪个 array('type'=>云存储类型, 'ossUrl'=>绑定网址, 'name'=>可能带目录的文件名, 'fileName'=>文件名)
	public static function OssUrlType($fileName, $ossUrlArr=null, $mode=''){
		if (empty($ossUrlArr)){ $ossUrlArr = self::OssUrlArr(); }

		$retVal = '';
		if (strlen($fileName) > 3){
			$fileName = str_replace(array('../','..\\'), '', $fileName);
			foreach ($ossUrlArr as $key => $val){
				if ( stripos($fileName, $val) !== false ){
					if ($mode == 'arr'){
						$retVal = array('type'=>$key, 'ossUrl'=>$val, 'name'=>str_replace($val, '', $fileName), 'fileName'=>pathinfo($fileName,PATHINFO_BASENAME));
					}else{
						$retVal = $key;
					}
					break;
				}
			}
		}
		return $retVal;
	}

	// 云存储 上传文件处理
	public static function OssDeal($type, $fileName, $filePath){
		global $autoloadItem;
		$autoloadItem = $type;

		$retArr = array('res'=>false, 'code'=>'', 'note'=>'', 'path'=>'');
		switch ($type){
			case 'qiniu':
				$retArr = AppOssQiniuDeal::UpFile($fileName, $filePath);
				break;
		
			case 'upyun':
				$retArr = AppOssUpyunDeal::UpFile($fileName, $filePath);
				break;
		
			case 'aliyun':
				$retArr = AppOssAliyunDeal::UpFile($fileName, $filePath);
				break;
		
			case 'ftp':
				$retArr = AppOssFtpDeal::UpFile($fileName, $filePath);
				break;
		
			default :
				die('type参数目的不明确（'. $type .'）');
				$retArr = array('res'=>false, 'code'=>1, 'note'=>'type参数目的不明确（'. $type .'）', 'path'=>'');
				break;
		}
		// if ($retArr['res']){
			File::Del($filePath);
		// }
		return array_merge($retArr,array('type'=>$type, 'name'=>self::OssTypeCN($type)));
	}

	// 云存储 删除文件处理 $fileName 可能带目录的文件名
	public static function OssDel($type, $fileName){
		global $autoloadItem;
		$autoloadItem = $type;

		$retArr = array('res'=>false, 'code'=>'', 'note'=>'');
		switch ($type){
			case 'qiniu':
				$retArr = AppOssQiniuDeal::DelFile($fileName);
				if ($retArr['res'] == false && strpos(''. $fileName,'/') !== false){
					$retArr = AppOssQiniuDeal::DelFile(AreaApp::OssFileName($fileName)); // 考虑旧版没有分目录存放，故去掉目录路径再删除一遍
				}
				break;
		
			case 'upyun':
				$retArr = AppOssUpyunDeal::DelFile($fileName);
				if ($retArr['res'] == false && strpos(''. $fileName,'/') !== false){
					$retArr = AppOssUpyunDeal::DelFile(AreaApp::OssFileName($fileName));
				}
				break;
		
			case 'aliyun':
				$retArr = AppOssAliyunDeal::DelFile($fileName);
				if ($retArr['res'] == false && strpos(''. $fileName,'/') !== false){
					$retArr = AppOssAliyunDeal::DelFile(AreaApp::OssFileName($fileName));
				}
				break;
		
			case 'ftp':
				$retArr = AppOssFtpDeal::DelFile($fileName);
				/* if ($retArr['res'] == false && strpos(''. $fileName,'/') !== false){
					$retArr = AppOssFtpDeal::DelFile(AreaApp::OssFileName($fileName));
				} */
				break;
		
			default :
				die('type参数目的不明确（'. $type .'）');
				$retArr = array('res'=>false, 'code'=>1, 'note'=>'type参数目的不明确（'. $type .'）');
				break;
		}
		return $retArr;
	}

	// 采集系统 获取内容页标题（废弃，后期删除，迁移如AppColl 插件文件里）
	public static function CollGetTheme($str){
		return AppColl::GetTheme($str);
	}

	// 采集系统 获取内容页正文（废弃，后期删除，迁移如AppColl 插件文件里）
	public static function CollGetContent($contentStr, $hrefCode, $webHtml, $dataArr){
		return AppColl::GetContent($contentStr, $hrefCode, $webHtml, $dataArr);
	}


	// 信息通知
	public static function MessageSend($type, $str, $paraArr = array()){
		// 检测是否调用钉钉群机器人发送
		if (AppDingding::Jud()){
			$resArr = AppDingding::Send($type, $str, $paraArr);
		}
		// 检测是否调用企业微信群机器人发送
		if (AppWeixinWork::Jud()){
			$resArr = AppWeixinWork::Send($type, $str, $paraArr);
		}
	}


	// 通知用户自己
	public static function MyselfSend($type, $dataArr = array()){
		// 检测是否发送微信消息通知
		if ($type == 'login'){
			if (AppWeixin::Jud()){
				if ( empty($dataArr['str2']) ){ $dataArr['str2'] = '如不是您本人操作，请登录平台修改账号密码，同时跟我们客服联系反馈下。'; }
				$paraArr = array();
				$paraArr['first']		= array('color'=>'#0000FF', 'value'=>$dataArr['str1']);
				$paraArr['keyword1']	= array('color'=>'#008000', 'value'=>$dataArr['username']);
				$paraArr['keyword2']	= array('color'=>'#000000', 'value'=>$dataArr['sitename']);
				$paraArr['keyword3']	= array('color'=>'#ff0000', 'value'=>TimeDate::Get());
				$paraArr['remark']		= array('color'=>'#0000FF', 'value'=>$dataArr['str2']);
				$resArr = AppWeixin::TplSend('login', $UE_weixinID, $paraArr);
				//if (! $resArr['res']){ die('err:'. $resArr['note']); }
			}
		}
	}

	// 重复插件选择
	public static function IdNameArr($str){
		if ( OT_SOFTTYPE == 'idccms' ){
			switch ($str){
				case 'base':	return array('id' => 48,	'name' => 'IDC商业版基础包');
				case 'money':	return array('id' => 134,	'name' => 'IDC财务基础包');
				case 'recom':	return array('id' => 132,	'name' => 'IDC推广提现');
			}
		}else{
			switch ($str){
				case 'base':	return array('id' => 4,		'name' => '商业版基础包');
				case 'money':	return array('id' => 23,	'name' => '财务基础包');
				case 'recom':	return array('id' => 57,	'name' => '推广提现');
			}
		}
		return array('id' => 0, 'name' => '无');
	}

	// 组合插件教程文章
	public static function GetNews($str, $mode=''){
		$retArr = array(
			'scoreQuan'	=> array(
				'theme'	=> '插件组合：用积分自动发卡密 = 卡密卡券 + 积分商城', 
				'url'	=> 'http://otcms.com/news/8051.html'
				),
			'autoNews'	=> array(
				'theme'	=> '插件组合：无人坚守每天自动更新文章 = 商业版基础包 + 采集系统 + 自动生成静态页 + 自动采集', 
				'url'	=> 'http://otcms.com/news/8062.html'
				),
			'buyRegCode'	=> array(
				'theme'	=> '插件组合：访客自助购买注册邀请码注册 = 财务基础包 + 充值支付_XX + 直接在线支付 + 卡密卡券', 
				'url'	=> 'http://otcms.com/news/8308.html'
				),
			'userGroupScore'	=> array(
				'theme'	=> '插件组合：会员自助开通/更换/续费会员组 = 财务基础包 + 充值支付_XX + 会员组积分开通', 
				'url'	=> 'http://otcms.com/news/8309.html'
				),
			'userState0'	=> array(
				'theme'	=> '插件组合：未审核会员自助转正 = 财务基础包 + 充值支付_XX + 会员积分转正', 
				'url'	=> 'http://otcms.com/news/8310.html'
				),
			'recom'	=> array(
				'theme'	=> '插件组合：微商式二级分销抽成 = 财务基础包 + 充值支付_XX + 邀请注册&分销', 
				'url'	=> 'http://otcms.com/news/8311.html'
				),
			'userGroupDown'	=> array(
				'theme'	=> '插件组合：会员自助购买月季年卡会员组并限制每日下载附件次数 = 财务基础包 + 充值支付_XX + 会员组积分开通 + 文章下载记录', 
				'url'	=> 'http://otcms.com/news/8312.html'
				)
			);
		if (isset($retArr[$str])){
			if ($mode == 'array'){
				return $retArr[$str];
			}else{
				return '<div class="appNews">'. $retArr[$str]['theme'] .' 详情：<a href="'. $retArr[$str]['url'] .'" target="_blank" class="url">'. $retArr[$str]['url'] .'</a></div>';
			}
		}else{
			return '<!-- GetNews['. $str .'] -->';
		}
	}

	// 是否存在支付方式
	public static function JudPayMode(){
		if (AppMoneyAlipay::Jud() || AppMoneyEpay::Jud() || AppMoneyF2fpay::Jud() || AppMoneyHpjpay::Jud() || AppMoneyWeixin::Jud()){	// AppMoneyCodepay
			global $moneySysArr;
			if (empty($moneySysArr)){ $moneySysArr = Cache::PhpFile('moneySys'); }

			if ($moneySysArr['MS_isAlipay'] == 1 || $moneySysArr['MS_isWeixin'] == 1 || $moneySysArr['MS_isCodepay'] == 1 || $moneySysArr['MS_isF2fpay'] == 1 || $moneySysArr['MS_isHpjpay'] == 1 || $moneySysArr['MS_isEpay'] == 1){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}


	// 发布时间增加分钟 API信息匹配为当前网站信息
	public static function AddTime($time,$min){
		if ($min == 999){
			return TimeDate::Get();
		}else{
			return TimeDate::Add('min', $min, $time);
		}
	}


	// 获取采集数据库对象
	public static function GetCollDB(){
		global $DB,$sysAdminArr,$collDbName;
		if (! isset($sysAdminArr['SA_collDB'])){ $sysAdminArr['SA_collDB'] = 0; }

		// 采集数据库连接方式
		if (OT_Database == 'mysql' || $sysAdminArr['SA_collDB'] == 1){
			$collDbPref = OT_dbPref;
			$collDB = $DB;

		}else{
			$collDbPref = 'OT_';
			$collDB = new PdoDb( array('type'=>'sqlite', 'dsn'=>'sqlite:'. OT_ROOT . $collDbName, 'user'=>'', 'pwd'=>'') );

		}

		if( ! defined('OT_collDbPref') ){
			define('OT_collDbPref',	$collDbPref);
		}

		return $collDB;
	}


	// 发送验证码表单
	public static function SendPhoneForm($mode='pc'){
		$type		= OT::GetStr('type');
		$btnId		= OT::GetStr('btnId');
		$phone		= OT::GetStr('phone');
		$username	= OT::GetStr('username');

		if ($mode == 'uc'){
			if (UcBase::JudMobile()){ $mode = 'wap'; }else{ $mode = 'pc'; }
		}
		echo('
		<div style="margin:0 auto;text-align:center;font-size:18px;font-weight:bold;padding-bottom:25px;">发送短信验证码</div>
		<form id="phoneForm" name="phoneForm" method="post" action="users_deal.php?mudi=phoneSend" onsubmit="return SendPhoneForm();">
		<input type="hidden" id="sendType" name="sendType" value="'. $type .'" />
		<input type="hidden" id="sendBtnId" name="sendBtnId" value="'. $btnId .'" />
		<input type="hidden" id="sendPhone" name="sendPhone" value="'. $phone .'" />
		<input type="hidden" id="sendUsername" name="sendUsername" value="'. $username .'" />
		');
		if ($mode == 'wap'){
			echo('
			<table cellpadding="3" class="padd3td" style="min-width:350px;">
			<tr><td align="right">手机号：</td><td>'. $phone .'</td></tr>
			<tr><td align="right">验证码：</td><td><div style="overflow-x:hidden;">'. Area::VerCodePop('phoneForm','','260px') .'</div></td></tr>
			<tr><td align="center" colspan="2"><input type="submit" value="确定发送" class="button1 active" /><input type="button" value="取消发送" onclick="HiddenMengceng();$id(\''. $btnId .'\').value = \'发送短信验证码\';" style="margin-left:35px;" class="button1" /></td></tr>
			</table>
			');
		}else{
			echo('
			<table cellpadding="3" >
			<tr><td align="right">手机号：</td><td>'. $phone .'</td></tr>
			<tr><td align="right">验证码：</td><td>'. Area::VerCodePop('phoneForm','','260px') .'</td></tr>
			<tr><td></td><td><input type="submit" value="确定发送" style="height:35px;font-size:14px;" /><input type="button" value="取消发送" onclick="HiddenMengceng();$id(\''. $btnId .'\').value = \'发送短信验证码\';" style="margin-left:35px;height:35px;font-size:14px;" /></td></tr>
			</table>
			');
		}
		echo('
		</form>
		');
	}


	// 跳转手机版
	public static function GoWapUrl(){
		$systemArr = Cache::PhpFile('system');

		$beforeURL	= GetUrl::CurrDir();
		$domain		= explode('/',$beforeURL);
		$domain		= $domain[2];
		$go			= OT::GetStr('go');
		$goUrl		= Str::Filter(OT::GetStr('goUrl'),'url');
			if ($go != 'wap'){ $go = 'pc'; }
			if (strlen($goUrl) >= 7){
				$tempUrl = str_replace(array('http://','https://'),'',$goUrl);
				if (stripos($tempUrl,$domain) !== 0 && stripos($tempUrl,str_replace(array('http://','https://'),'',$systemArr['SYS_wapUrl'])) !== 0){
					$goUrl = '';
				}
			}
			if (strlen($goUrl) < 7){
				die('
				<script language="javascript" type="text/javascript">
				document.location.href="./";
				</script>
				');
			}

		// 关闭透明化session id的功能
		if (ini_get('session.use_trans_sid') != 0){ ini_set('session.use_trans_sid',0); }

		@session_start();

		$_SESSION['wap_otcms'] = $go;
		setcookie('wap_otcms', $go);

		header('location:'. $goUrl);
	}


	// 微信JSSDK内容分享
	public static function GetWeixinJs(){
		$url = trim(@$_GET['url'] .'');
		if (AppWeixinJs::Jud()){
			echo(AppWeixinJs::ShareDeal($url));
		}else{
			echo(AppWeixin::JsSdkDeal($url));
		}
	}


	// 单页缓存文件默认数组
	public static function WebDefArr(){
		return array(
			'pointStr'	=> '',
			'theme'		=> '',
			'themeAddi' => '',
			'content'	=> '',
			'htmlFile'	=> '',
			'webKey'	=> '',
			'webDesc'	=> ''
			);
	}


	// 单页缓存文件附加信息
	public static function WebNameAddi($m){
		$addi = '';
		switch ($m){
			case 'form':
				$id = OT::GetInt('id');
				$addi = $id;
				break;

			case 'tags':
				$page = OT::GetInt('page');
					if ($page < 1){ $page = 1; }
				$addi = $page;
				break;
		
			case 'logoAdd':
			case 'userApiSuccess':
			case 'gift':
			case 'giftWrite':
			case 'pay':
			case 'payResult':
			case 'payRefer':
			case 'getGift':
			case 'getGiftDet':
				break;

			default :
				header('HTTP/1.0 404 Not Found');
				header('Status: 404 Not Found');

				die('404 Error：您要访问的页面找不到了，可能已被删除或者已更换了地址，有问题请联系管理员.');
				return '';
				break;
		}
		return $addi;
	}


	// 单页缓存文件数据  元素：theme、themeAddi、content
	public static function WebDataArr($m, $mode='pc'){
		$dataArr = AreaApp::WebDefArr();
		$dataArr['theme']	= '页面不存在';
		$dataArr['content']	= '页面不存在';
		switch ($m){
			case 'form':
				if (AppForm::Jud()){
					$dataArr = AppForm::WebDeal($mode);
				}
				break;

			case 'tags':
				if (AppTag::Jud()){
					$dataArr = AppTag::WebDeal($mode);
				}
				break;

			case 'logoAdd':
				if (AppLogoAdd::Jud()){
					$dataArr = AppLogoAdd::WebDeal($mode);
				}
				break;

			case 'userApiSuccess':
				if (AppLogin::Jud()){
					$dataArr = AppLogin::WebDeal($mode);
				}
				break;

			case 'gift':
				if (AppGift::Jud()){
					$dataArr = AppGift::WebDeal('list',$mode);
				}
				break;

			case 'giftWrite':
				if (AppGift::Jud()){
					$dataArr = AppGift::WebDeal('write', $mode);
				}
				break;

			case 'pay':
				if (AppMoneyPay::Jud()){
					$dataArr = AppMoneyPay::WebDeal('pay', $mode);
				}
				break;

			case 'payResult':
				if (AppMoneyPay::Jud()){
					$dataArr = AppMoneyPay::WebDeal('result', $mode);
				}
				break;

			case 'payRefer':
				if (AppMoneyPay::Jud()){
					$dataArr = AppMoneyPay::WebDeal('refer', $mode);
				}
				break;

			case 'getGift':
				if (AppGift::Jud()){
					$dataArr = AppGetGift::WebDeal('list',$mode);
				}
				break;

			case 'getGiftDet':
				if (AppGift::Jud()){
					$dataArr = AppGetGift::WebDeal('det', $mode);
				}
				break;

			default :
				break;
		}
		return $dataArr;
	}


	// 项目显示 插件是否购买内容不同
	public static function ItemShow($jud, $str, $addi='[未购买]'){
		if ($jud){
			return $str;
		}else{
			return '<span style="color:#ccc;">'. $str . $addi .'</span>';
		}
	}



	public static function ListIdArr($str){
		$strArr = array();
		if (strlen(''. $str) == 0){
			return $strArr;
		}else{
			$str = str_replace(array('][','[',']'), array(',','',''), $str);
			$strArr = explode(',', $str);

			return $strArr;
		}
	}


	public static function ListIdCN($str, $appArr){
		$strArr = self::ListIdArr($str);

		$retStr = '';
		foreach ($strArr as $val){
			if (isset($appArr[$val])){
				if (strlen($retStr) > 0){ $retStr .= '、'; }
				$retStr .= $appArr[$val];
			}
		}

		return $retStr;
	}


	// 多域名 手机版网址
	public static function WapUrl($level=0){
		global $systemArr;
		if (strlen($systemArr['SYS_wapUrl']) > 8){
			return $systemArr['SYS_wapUrl'];
		}else{
			return GetUrl::CurrDir($level) .'wap/';
		}
	}


	// 多域名 电脑版网址
	public static function PcUrl($level=0){
		global $systemArr;
		if (strlen($systemArr['SYS_URL']) > 8){
			return $systemArr['SYS_URL'];
		}else{
			return GetUrl::CurrDir($level);
		}
	}


	// 在线支付页面网页标题
	public static function PayWebTitle($webTitle='在线支付'){
		global $DB;
		$type	= OT::GetStr('type');
		$typeID = OT::GetInt('typeID');
		$quanArr = array('quan1','quan2','quan3','quan4','quan5');
		if (in_array($type,$quanArr)){
			// 卡密自动销售渠道
			$quanName = $DB->GetOne('select MS_quickQuanTheme'. str_replace('quan','',$type) .' from '. OT_dbPref .'moneySys');
			if (strlen(''. $quanName) > 0){
				$webTitle = $quanName .'_'. $webTitle;
			}else{
				JS::AlertCloseEnd('该渠道暂未开放，如有问题请联系管理员。');
			}

		}elseif ( in_array($type, array('infoRead','dashang')) ){
			// 文章
			if ($type == 'dashang'){
				// 文章打赏
				$typeCN = '文章打赏';
			}else{
				// 文章付费阅读
				$typeCN = '文章阅读';
			}
			if ($typeID <= 0){
				JS::AlertCloseEnd('该文章ID不存在，如有问题请联系管理员。');
			}
			$readRow = $DB->GetRow('select IF_theme from '. OT_dbPref .'info where IF_ID='. $typeID);
			if ($readRow){
				$webTitle = $readRow['IF_theme'] .'_'. $typeCN .'_'. $webTitle;
			}else{
				JS::AlertCloseEnd('该文章不存在，如有问题请联系管理员。');
			}

		}elseif ( in_array($type, array('groupKaitong','groupXufei')) ){
			// 会员组
			if ($type == 'groupXufei'){
				// 会员组续费
				$typeCN = '会员组续费';
			}else{
				// 会员组开通
				$typeCN = '会员组开通';
			}
			if ($typeID <= 0){
				JS::AlertBackEnd('该会员组ID不存在，如有问题请联系管理员。');
			}
			$readRow = $DB->GetRow('select UG_theme from '. OT_dbPref .'userGroup where UG_ID='. $typeID);
			if ($readRow){
				$webTitle = $readRow['UG_theme'] .'_'. $typeCN .'_'. $webTitle;
			}else{
				JS::AlertBackEnd('该会员组不存在，如有问题请联系管理员。');
			}

		}elseif ($type == 'authSoft'){
			// 授权软件
			$typeCN = '授权软件';
			if ($typeID <= 0){
				JS::AlertBackEnd('该授权软件ID不存在，如有问题请联系管理员。');
			}
			$readRow = $DB->GetRow('select AU_softName from '. OT_dbPref .'authUsers where AU_ID='. $typeID);
			if ($readRow){
				$webTitle = $readRow['AU_softName'] .'_'. $typeCN .'_'. $webTitle;
			}else{
				JS::AlertBackEnd('该授权软件不存在，如有问题请联系管理员。');
			}

		}else{
			$typeArr = PayInfo::QuickTypeArr('key');
				if (in_array($type,$typeArr)){
					$quickTypeArr = PayInfo::QuickTypeArr();
					$webTitle = $quickTypeArr[$type] .'_'. $webTitle;
				}
		}
		return $webTitle;
	}

}

?>