<?php
/*
*@Soul
*/
class pjlsAction
{
	
	/*
	*跑街令简介
	*/
	function index()
	{
		$Params = mvc::$URL_PARAMS;
		$uid = 0;
		if(!empty($Params['u']))
		{
			$LibEncry=new LibEncry();
			$uid = $LibEncry->decode(base64_decode($Params['u']));
		}
		$urlArr = [
			'ios'=>'https://itunes.apple.com/cn/app/id1449332865',
			'android'=>'http://a.app.qq.com/o/simple.jsp?pkgname=com.yiparts.pjl',
			'other'=>'https://sj.qq.com/myapp/detail.htm?apkName=com.yiparts.pjl',
		];
		$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
		$sys = 'other';
		if(stripos($agent, 'iPhone') || stripos($agent, 'iPad')){
			$sys = 'ios';
		}else if(stripos($agent, 'Android')){
			$sys = 'android';
		}
		$url = $urlArr[$sys];
		$dataArr=[
			'sh_from_u_id'=> (int) $uid,
			'sh_atime'=>time(),
			'sh_from'=>empty($Params['f'])? 'other': $Params['f'],
			'sh_sys'=>$sys,
			'sh_is_upload'=>1,
			'sh_ip'=>LibFc::GetClientIp(),
			'sh_agent'=>$_SERVER['HTTP_USER_AGENT']
		];
		$YpwBase = new YpwBase();
		$YpwBase->add('pjl_share',$dataArr);
		header("Location: ".$url);
	}
}