<?php
require('../../../Interface/Common/Component/ComInitialHead.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/gsnavigationactive.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/gsnavigationactivecont.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/gsnavigationunit.php');
require($netsFileConfig['sysCoreRoot'].'Cache/DbDescription/gsnavigationunitcont.php');
require($netsFileConfig['sysCoreRoot'].'Inc/netsFunc/Func/netsXml.php');
require($netsFileConfig['sysCoreRoot'].'Inc/m_Gsnavigation/Gsnavigation/gsnavigationunit.php');
require($netsFileConfig['sysCoreRoot'].'Inc/m_Gsnavigation/Gsnavigation/gsnavigationactive.php');


class PaDefault extends CustomPage {
	public $ssetParid=1;
	
	public function PaDefault(){
		$this->CustomPage();
	}
	public function OnPInitial(){
		$this->sTable=array(
			array('sttTableName'=>$this->sysTableHead.'groupsale','sttColumnHead'=>'gst'),
			array('sttTableName'=>$this->sysTableHead.'groupsalecont','sttColumnHead'=>'gsct'),);
		
		
	}
	public function OnBInitial(){
		//-- ------ #ActionType ------ --
		if($this->sActionType=='DGet'){
			$this->OnGet();
		}else if($this->sActionType=='DGet_Xml'){
			$this->OnGet_Xml();
		}else if($this->sActionType=='DGet_Unit'){
			$this->OnGet_Unit();
		}else if($this->sActionType=='DClear_Active'){
			$this->DClear_Active();
		}else if($this->sActionType=='DAdd_Interface'){
			$this->DAdd_Interface();
		}
	}
	public function OnList(){
		
		return 0;
	}
	public function OnGet(){
		$tmpAR0=$this->AnalyerRequest('DGet',0,0);
		
		$tmpSQL=' SELECT *
			FROM {Nets.TableHead}groupsale AS A
			INNER JOIN {Nets.TableHead}groupsalecont AS B ON B.gsctIndexID=A.gstID
			WHERE 1=1 AND A.gstRecycle=0 AND A.gstChecked>1 ';
		if ($tmpAR0[0]==1) {
		}else {
			$tmpSQL.=' AND A.gstState='.$tmpAR0[0].' ';
		}
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$this->sData_Active=$this->sDb->Search($tmpSTR);
		
		return 0;
	}
	public function OnGet_Xml(){
		$tmpAR0=$this->AnalyerRequest('DGet',0,0);
		$tmpCONTENT=$this->readURL($this->sysPage.'?ActionType=DGet');
		$tmpPATH=$this->sysFileConfig['PathRoot'].'Html/Xml/Groupsale/Groupsale_Data.xml';
		if ($tmpAR0[0]==1) {
			$tmpCONTENT=$this->readURL($this->sysPage.'?ActionType=DGet&DGet=1');
			$tmpPATH=$this->sysFileConfig['PathRoot'].'Html/Xml/Groupsale/Groupsale_Data_All.xml';
		}
		$tmpINT=$this->writeFile($tmpPATH,$tmpCONTENT);
		
		return 0;
	}
	public function OnGet_Unit(){
		$tmpAR_Check=$this->AnalyerRequest('DCheckUser_Test',',,,',0);
		$tmpAR0=$this->AnalyerRequest('DGet_Unit',',-1',0);
		//-- ------ ### ------ --
		$tmpApp=new netsuserinfo($this->sConnString);
		$tmpINT=$tmpApp->Check_Interface($tmpAR_Check);
		if($tmpINT!=0){
			$this->makeError('NoPower_User',$tmpApp->sysLastError);
			return 1;
		}
		//-- ------ ### ------ --
		$tmpSQL=' SELECT A.gsnutID,A.gsnutName,A.gsnutType,A.gsnutURL,B.gsnuctURL_Type,B.gsnuctURL_XML
			FROM {Nets.TableHead}gsnavigationunit AS A
			INNER JOIN {Nets.TableHead}gsnavigationunitcont AS B ON B.gsnuctIndexID=A.gsnutID
			WHERE 1=1 AND A.gsnutRecycle=0 AND A.gsnutChecked>1 ';
		$tmpSTR=str_replace('{Nets.TableHead}',$this->sysTableHead,$tmpSQL);
		$tmpData0=$this->sDb->Search($tmpSTR);
		
		
		$this->makeData($tmpData0,array());
		return 0;
	}
	public function DClear_Active(){
		$tmpAR_Check=$this->AnalyerRequest('DCheckUser_Test',',,,',0);
		//ID,State,7Day,ALL
		$tmpAR0=$this->AnalyerRequest('DClear_Active','0,0,0,0',0);
		//-- ------ ### ------ --
		$tmpApp=new netsuserinfo($this->sConnString);
		$tmpINT=$tmpApp->Check_Interface($tmpAR_Check);
		if($tmpINT!=0){
			$this->makeError('NoPower_User',$tmpApp->sysLastError);
			return 1;
		}
		//-- ------ ### ------ --
		$tmpApp=new gsnavigationunit($this->sConnString);
		$tmpINT=$tmpApp->collection_ClearOld($tmpAR0[0],$tmpAR0[1],$tmpAR0[2],$tmpAR0[3]);
		
		
		$this->makeError('SUCCUSS','清除成功');
		return 0;
	}
	public function DAdd_Interface(){
		$tmpAR_Check=$this->AnalyerRequest('DCheckUser_Test',',,,',0);
		//-- ------ ### ------ --
		$tmpApp=new netsuserinfo($this->sConnString);
		$tmpINT=$tmpApp->Check_Interface($tmpAR_Check);
		if($tmpINT!=0){
			$this->makeError('NoPower_User',$tmpApp->sysLastError);
			return 1;
		}
		//-- ------ #SAVE ------ --
		$tmpApp=new gsnavigationunit($this->sConnString);
		$tmpDbDescriptions=array(
			$this->sDbDescriptions[$this->sysTableHead.'gsnavigationactive'],
			$this->sDbDescriptions[$this->sysTableHead.'gsnavigationactivecont'],
			);
		//-- #VALUE --
		//-- #gsnatName --
		$tmpAR0=$this->AnalyerRequest('gsnatName','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatName']['Value']=$tmpAR0[0];
		//-- #gsnatNumCode --
		$tmpAR0=$this->AnalyerRequest('gsnatNumCode','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatNumCode']['Value']=$tmpAR0[0];
		//-- #gsnatParid --
		$tmpAR0=$this->AnalyerRequest('gsnatParid','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatParid']['Value']=$tmpAR0[0];
		//-- #pParName --
		$tmpAR0=$this->AnalyerRequest('gsnatParName','',1);
		$pParName=$tmpAR0[0];
		
		//-- #gsnatState --
		$tmpAR0=$this->AnalyerRequest('gsnatState','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatState']['Value']=$tmpAR0[0];
		//-- #pStateName --
		$tmpAR0=$this->AnalyerRequest('gsnatStateName','',1);
		$pStateName=$tmpAR0[0];
		
		//-- #gsnatCreateTime --
		$tmpAR0=$this->AnalyerRequest('gsnatCreateTime','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatCreateTime']['Value']=$tmpAR0[0];
		//-- #gsnatURL --
		$tmpAR0=$this->AnalyerRequest('gsnatURL','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatURL']['Value']=$tmpAR0[0];
		//-- #gsnatZoneid --
		$tmpAR0=$this->AnalyerRequest('gsnatZoneid','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatZoneid']['Value']=$tmpAR0[0];
		//-- #pZoneName --
		$tmpAR0=$this->AnalyerRequest('gsnatZoneName','',1);
		$pZoneName=$tmpAR0[0];
		
		//-- #gsnatShoppingid --
		$tmpAR0=$this->AnalyerRequest('gsnatShoppingid','',1);
		$tmpDbDescriptions[0]['Columns']['gsnatShoppingid']['Value']=$tmpAR0[0];
		//-- #pShoppingName --
		$tmpAR0=$this->AnalyerRequest('gsnatShoppingName','',1);
		$pShoppingName=$tmpAR0[0];
		
		//-- #gsnactZones --
		$tmpAR0=$this->AnalyerRequest('gsnactZones','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactZones']['Value']=$tmpAR0[0];
		//-- #gsnactShoppings --
		$tmpAR0=$this->AnalyerRequest('gsnactShoppings','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactShoppings']['Value']=$tmpAR0[0];
		//-- #gsnactBrands --
		$tmpAR0=$this->AnalyerRequest('gsnactBrands','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactBrands']['Value']=$tmpAR0[0];
		//-- #gsnactRealshops --
		$tmpAR0=$this->AnalyerRequest('gsnactRealshops','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactRealshops']['Value']=$tmpAR0[0];
		//-- #gsnactUnits --
		$tmpAR0=$this->AnalyerRequest('gsnactUnits','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactUnits']['Value']=$tmpAR0[0];
		//-- #gsnactInfo_Numcode --
		$tmpAR0=$this->AnalyerRequest('gsnactInfo_Numcode','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactInfo_Numcode']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_StartTime --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_StartTime','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_StartTime']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_EndTime --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_EndTime','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_EndTime']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_Origin --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_Origin','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_Origin']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_Now --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_Now','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_Now']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_Sale --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_Sale','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_Sale']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_Save --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_Save','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_Save']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_LimitPeople --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_LimitPeople','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_LimitPeople']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_LimitOnes --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_LimitOnes','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_LimitOnes']['Value']=$tmpAR0[0];
		//-- #gsnactPrice_TotalCount --
		$tmpAR0=$this->AnalyerRequest('gsnactPrice_TotalCount','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPrice_TotalCount']['Value']=$tmpAR0[0];
		//-- #gsnactCount_Order --
		$tmpAR0=$this->AnalyerRequest('gsnactCount_Order','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactCount_Order']['Value']=$tmpAR0[0];
		//-- #gsnactSpeak --
		$tmpAR0=$this->AnalyerRequest('gsnactSpeak','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactSpeak']['Value']=$tmpAR0[0];
		//-- #gsnactCom_Logo --
		$tmpAR0=$this->AnalyerRequest('gsnactCom_Logo','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactCom_Logo']['Value']=$tmpAR0[0];
		//-- #gsnactCom_Introduct --
		$tmpAR0=$this->AnalyerRequest('gsnactCom_Introduct','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactCom_Introduct']['Value']=$tmpAR0[0];
		//-- #gsnactMapIntroduct --
		$tmpAR0=$this->AnalyerRequest('gsnactMapIntroduct','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactMapIntroduct']['Value']=$tmpAR0[0];
		//-- #gsnactMapX --
		$tmpAR0=$this->AnalyerRequest('gsnactMapX','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactMapX']['Value']=$tmpAR0[0];
		//-- #gsnactMapY --
		$tmpAR0=$this->AnalyerRequest('gsnactMapY','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactMapY']['Value']=$tmpAR0[0];
		//-- #gsnactSourceR00 --
		$tmpAR0=$this->AnalyerRequest('gsnactSourceR00','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactSourceR00']['Value']=$tmpAR0[0];
		//-- #gsnactContent --
		$tmpAR0=$this->AnalyerRequest('gsnactContent','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactContent']['Value']=$tmpAR0[0];
		//-- #gsnactPublisher_Address --
		$tmpAR0=$this->AnalyerRequest('gsnactPublisher_Address','',1);
		$tmpDbDescriptions[1]['Columns']['gsnactPublisher_Address']['Value']=$tmpAR0[0];

		//-- #Save --
		$tmpINT=$tmpApp->collection_Add($tmpDbDescriptions,$pParName,$pStateName,$pZoneName,$pShoppingName);
		if ($tmpINT!=0) {
			$this->makeError('ERROR',$tmpApp->sysLastError);
			return 1;
		}
		

		$this->makeError('SUCCUSS','保存成功');
		return 0;
	}
	
	
}
//-- ------ #Instanct ------ --
$tmpDefault=new PaDefault();
$tmpDefault->OnPage();
$tmpDefault->sysMetaTitle=$tmpDefault->sMetaTitle.' - '.$tmpDefault->sysFileConfig['sysTitle'];
//-- ------ #Template ------ --
if ($tmpDefault->sActionType=='DGet') {
	require($tmpDefault->sysFileConfig['sysCoreRoot_Real'].$tmpDefault->sysInterfaceTemplatePath.'Component/Head_Xml.php');
	require($tmpDefault->sysFileConfig['sysCoreRoot_Real'].$tmpDefault->sysInterfaceTemplatePath.'Groupsale/Groupsale_Sitedata_Hao123.php');
	require($tmpDefault->sysFileConfig['sysCoreRoot_Real'].$tmpDefault->sysInterfaceTemplatePath.'Component/End_Xml.php');
}else {
	require($tmpDefault->sysFileConfig['sysCoreRoot_Real'].$tmpDefault->sysInterfaceTemplatePath.'Component/Group_Xml_0.php');
} ?>