<?php
/**
  * @class 基类
  * @author soul
  */
class baseAction
{
	public $tokenInfo = null;

	public function __construct()
	{
		$this->tokenInfo = [
			'shopid'=>mvc::$cfg['SHOPID'],
			'uid'=>$_SESSION['_userid'],
			'from'=>'PJDGZH',
			'ip'=>LibFc::GetClientIp(),
			'devcode'=>session_id(),
			'port'=>$_SERVER['REMOTE_PORT']
		];
		$apiFun = mvc::$URL_CLASS.'/'.mvc::$URL_METHOD;
		$OthMonitor = new OthMonitor();
		$OthMonitor->checkPjDMainPass($apiFun, $this->tokenInfo);
	}

	//析构函数
	public function __destruct()
	{
		$OthMonitor = new OthMonitor();
		$OthMonitor->collMainTongji($this->tokenInfo);
	}


	/**
	 * @method    PHP调取跑街令电脑版API
	 * @param fun       string [必填]  方法
	 * @author    soul
	 * @copyright 2018-08-31
	 * @return  
			{status:true,data:true}
			{status:false,data:错误信息}
	 */
	public function pjlApi()
	{
		$getArr = $_GET;
		$getArr['shopid'] = mvc::$cfg['SHOPID'];
		unset($getArr['fun']);
		$LibPjlApi = new LibPjlApi();
		$res = $LibPjlApi->Get($_GET['fun'], $getArr, $_POST);
		LibFc::ajaxJsonEncode($res);
	}

	//对URI解密
	protected function decodeUri($str)
	{
		$str = base64_decode($str);
		$LibEncry = new LibEncry();
		$uri = $LibEncry->decode($str);
		parse_str($uri, $uriArr);
		return $uriArr;
	}
	
	//对URI加密
	protected function encodeUri($str)
	{
		$LibEncry = new LibEncry();
		return base64_encode($LibEncry->encode($str));
	}
}