Commit 9bdd7e85 authored by hujun's avatar hujun

个推包

parent bf42e038
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-4-9
* Time: 下午3:45
*/
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__) . '/' . 'IGt.Push.php');
class IGtBatch
{
var $batchId;
var $innerMsgList = array();
var $seqId = 0;
var $APPKEY;
var $push;
var $lastPostData;
public function __construct($appkey, $push)
{
$this->APPKEY = $appkey;
$this->push = $push;
$this->batchId = uniqid();
}
public function getBatchId()
{
return $this->batchId;
}
public function add($message, $target)
{
if ($this->seqId >= 5000) {
throw new Exception("Can not add over 5000 message once! Please call submit() first.");
} else {
$this->seqId += 1;
$innerMsg = new SingleBatchItem();
$innerMsg->set_seqId($this->seqId);
$innerMsg->set_data($this->createSingleJson($message, $target));
array_push($this->innerMsgList, $innerMsg);
}
return $this->seqId . "";
}
public function createSingleJson($message, $target)
{
$params = $this->push->getSingleMessagePostData($message,$target);
return json_encode($params);
}
public function submit()
{
$requestId = uniqid();
$data = array();
$data["appkey"]=$this->APPKEY;
$data["serialize"] = "pb";
$data["async"] = GTConfig::isPushSingleBatchAsync();
$data["action"] = "pushMessageToSingleBatchAction";
$data['requestId'] = $requestId;
$singleBatchRequest = new SingleBatchRequest();
$singleBatchRequest->set_batchId($this->batchId);
foreach ($this->innerMsgList as $index => $innerMsg) {
$singleBatchRequest->add_batchItem();
$singleBatchRequest->set_batchItem($index, $innerMsg);
}
$data["singleDatas"] = base64_encode($singleBatchRequest->SerializeToString());
$this->seqId = 0;
$this->innerMsgList = array();
$this->lastPostData = $data;
$result = $this->push->httpPostJSON(null, $data, true);
return $result;
}
public function retry()
{
$result = $this->push->httpPostJSON(null, $this->lastPostData, true);
return $result;
}
public function setApiUrl($apiUrl) {
}
}
\ No newline at end of file
<?php
/**
* VERSION 3.3.2.1
*/
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__) . '/' . 'protobuf/pb_message.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.Req.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.Message.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.AppMessage.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.ListMessage.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.SingleMessage.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.Target.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.BaseTemplate.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.LinkTemplate.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.NotificationTemplate.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.TransmissionTemplate.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.NotyPopLoadTemplate.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.APNTemplate.php');
require_once(dirname(__FILE__) . '/' . 'igetui/utils/GTConfig.php');
require_once(dirname(__FILE__) . '/' . 'igetui/utils/HttpManager.php');
require_once(dirname(__FILE__) . '/' . 'igetui/utils/ApiUrlRespectUtils.php');
require_once(dirname(__FILE__) . '/' . 'igetui/utils/LangUtils.php');
Class IGeTui
{
var $appkey; //第三方 标识
var $masterSecret; //第三方 密钥
var $format = "json"; //默认为 json 格式
var $host = '';
var $needDetails = false;
static $appkeyUrlList = array();
var $domainUrlList = array();
var $useSSL = NULL; //是否使用https连接 以该标志为准
public function __construct($domainUrl, $appkey, $masterSecret, $ssl = NULL)
{
$this->appkey = $appkey;
$this->masterSecret = $masterSecret;
$domainUrl = trim($domainUrl);
if ($ssl == NULL && $domainUrl != NULL && strpos(strtolower($domainUrl), "https:") === 0)
{
$ssl = true;
}
$this->useSSL = ($ssl == NULL ? false : $ssl);
if ($domainUrl == NULL || strlen($domainUrl) == 0)
{
$this->domainUrlList = GTConfig::getDefaultDomainUrl($this->useSSL);
}
else
{
$this->domainUrlList = array($domainUrl);
}
$this->initOSDomain(null);
}
private function initOSDomain($hosts)
{
if($hosts == null || count($hosts) == 0)
{
$hosts = isset(IGeTui::$appkeyUrlList[$this->appkey])?IGeTui::$appkeyUrlList[$this->appkey]:null;
if($hosts == null || count($hosts) == 0)
{
$hosts = $this->getOSPushDomainUrlList($this->domainUrlList,$this->appkey);
IGeTui::$appkeyUrlList[$this->appkey] = $hosts;
}
}
else
{
IGeTui::$appkeyUrlList[$this->appkey] = $hosts;
}
$this->host = ApiUrlRespectUtils::getFastest($this->appkey, $hosts);
return $this->host;
}
public function getOSPushDomainUrlList($domainUrlList,$appkey)
{
$urlList = null;
$postData = array();
$postData['action']='getOSPushDomailUrlListAction';
$postData['appkey'] = $appkey;
$ex = null;
foreach($domainUrlList as $durl)
{
try
{
$response = $this->httpPostJSON($durl,$postData);
$urlList = isset($response["osList"])?$response["osList"]:null;
if($urlList != null && count($urlList) > 0)
{
break;
}
}
catch (Exception $e)
{
$ex = $e;
}
}
if($urlList == null || count($urlList) <= 0)
{
$h = implode(',', $domainUrlList);
throw new Exception("Can not get hosts from ".$h."|error:".$ex);
}
return $urlList;
}
function httpPostJSON($url,$data,$gzip=false)
{
if($url == null){
$url = $this->host;
}
$rep = HttpManager::httpPostJson($url, $data, $gzip);
if($rep != null)
{
if ( 'sign_error' == $rep['result']) {
try
{
if ($this->connect())
{
$rep = HttpManager::httpPostJson($url, $data, $gzip);
}
}
catch (Exception $e)
{
throw new Exception("连接异常".$e);
}
}
else if('domain_error' == $rep['result'])
{
$this->initOSDomain(isset($rep["osList"])?$rep["osList"]:null);
$rep = HttpManager::httpPostJson($url, $data, $gzip);
}
}
return $rep;
}
public function connect()
{
$timeStamp = $this->micro_time();
// 计算sign值
$sign = md5($this->appkey . $timeStamp . $this->masterSecret);
//
$params = array();
$params["action"] = "connect";
$params["appkey"] = $this->appkey;
$params["timeStamp"] = $timeStamp;
$params["sign"] = $sign;
$rep = HttpManager::httpPostJson($this->host,$params,false);
if ('success' == $rep['result']) {
return true;
}
throw new Exception("appKey Or masterSecret is Auth Failed");
}
public function close()
{
$params = array();
$params["action"] = "close";
$params["appkey"] = $this->appKey;
HttpManager::httpPostJson($this->host,$params,false);
}
/**
* 指定用户推送消息
* @param IGtMessage message
* @param IGtTarget target
* @return Array {result:successed_offline,taskId:xxx} || {result:successed_online,taskId:xxx} || {result:error}
***/
public function pushMessageToSingle($message, $target, $requestId = null)
{
if($requestId == null || trim($requestId) == "")
{
$requestId = uniqid();
}
$params = $this->getSingleMessagePostData($message, $target, $requestId);
return $this->httpPostJSON($this->host,$params);
}
function getSingleMessagePostData($message, $target, $requestId = null){
$params = array();
$params["action"] = "pushMessageToSingleAction";
$params["appkey"] = $this -> appkey;
if($requestId != null)
{
$params["requestId"] = $requestId;
}
$params["clientData"] = base64_encode($message->get_data()->get_transparent());
$params["transmissionContent"] = $message->get_data()->get_transmissionContent();
$params["isOffline"] = $message->get_isOffline();
$params["offlineExpireTime"] = $message->get_offlineExpireTime();
// 增加pushNetWorkType参数(0:不限;1:wifi;2:4G/3G/2G)
$params["pushNetWorkType"] = $message->get_pushNetWorkType();
//
$params["appId"] = $target->get_appId();
$params["clientId"] = $target->get_clientId();
$params["alias"] = $target->get_alias();
// 默认都为消息
$params["type"] = 2;
$params["pushType"] = $message->get_data()->get_pushType();
return $params;
}
public function getContentId($message,$taskGroupName = null)
{
return $this->getListAppContentId($message,$taskGroupName);
}
/**
* 取消消息
* @param String contentId
* @return boolean
***/
public function cancelContentId($contentId)
{
$params = array();
$params["action"] = "cancleContentIdAction";
$params["appkey"] = $this->appKey;
$params["contentId"] = $contentId;
$rep = $this->httpPostJSON($this->host,$params);
return $rep['result'] == 'ok' ? true : false;
}
/**
* 批量推送信息
* @param String contentId
* @param Array <IGtTarget> targetList
* @return Array {result:successed_offline,taskId:xxx} || {result:successed_online,taskId:xxx} || {result:error}
***/
public function pushMessageToList($contentId, $targetList)
{
$params = array();
$params["action"] = "pushMessageToListAction";
$params["appkey"] = $this-> appkey;
$params["contentId"] = $contentId;
$needDetails = GTConfig::isPushListNeedDetails();
$params["needDetails"] = $needDetails;
$async = GTConfig::isPushListAsync();
$params["async"] = $async;
if($async && (!$needDetails))
{
$limit = GTConfig::getAsyncListLimit();
}
else
{
$limit = GTConfig::getSyncListLimit();
}
if(count($targetList) > $limit)
{
throw new Exception("target size:".count($targetList)." beyond the limit:".$limit);
}
$clientIdList = array();
$aliasList= array();
$appId = null;
foreach($targetList as $target)
{
$targetCid = $target->get_clientId();
$targetAlias = $target->get_alias();
if($targetCid != null)
{
array_push($clientIdList,$targetCid);
}elseif($targetAlias != null)
{
array_push($aliasList,$targetAlias);
}
if($appId == null)
{
$appId = $target->get_appId();
}
}
$params["appId"] = $appId;
$params["clientIdList"] = $clientIdList;
$params["aliasList"] = $aliasList;
$params["type"] = 2;
return $this->httpPostJSON($this->host,$params,true);
}
public function stop($contentId)
{
$params = array();
$params["action"] = "stopTaskAction";
$params["appkey"] = $this->appkey;
$params["contentId"] = $contentId;
$rep = $this->httpPostJSON($this->host, $params);
if ("ok" == $rep["result"]) {
return true;
}
return false;
}
public function getClientIdStatus($appId, $clientId)
{
$params = array();
$params["action"] = "getClientIdStatusAction";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["clientId"] = $clientId;
return $this->httpPostJSON($this->host, $params);
}
public function setClientTag($appId, $clientId, $tags)
{
$params = array();
$params["action"] = "setTagAction";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["clientId"] = $clientId;
$params["tagList"] = $tags;
return $this->httpPostJSON($this->host, $params);
}
public function pushMessageToApp($message, $taskGroupName = null)
{
$contentId = $this->getListAppContentId($message, $taskGroupName);
$params = array();
$params["action"] = "pushMessageToAppAction";
$params["appkey"] = $this->appkey;
$params["contentId"] = $contentId;
$params["type"] = 2;
return $this->httpPostJSON($this->host,$params);
}
private function getListAppContentId($message, $taskGroupName = null)
{
$params = array();
if (!is_null($taskGroupName) && trim($taskGroupName) != ""){
if(strlen($taskGroupName) > 40){
throw new Exception("TaskGroupName is OverLimit 40");
}
$params["taskGroupName"] = $taskGroupName;
}
$params["action"] = "getContentIdAction";
$params["appkey"] = $this->appkey;
$params["clientData"] = base64_encode($message->get_data()->get_transparent());
$params["transmissionContent"] = $message->get_data()->get_transmissionContent();
$params["isOffline"] = $message->get_isOffline();
$params["offlineExpireTime"] = $message->get_offlineExpireTime();
// 增加pushNetWorkType参数(0:不限;1:wifi;2:4G/3G/2G)
$params["pushNetWorkType"] = $message->get_pushNetWorkType();
$params["pushType"] = $message->get_data()->get_pushType();
$params["type"] = 2;
//contentType 1是appMessage,2是listMessage
if ($message instanceof IGtListMessage){
$params["contentType"] = 1;
} else {
$params["contentType"] = 2;
$params["appIdList"] = $message->get_appIdList();
$params["speed"] = $message->get_speed();
//$params["personaTags"]
$personaTags = array();
if($message->get_conditions() == null) {
$params["phoneTypeList"] = $message->get_phoneTypeList();
$params["provinceList"] = $message->get_provinceList();
$params["tagList"] = $message->get_tagList();
} else {
$conditions = $message->get_conditions();
$params["conditions"] = $conditions->getCondition();
}
}
$rep = $this->httpPostJSON($this->host,$params);
if($rep['result'] == 'ok')
{
return $rep['contentId'];
}else{
throw new Exception("host:[".$this->host."]" + "获取contentId失败:".$rep);
}
}
public function getBatch()
{
return new IGtBatch($this->appkey,$this);
}
public function pushAPNMessageToSingle($appId, $deviceToken, $message)
{
$params = array();
$params['action'] = 'apnPushToSingleAction';
$params['appId'] = $appId;
$params['appkey'] = $this->appkey;
$params['DT'] = $deviceToken;
$params['PI'] = base64_encode($message->get_data()->get_pushInfo()->SerializeToString());
return $this->httpPostJSON($this->host,$params);
}
/**
* 根据deviceTokenList群推
* @param $appId
* @param $contentId
* @param $deviceTokenList
* @return mixed
*/
public function pushAPNMessageToList($appId, $contentId, $deviceTokenList)
{
$params = array();
$params["action"] = "apnPushToListAction";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["contentId"] = $contentId;
$params["DTL"] = $deviceTokenList;
$needDetails = GTConfig::isPushListNeedDetails();
$params["needDetails"]=$needDetails;
return $this->httpPostJSON($this->host,$params);
}
/**
* 获取apn contentId
* @param $appId
* @param $message
* @return string
*/
public function getAPNContentId($appId, $message)
{
$params = array();
$params["action"] = "apnGetContentIdAction";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["PI"] = base64_encode($message->get_data()->get_pushInfo()->SerializeToString());
$rep = $this->httpPostJSON($this->host,$params);
if($rep['result'] == 'ok'){
return $rep['contentId'];
}else{
throw new Exception("host:[".$this->host."]" + "获取contentId失败:".$rep);
}
}
public function bindAlias($appId, $alias, $clientId)
{
$params = array();
$params["action"] = "alias_bind";
$params["appkey"] = $this->appkey;
$params["appid"] = $appId;
$params["alias"] = $alias;;
$params["cid"] = $clientId;
return $this->httpPostJSON($this->host,$params);
}
public function bindAliasBatch($appId, $targetList)
{
$params = array();
$aliasList = array();
foreach($targetList as $target) {
$user = array();
$user["cid"] = $target->get_clientId();
$user["alias"] = $target->get_alias();
array_push($aliasList, $user);
}
$params["action"] = "alias_bind_list";
$params["appkey"] = $this->appkey;
$params["appid"] = $appId;
$params["aliaslist"] = $aliasList;
return $this->httpPostJSON($this->host,$params);
}
public function queryClientId($appId, $alias)
{
$params = array();
$params["action"] = "alias_query";
$params["appkey"] = $this->appkey;
$params["appid"] = $appId;
$params["alias"] = $alias;;
return $this->httpPostJSON($this->host, $params);
}
public function queryAlias($appId, $clientId)
{
$params = array();
$params["action"] = "alias_query";
$params["appkey"] = $this->appkey;
$params["appid"] = $appId;
$params["cid"] = $clientId;
return $this->httpPostJSON($this->host, $params);
}
public function unBindAlias($appId, $alias, $clientId=null)
{
$params = array();
$params["action"] = "alias_unbind";
$params["appkey"] = $this->appkey;
$params["appid"] = $appId;
$params["alias"] = $alias;
if (!is_null($clientId) && trim($clientId) != "")
{
$params["cid"] = $clientId;
}
return $this->httpPostJSON($this->host, $params);
}
public function unBindAliasAll($appId, $alias)
{
return $this->unBindAlias($appId, $alias);
}
public function getPushResult( $taskId) {
$params = array();
$params["action"] = "getPushMsgResult";
$params["appkey"] = $this->appkey;
$params["taskId"] = $taskId;
return $this->httpPostJson($this->host, $params);
}
public function getPushResultByTaskidList( $taskIdList) {
return $this->getPushActionResultByTaskids($taskIdList, null);
}
public function getPushActionResultByTaskids( $taskIdList, $actionIdList) {
$params = array();
$params["action"] = "getPushMsgResultByTaskidList";
$params["appkey"] = $this->appkey;
$params["taskIdList"] = $taskIdList;
$params["actionIdList"] = $actionIdList;
return $this->httpPostJson($this->host, $params);
}
public function getUserTags($appId, $clientId) {
$params = array();
$params["action"] = "getUserTags";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["clientId"] = $clientId;
return $this->httpPostJson($this->host, $params);
}
public function getUserCountByTags($appId, $tagList) {
$params = array();
$params["action"] = "getUserCountByTags";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["tagList"] = $tagList;
$limit = GTConfig::getTagListLimit();
if(count($tagList) > $limit) {
throw new Exception("tagList size:".count($tagList)." beyond the limit:".$limit);
}
return $this->httpPostJSON($this->host, $params);
}
public function getPersonaTags($appId) {
$params = array();
$params["action"] = "getPersonaTags";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
return $this->httpPostJSON($this->host, $params);
}
public function queryAppPushDataByDate($appId, $date){
if(!LangUtils::validateDate($date)){
throw new Exception("DateError|".$date);
}
$params = array();
$params["action"] = "queryAppPushData";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["date"] = $date;
return $this->httpPostJson($this->host, $params);
}
public function queryAppUserDataByDate($appId, $date){
if(!LangUtils::validateDate($date)){
throw new Exception("DateError|".$date);
}
$params = array();
$params["action"] = "queryAppUserData";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
$params["date"] = $date;
return $this->httpPostJson($this->host, $params);
}
public function queryUserCount($appId, $appConditions) {
$params = array();
$params["action"] = "queryUserCount";
$params["appkey"] = $this->appkey;
$params["appId"] = $appId;
if(!is_null($appConditions)) {
$params["conditions"] = $appConditions->condition;
}
return $this->httpPostJson($this->host, $params);
}
public function pushTagMessage($message, $requestId = null) {
if(!$message instanceof IGtTagMessage) {
return $this->get_result("MsgTypeError");
}
if($requestId == null || trim($requestId) == "") {
$requestId = uniqid();
}
$params = array();
$params["action"] = "pushMessageByTagAction";
$params["appkey"] = $this->appkey;
$params["clientData"] = base64_encode($message->get_data()->get_transparent());
$params["transmissionContent"] = $message->get_data()->get_transmissionContent();
$params["isOffline"] = $message->get_isOffline();
$params["offlineExpireTime"] = $message->get_offlineExpireTime();
$params["pushNetWorkType"] = $message->get_pushNetWorkType();
$params["appIdList"] = $message->get_appIdList();
$params["speed"] = $message->get_speed();
$params["requestId"] = $requestId;
$params["tag"] = $message->get_tag();
return $this->httpPostJSON($this->host, $params);
}
private function get_result($info) {
$ret = array();
$ret["result"] = $info;
return $ret;
}
private function micro_time()
{
list($usec, $sec) = explode(" ", microtime());
$time = ($sec . substr($usec, 2, 3));
return $time;
}
}
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-6-3
* Time: 下午10:07
*/
require_once('../parser/pb_parser.php');
$test = new PBParser();
$test->parse('./performance.proto');
?>
\ No newline at end of file
<?php
//更新时间为2014年11月11日
//增加ClientId可自定义别名功能
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__) . '/' . 'IGt.Push.php');
define('APPKEY','');
define('APPID','');
define('MASTERSECRET','');
define('CID','');
define('DEVICETOKEN','');
define('Alias','请输入别名');
define('HOST','http://sdk.open.api.igexin.com/apiex.htm');
//define('CID2','请输入ClientID');
//pushMessageToSingle();
pushMessageToList();
//aliasBind(); //ClientID与别名绑定
//aliasBatch(); //多个ClientID,使用同一别名绑定
//queryCID(); //根据别名查询ClientId
//queryAlias(); //根据ClientId查询别名
//aliasUnBind(); //解除ClientId别名绑定
//aliasUnBindAll(); //解除所有ClientId别名绑定
function aliasBind(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->bindAlias(APPID,ALIAS,CID);
var_dump($rep);
echo("<br><br>");
}
function aliasBatch(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$target = new IGtTarget();
$target->set_clientId(CID);
$target->set_alias(ALIAS);
$targetList[] = $target;
// $target1 = new IGtTarget();
// $target1->set_clientId(CID2);
// $target1->set_alias(ALIAS);
// $targetList[] = $target1;
$rep = $igt->bindAliasBatch(APPID,$targetList);
var_dump($rep);
echo("<br><br>");
}
function queryCID(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->queryClientId(APPID,ALIAS);
var_dump($rep);
echo("<br><br>");
}
function queryAlias(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->queryAlias(APPID,CID);
var_dump($rep);
echo("<br><br>");
}
function aliasUnBind(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->unBindAlias(APPID,ALIAS,CID);
var_dump($rep);
echo("<br><br>");
}
function aliasUnBindAll(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->unBindAliasAll(APPID,ALIAS,CID);
var_dump($rep);
echo("<br><br>");
}
//
//服务端推送接口,支持三个接口推送
//1.PushMessageToSingle接口:支持对单个用户进行推送
//2.PushMessageToList接口:支持对多个用户进行推送,建议为50个用户
//3.pushMessageToApp接口:对单个应用下的所有用户进行推送,可根据省份,标签,机型过滤推送
//
//单推接口案例
function pushMessageToSingle(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
//消息模版:
// 1.TransmissionTemplate:透传功能模板
// 2.LinkTemplate:通知打开链接功能模板
// 3.NotificationTemplate:通知透传功能模板
// 4.NotyPopLoadTemplate:通知弹框下载功能模板
//$template = IGtNotyPopLoadTemplateDemo();
//$template = IGtLinkTemplateDemo();
//$template = IGtNotificationTemplateDemo();
$template = IGtTransmissionTemplateDemo();
//个推信息体
$message = new IGtSingleMessage();
$message->set_isOffline(true);//是否离线
$message->set_offlineExpireTime(3600*12*1000);//离线时间
$message->set_data($template);//设置推送消息类型
$message->set_PushNetWorkType(0);//设置是否根据WIFI推送消息,1为wifi推送,0为不限制推送
//接收方
$target = new IGtTarget();
$target->set_appId(APPID);
//$target->set_clientId(CID);
$target->set_alias(ALIAS);
$rep = $igt->pushMessageToSingle($message,$target);
var_dump($rep);
echo ("<br><br>");
}
//多推接口案例
function pushMessageToList(){
putenv("needDetails=true");
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
//消息模版:
// 1.TransmissionTemplate:透传功能模板
// 2.LinkTemplate:通知打开链接功能模板
// 3.NotificationTemplate:通知透传功能模板
// 4.NotyPopLoadTemplate:通知弹框下载功能模板
//$template = IGtNotyPopLoadTemplateDemo();
//$template = IGtLinkTemplateDemo();
//$template = IGtNotificationTemplateDemo();
$template = IGtTransmissionTemplateDemo();
//个推信息体
$message = new IGtListMessage();
$message->set_isOffline(true);//是否离线
$message->set_offlineExpireTime(3600*12*1000);//离线时间
$message->set_data($template);//设置推送消息类型
//$message->set_PushNetWorkType(0); //设置是否根据WIFI推送消息,1为wifi推送,0为不限制推送
$contentId = $igt->getContentId($message,'toList');
//$contentId = $igt->getContentId($message,"toList任务别名功能"); //根据TaskId设置组名,支持下划线,中文,英文,数字
//接收方1
$target1 = new IGtTarget();
$target1->set_appId(APPID);
//$target1->set_clientId(CID);
$target1->set_alias(ALIAS);
$targetList[] = $target1;
$rep = $igt->pushMessageToList($contentId, $targetList);
var_dump($rep);
echo ("<br><br>");
}
//所有推送接口均支持四个消息模板,依次为通知弹框下载模板,通知链接模板,通知透传模板,透传模板
//注:IOS离线推送需通过APN进行转发,需填写pushInfo字段,目前仅不支持通知弹框下载功能
function IGtNotyPopLoadTemplateDemo(){
$template = new IGtNotyPopLoadTemplate();
$template ->set_appId(APPID);//应用appid
$template ->set_appkey(APPKEY);//应用appkey
//通知栏
$template ->set_notyTitle("个推");//通知栏标题
$template ->set_notyContent("个推最新版点击下载");//通知栏内容
$template ->set_notyIcon("");//通知栏logo
$template ->set_isBelled(true);//是否响铃
$template ->set_isVibrationed(true);//是否震动
$template ->set_isCleared(true);//通知栏是否可清除
//弹框
$template ->set_popTitle("弹框标题");//弹框标题
$template ->set_popContent("弹框内容");//弹框内容
$template ->set_popImage("");//弹框图片
$template ->set_popButton1("下载");//左键
$template ->set_popButton2("取消");//右键
//下载
$template ->set_loadIcon("");//弹框图片
$template ->set_loadTitle("地震速报下载");
$template ->set_loadUrl("http://dizhensubao.igexin.com/dl/com.ceic.apk");
$template ->set_isAutoInstall(false);
$template ->set_isActived(true);
return $template;
}
function IGtLinkTemplateDemo(){
$template = new IGtLinkTemplate();
$template ->set_appId(APPID);//应用appid
$template ->set_appkey(APPKEY);//应用appkey
$template ->set_title("请输入通知标题");//通知栏标题
$template ->set_text("请输入通知内容");//通知栏内容
$template ->set_logo("");//通知栏logo
$template ->set_isRing(true);//是否响铃
$template ->set_isVibrate(true);//是否震动
$template ->set_isClearable(true);//通知栏是否可清除
$template ->set_url("http://www.igetui.com/");//打开连接地址
// iOS推送需要设置的pushInfo字段
//$template ->set_pushInfo($actionLocKey,$badge,$message,$sound,$payload,$locKey,$locArgs,$launchImage);
//$template ->set_pushInfo("",2,"","","","","","");
return $template;
}
function IGtNotificationTemplateDemo(){
$template = new IGtNotificationTemplate();
$template->set_appId(APPID);//应用appid
$template->set_appkey(APPKEY);//应用appkey
$template->set_transmissionType(1);//透传消息类型
$template->set_transmissionContent("测试离线");//透传内容
$template->set_title("个推");//通知栏标题
$template->set_text("个推最新版点击下载");//通知栏内容
$template->set_logo("http://wwww.igetui.com/logo.png");//通知栏logo
$template->set_isRing(true);//是否响铃
$template->set_isVibrate(true);//是否震动
$template->set_isClearable(true);//通知栏是否可清除
// iOS推送需要设置的pushInfo字段
//$template ->set_pushInfo($actionLocKey,$badge,$message,$sound,$payload,$locKey,$locArgs,$launchImage);
//$template ->set_pushInfo("test",1,"message","","","","","");
return $template;
}
function IGtTransmissionTemplateDemo(){
$template = new IGtTransmissionTemplate();
$template->set_appId(APPID);//应用appid
$template->set_appkey(APPKEY);//应用appkey
$template->set_transmissionType(1);//透传消息类型
$template->set_transmissionContent("测试离线");//透传内容
//iOS推送需要设置的pushInfo字段
//$template ->set_pushInfo($actionLocKey,$badge,$message,$sound,$payload,$locKey,$locArgs,$launchImage);
//$template ->set_pushInfo("", 0, "", "", "", "", "", "");
return $template;
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__) . '/' . 'igetui/utils/ApnsUtils.php');
getPushInfoLen();
function getPushInfoLen() {
$rep = ApnsUtils :: validatePayloadLength("阳春三月天气新,湖中丽人花照春。满船罗绮载花酒,燕歌赵舞留行云。五月湖中采莲女,笑隔荷花共人语",
"", "b", "a", "", "4", "com.gexin.ios.silence", "DDDD",0);
var_dump($rep);
echo ("<br><br>");
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__) . '/' . 'IGt.Push.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.AppMessage.php');
require_once(dirname(__FILE__) . '/' . 'igetui/IGt.APNPayload.php');
require_once(dirname(__FILE__) . '/' . 'igetui/template/IGt.BaseTemplate.php');
require_once(dirname(__FILE__) . '/' . 'IGt.Batch.php');
require_once(dirname(__FILE__) . '/' . 'igetui/utils/AppConditions.php');
//http的域名
define('HOST','http://sdk.open.api.igexin.com/apiex.htm');
//https的域名
//define('HOST','https://api.getui.com/apiex.htm');
define('APPKEY','');
define('APPID','');
define('MASTERSECRET','');
define('CID','');
define('DEVICETOKEN','');
define('Alias','请输入别名');
//define('BEGINTIME','2015-03-06 13:18:00');
//define('ENDTIME','2015-03-06 13:24:00');
//getUserStatus();
//stoptask();
//setTag();
//getUserTags();
//pushMessageToSingle();
//pushMessageToSingleBatch();
//getPersonaTagsDemo();
//getUserCountByTagsDemo();
//pushMessageToList();
pushMessageToApp();
//getPushMessageResultDemo();
function getPersonaTagsDemo() {
$igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
$ret = $igt->getPersonaTags(APPID);
var_dump($ret);
}
function getUserCountByTagsDemo() {
$igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
$tagList = array("金在中","龙卷风");
$ret = $igt->getUserCountByTags(APPID, $tagList);
var_dump($ret);
}
function getPushMessageResultDemo(){
// putenv("gexin_default_domainurl=http://183.129.161.174:8006/apiex.htm");
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$ret = $igt->getPushResult("OSA-0522_QZ7nHpBlxF6vrxGaLb1FA3");
var_dump($ret);
$ret = $igt->queryAppUserDataByDate(APPID,"20140807");
var_dump($ret);
$ret = $igt->queryAppPushDataByDate(APPID,"20140807");
var_dump($ret);
}
//用户状态查询
function getUserStatus() {
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->getClientIdStatus(APPID,CID);
var_dump($rep);
echo ("<br><br>");
}
//推送任务停止
function stoptask(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$igt->stop("OSA-1127_QYZyBzTPWz5ioFAixENzs3");
}
//通过服务端设置ClientId的标签
function setTag(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$tagList = array('','中文','English');
$rep = $igt->setClientTag(APPID,CID,$tagList);
var_dump($rep);
echo ("<br><br>");
}
function getUserTags() {
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$rep = $igt->getUserTags(APPID,CID);
//$rep.connect();
var_dump($rep);
echo ("<br><br>");
}
//
//服务端推送接口,支持三个接口推送
//1.PushMessageToSingle接口:支持对单个用户进行推送
//2.PushMessageToList接口:支持对多个用户进行推送,建议为50个用户
//3.pushMessageToApp接口:对单个应用下的所有用户进行推送,可根据省份,标签,机型过滤推送
//
//单推接口案例
function pushMessageToSingle(){
//$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$igt = new IGeTui(NULL,APPKEY,MASTERSECRET,false);
//消息模版:
// 1.TransmissionTemplate:透传功能模板
// 2.LinkTemplate:通知打开链接功能模板
// 3.NotificationTemplate:通知透传功能模板
// 4.NotyPopLoadTemplate:通知弹框下载功能模板
// $template = IGtNotyPopLoadTemplateDemo();
// $template = IGtLinkTemplateDemo();
// $template = IGtNotificationTemplateDemo();
$template = IGtTransmissionTemplateDemo();
//个推信息体
$message = new IGtSingleMessage();
$message->set_isOffline(true);//是否离线
$message->set_offlineExpireTime(3600*12*1000);//离线时间
$message->set_data($template);//设置推送消息类型
// $message->set_PushNetWorkType(0);//设置是否根据WIFI推送消息,1为wifi推送,0为不限制推送
//接收方
$target = new IGtTarget();
$target->set_appId(APPID);
$target->set_clientId(CID);
// $target->set_alias(Alias);
try {
$rep = $igt->pushMessageToSingle($message, $target);
var_dump($rep);
echo ("<br><br>");
}catch(RequestException $e){
$requstId =e.getRequestId();
$rep = $igt->pushMessageToSingle($message, $target,$requstId);
var_dump($rep);
echo ("<br><br>");
}
}
function pushMessageToSingleBatch()
{
putenv("gexin_pushSingleBatch_needAsync=false");
$igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
$batch = new IGtBatch(APPKEY, $igt);
$batch->setApiUrl(HOST);
//$igt->connect();
//消息模版:
// 1.TransmissionTemplate:透传功能模板
// 2.LinkTemplate:通知打开链接功能模板
// 3.NotificationTemplate:通知透传功能模板
// 4.NotyPopLoadTemplate:通知弹框下载功能模板
//$template = IGtNotyPopLoadTemplateDemo();
$templateLink = IGtLinkTemplateDemo();
$templateNoti = IGtNotificationTemplateDemo();
//$template = IGtTransmissionTemplateDemo();
//个推信息体
$messageLink = new IGtSingleMessage();
$messageLink->set_isOffline(true);//是否离线
$messageLink->set_offlineExpireTime(12 * 1000 * 3600);//离线时间
$messageLink->set_data($templateLink);//设置推送消息类型
//$messageLink->set_PushNetWorkType(1);//设置是否根据WIFI推送消息,1为wifi推送,0为不限制推送
$targetLink = new IGtTarget();
$targetLink->set_appId(APPID);
$targetLink->set_clientId(CID1);
$batch->add($messageLink, $targetLink);
//个推信息体
$messageNoti = new IGtSingleMessage();
$messageNoti->set_isOffline(true);//是否离线
$messageNoti->set_offlineExpireTime(12 * 1000 * 3600);//离线时间
$messageNoti->set_data($templateNoti);//设置推送消息类型
//$messageNoti->set_PushNetWorkType(1);//设置是否根据WIFI推送消息,1为wifi推送,0为不限制推送
$targetNoti = new IGtTarget();
$targetNoti->set_appId(APPID);
$targetNoti->set_clientId(CID2);
$batch->add($messageNoti, $targetNoti);
try {
$rep = $batch->submit();
var_dump($rep);
echo("<br><br>");
}catch(Exception $e){
$rep=$batch->retry();
var_dump($rep);
echo ("<br><br>");
}
}
//多推接口案例
function pushMessageToList()
{
putenv("gexin_pushList_needDetails=true");
putenv("gexin_pushList_needAsync=true");
$igt = new IGeTui(HOST, APPKEY, MASTERSECRET);
//消息模版:
// 1.TransmissionTemplate:透传功能模板
// 2.LinkTemplate:通知打开链接功能模板
// 3.NotificationTemplate:通知透传功能模板
// 4.NotyPopLoadTemplate:通知弹框下载功能模板
//$template = IGtNotyPopLoadTemplateDemo();
//$template = IGtLinkTemplateDemo();
//$template = IGtNotificationTemplateDemo();
$template = IGtTransmissionTemplateDemo();
//个推信息体
$message = new IGtListMessage();
$message->set_isOffline(true);//是否离线
$message->set_offlineExpireTime(3600 * 12 * 1000);//离线时间
$message->set_data($template);//设置推送消息类型
// $message->set_PushNetWorkType(1); //设置是否根据WIFI推送消息,1为wifi推送,0为不限制推送
// $contentId = $igt->getContentId($message);
$contentId = $igt->getContentId($message,"toList任务别名功能"); //根据TaskId设置组名,支持下划线,中文,英文,数字
//接收方1
$target1 = new IGtTarget();
$target1->set_appId(APPID);
$target1->set_clientId(CID);
// $target1->set_alias(Alias);
$targetList[] = $target1;
$rep = $igt->pushMessageToList($contentId, $targetList);
var_dump($rep);
echo ("<br><br>");
}
//群推接口案例
function pushMessageToApp(){
$igt = new IGeTui(HOST,APPKEY,MASTERSECRET);
$template = IGtTransmissionTemplateDemo();
//$template = IGtLinkTemplateDemo();
//个推信息体
//基于应用消息体
$message = new IGtAppMessage();
$message->set_isOffline(true);
$message->set_offlineExpireTime(10 * 60 * 1000);//离线时间单位为毫秒,例,两个小时离线为3600*1000*2
$message->set_data($template);
$appIdList=array(APPID);
$phoneTypeList=array('ANDROID');
$provinceList=array('浙江');
$tagList=array('haha');
//用户属性
//$age = array("0000", "0010");
//$cdt = new AppConditions();
// $cdt->addCondition(AppConditions::PHONE_TYPE, $phoneTypeList);
// $cdt->addCondition(AppConditions::REGION, $provinceList);
//$cdt->addCondition(AppConditions::TAG, $tagList);
//$cdt->addCondition("age", $age);
$message->set_appIdList($appIdList);
//$message->set_conditions($cdt->getCondition());
$rep = $igt->pushMessageToApp($message,"任务组名");
var_dump($rep);
echo ("<br><br>");
}
//所有推送接口均支持四个消息模板,依次为通知弹框下载模板,通知链接模板,通知透传模板,透传模板
//注:IOS离线推送需通过APN进行转发,需填写pushInfo字段,目前仅不支持通知弹框下载功能
function IGtNotyPopLoadTemplateDemo(){
$template = new IGtNotyPopLoadTemplate();
$template ->set_appId(APPID);//应用appid
$template ->set_appkey(APPKEY);//应用appkey
//通知栏
$template ->set_notyTitle("个推");//通知栏标题
$template ->set_notyContent("个推最新版点击下载");//通知栏内容
$template ->set_notyIcon("");//通知栏logo
$template ->set_isBelled(true);//是否响铃
$template ->set_isVibrationed(true);//是否震动
$template ->set_isCleared(true);//通知栏是否可清除
//弹框
$template ->set_popTitle("弹框标题");//弹框标题
$template ->set_popContent("弹框内容");//弹框内容
$template ->set_popImage("");//弹框图片
$template ->set_popButton1("下载");//左键
$template ->set_popButton2("取消");//右键
//下载
$template ->set_loadIcon("");//弹框图片
$template ->set_loadTitle("地震速报下载");
$template ->set_loadUrl("http://dizhensubao.igexin.com/dl/com.ceic.apk");
$template ->set_isAutoInstall(false);
$template ->set_isActived(true);
//$template->set_duration(BEGINTIME,ENDTIME); //设置ANDROID客户端在此时间区间内展示消息
return $template;
}
function IGtLinkTemplateDemo(){
$template = new IGtLinkTemplate();
$template ->set_appId(APPID);//应用appid
$template ->set_appkey(APPKEY);//应用appkey
$template ->set_title("请输入通知标题");//通知栏标题
$template ->set_text("请输入通知内容");//通知栏内容
$template ->set_logo("");//通知栏logo
$template ->set_isRing(true);//是否响铃
$template ->set_isVibrate(true);//是否震动
$template ->set_isClearable(true);//通知栏是否可清除
$template ->set_url("http://www.igetui.com/");//打开连接地址
//$template->set_duration(BEGINTIME,ENDTIME); //设置ANDROID客户端在此时间区间内展示消息
return $template;
}
function IGtNotificationTemplateDemo(){
$template = new IGtNotificationTemplate();
$template->set_appId(APPID);//应用appid
$template->set_appkey(APPKEY);//应用appkey
$template->set_transmissionType(1);//透传消息类型
$template->set_transmissionContent("测试离线");//透传内容
$template->set_title("个推");//通知栏标题
$template->set_text("个推最新版点击下载");//通知栏内容
$template->set_logo("http://wwww.igetui.com/logo.png");//通知栏logo
$template->set_isRing(true);//是否响铃
$template->set_isVibrate(true);//是否震动
$template->set_isClearable(true);//通知栏是否可清除
//$template->set_duration(BEGINTIME,ENDTIME); //设置ANDROID客户端在此时间区间内展示消息
return $template;
}
function IGtTransmissionTemplateDemo(){
$template = new IGtTransmissionTemplate();
$template->set_appId(APPID);//应用appid
$template->set_appkey(APPKEY);//应用appkey
$template->set_transmissionType(1);//透传消息类型
$template->set_transmissionContent("测试离线ddd");//透传内容
//$template->set_duration(BEGINTIME,ENDTIME); //设置ANDROID客户端在此时间区间内展示消息
//APN简单推送
// $template = new IGtAPNTemplate();
// $apn = new IGtAPNPayload();
// $alertmsg=new SimpleAlertMsg();
// $alertmsg->alertMsg="";
// $apn->alertMsg=$alertmsg;
//// $apn->badge=2;
//// $apn->sound="";
// $apn->add_customMsg("payload","payload");
// $apn->contentAvailable=1;
// $apn->category="ACTIONABLE";
// $template->set_apnInfo($apn);
// $message = new IGtSingleMessage();
//APN高级推送
$apn = new IGtAPNPayload();
$alertmsg=new DictionaryAlertMsg();
$alertmsg->body="body";
$alertmsg->actionLocKey="ActionLockey";
$alertmsg->locKey="LocKey";
$alertmsg->locArgs=array("locargs");
$alertmsg->launchImage="launchimage";
// IOS8.2 支持
$alertmsg->title="Title";
$alertmsg->titleLocKey="TitleLocKey";
$alertmsg->titleLocArgs=array("TitleLocArg");
$apn->alertMsg=$alertmsg;
$apn->badge=7;
$apn->sound="";
$apn->add_customMsg("payload","payload");
$apn->contentAvailable=1;
$apn->category="ACTIONABLE";
$template->set_apnInfo($apn);
//PushApn老方式传参
// $template = new IGtAPNTemplate();
// $template->set_pushInfo("", 10, "", "com.gexin.ios.silence", "", "", "", "");
return $template;
}
?>
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-4-28
* Time: 下午5:05
*/
class RequestException extends Exception
{
var $requestId;
public function __construct($requestId, $message, $e)
{
parent::__construct($message, $e);
$this->requestId = $requestId;
}
public function getRequestId()
{
return $this->requestId;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-4-10
* Time: 上午11:37
*/
class IGtAPNPayload
{
var $APN_SOUND_SILENCE = "com.gexin.ios.silence";
public static $PAYLOAD_MAX_BYTES = 2048;
var $customMsg = array();
var $badge = -1;
var $sound = "default";
var $contentAvailable = 0;
var $category;
var $alertMsg;
var $multiMedias = array();
public function get_payload()
{
try {
$apsMap = array();
if ($this->alertMsg != null) {
$msg = $this->alertMsg->get_alertMsg();
if($msg != null)
{
$apsMap["alert"] = $msg;
}
}
if ($this->badge >= 0) {
$apsMap["badge"] = $this->badge;
}
if($this -> sound == null || $this->sound == '' )
{
$apsMap["sound"] = 'default';
}elseif($this->sound != $this->APN_SOUND_SILENCE)
{
$apsMap["sound"] = $this->sound;
}
if (sizeof($apsMap) == 0) {
throw new Exception("format error");
}
if ($this->contentAvailable > 0) {
$apsMap["content-available"] = $this->contentAvailable;
}
if ($this->category != null && $this->category != "") {
$apsMap["category"] = $this->category;
}
$map = array();
if(count($this->customMsg) > 0){
foreach ($this->customMsg as $key => $value) {
$map[$key] = $value;
}
}
$map["aps"] = $apsMap;
if($this -> multiMedias != null && sizeof($this -> multiMedias) > 0) {
$map["_grinfo_"] = $this->check_multiMedias();
}
return json_encode($map);
} catch (Exception $e) {
throw new Exception("create apn payload error", -1, $e);
}
}
public function add_customMsg($key, $value)
{
if ($key != null && $key != "" && $value != null) {
$this->customMsg[$key] = $value;
}
}
function check_multiMedias()
{
if(sizeof($this -> multiMedias) > 3) {
throw new RuntimeException("MultiMedias size overlimit");
}
$needGeneRid = false;
$rids = array();
for($i = 0; $i < sizeof($this -> multiMedias); $i++) {
$media = $this -> multiMedias[$i];
if($media -> get_rid() == null) {
$needGeneRid = true;
} else {
$rids[$media -> get_rid()] = 0;
}
if($media->get_type() == null || $media->get_url() == null) {
throw new RuntimeException("MultiMedia resType and resUrl can't be null");
}
}
if(sizeof($rids) != sizeof($this -> multiMedias)) {
$needGeneRid = true;
}
if($needGeneRid) {
for ($i = 0; $i < sizeof($this->multiMedias); $i++) {
$this->multiMedias[$i] -> set_rid("grid-" . $i);
}
}
return $this -> multiMedias;
}
function add_multiMedia($media) {
$this->multiMedias[] = $media;
return $this;
}
function set_multiMedias($medias) {
$this->multiMedias = $medias;
return $this;
}
}
interface ApnMsg
{
public function get_alertMsg();
}
class DictionaryAlertMsg implements ApnMsg{
var $title;
var $body;
var $titleLocKey;
var $titleLocArgs = array();
var $actionLocKey;
var $locKey;
var $locArgs = array();
var $launchImage;
public function get_alertMsg() {
$alertMap = array();
if ($this->title != null && $this->title != "") {
$alertMap["title"] = $this->title;
}
if ($this->body != null && $this->body != "") {
$alertMap["body"] = $this->body;
}
if ($this->titleLocKey != null && $this->titleLocKey != "") {
$alertMap["title-loc-key"] = $this->titleLocKey;
}
if (sizeof($this->titleLocArgs) > 0) {
$alertMap["title-loc-args"] = $this->titleLocArgs;
}
if ($this->actionLocKey != null && $this->actionLocKey) {
$alertMap["action-loc-key"] = $this->actionLocKey;
}
if ($this->locKey != null && $this->locKey != "") {
$alertMap["loc-key"] = $this->locKey;
}
if (sizeof($this->locArgs) > 0) {
$alertMap["loc-args"] = $this->locArgs;
}
if ($this->launchImage != null && $this->launchImage != "") {
$alertMap["launch-image"] = $this->launchImage;
}
if(count($alertMap) == 0)
{
return null;
}
return $alertMap;
}
}
class SimpleAlertMsg implements ApnMsg{
var $alertMsg;
public function get_alertMsg() {
return $this->alertMsg;
}
}
?>
<?php
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__) .'/'.'utils/AppConditions.php');
class IGtAppMessage extends IGtMessage{
//array('','',..)
var $appIdList;
//array('','',..)
var $phoneTypeList;
//array('','',..)
var $provinceList;
var $tagList;
var $conditions;
var $speed=0;
function __construct(){
parent::__construct();
}
function get_appIdList() {
return $this->appIdList;
}
function set_appIdList($appIdList) {
$this->appIdList = $appIdList;
}
/**
* @deprecated deprecated since version 4.0.0.3
*/
function get_phoneTypeList() {
return $this->phoneTypeList;
}
/**
* @deprecated deprecated since version 4.0.0.3
*/
function set_phoneTypeList($phoneTypeList) {
$this->phoneTypeList = $phoneTypeList;
}
/**
* @deprecated deprecated since version 4.0.0.3
*/
function get_provinceList() {
return $this->provinceList;
}
/**
* @deprecated deprecated since version 4.0.0.3
*/
function set_provinceList($provinceList) {
$this->provinceList = $provinceList;
}
/**
* @deprecated deprecated since version 4.0.0.3
*/
function get_tagList() {
return $this->tagList;
}
/**
* @deprecated deprecated since version 4.0.0.3
*/
function set_tagList($tagList) {
$this->tagList = $tagList;
}
public function get_conditions()
{
return $this->conditions;
}
public function set_conditions($conditions)
{
$this->conditions = $conditions;
}
function get_speed()
{
return $this->speed;
}
function set_speed($speed)
{
$this->speed=$speed;
}
}
\ No newline at end of file
<?php
class IGtListMessage extends IGtMessage{
public function __construct(){
parent::__construct();
}
}
\ No newline at end of file
<?php
class IGtMessage{
var $isOffline;
/*
* 过多久该消息离线失效(单位毫秒) 支持1-72小时*3600000秒,默认1小时
*/
var $offlineExpireTime;
/**
* 0:联网方式不限;1:仅wifi;2:仅4G/3G/2G
*/
var $pushNetWorkType = 0;
var $data;
public function __construct()
{
}
function get_isOffline()
{
return $this->isOffline;
}
function set_isOffline($isOffline)
{
return $this->isOffline = $isOffline;
}
function get_offlineExpireTime()
{
return $this->offlineExpireTime;
}
function set_offlineExpireTime($offlineExpireTime)
{
return $this->offlineExpireTime = $offlineExpireTime;
}
function get_pushNetWorkType()
{
return $this->pushNetWorkType;
}
function set_pushNetWorkType($pushNetWorkType)
{
return $this->pushNetWorkType = $pushNetWorkType;
}
function get_data()
{
return $this->data;
}
function set_data($data)
{
return $this->data = $data;
}
}
\ No newline at end of file
<?php
/**
* 个推IOS多媒体消息,支持图片、音频、视频
* Created by PhpStorm.
* User: zqzhao5
* Date: 17-7-27
* Time: 下午3:21
*/
class IGtMultiMedia {
/**
* @var资源ID
*/
var $rid;
/**
* @var资源url
*/
var $url;
/**
* @var资源类型
*/
var $type;
/**
* @var是否只支持wifi下发
*/
var $onlywifi = 0;
public function __construct(){}
function get_rid() {
return $this->rid;
}
function set_rid($rid) {
$this->rid = $rid;
return $this;
}
function get_url() {
return $this->url;
}
function set_url($url) {
$this->url = $url;
return$this;
}
function get_type() {
return $this -> type;
}
function set_type($type) {
$this -> type = $type;
return $this;
}
function set_onlywifi($onlywifi) {
$this -> onlywifi = $onlywifi ? 1:0;
return $this;
}
function get_onlywifi() {
return $this -> onlywifi;
}
}
class MediaType {
const __default = self::pic;
const pic = 1;
const audio = 2;
const video = 3;
}
<?php
class CmdID extends PBEnum
{
const GTHEARDBT = 0;
const GTAUTH = 1;
const GTAUTH_RESULT = 2;
const REQSERVHOST = 3;
const REQSERVHOSTRESULT = 4;
const PUSHRESULT = 5;
const PUSHOSSINGLEMESSAGE = 6;
const PUSHMMPSINGLEMESSAGE = 7;
const STARTMMPBATCHTASK = 8;
const STARTOSBATCHTASK = 9;
const PUSHLISTMESSAGE = 10;
const ENDBATCHTASK = 11;
const PUSHMMPAPPMESSAGE = 12;
const SERVERNOTIFY = 13;
const PUSHLISTRESULT = 14;
const SERVERNOTIFYRESULT = 15;
}
class GtAuth extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function sign()
{
return $this->_get_value("1");
}
function set_sign($value)
{
return $this->_set_value("1", $value);
}
function appkey()
{
return $this->_get_value("2");
}
function set_appkey($value)
{
return $this->_set_value("2", $value);
}
function timestamp()
{
return $this->_get_value("3");
}
function set_timestamp($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
}
class GtAuthResult_GtAuthResultCode extends PBEnum
{
const successed = 0;
const failed_noSign = 1;
const failed_noAppkey = 2;
const failed_noTimestamp = 3;
const failed_AuthIllegal = 4;
const redirect = 5;
}
class GtAuthResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function code()
{
return $this->_get_value("1");
}
function set_code($value)
{
return $this->_set_value("1", $value);
}
function redirectAddress()
{
return $this->_get_value("2");
}
function set_redirectAddress($value)
{
return $this->_set_value("2", $value);
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
function info()
{
return $this->_get_value("4");
}
function set_info($value)
{
return $this->_set_value("4", $value);
}
}
class ReqServList extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function timestamp()
{
return $this->_get_value("3");
}
function set_timestamp($value)
{
return $this->_set_value("3", $value);
}
}
class ReqServListResult_ReqServHostResultCode extends PBEnum
{
const successed = 0;
const failed = 1;
const busy = 2;
}
class ReqServListResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = array();
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function code()
{
return $this->_get_value("1");
}
function set_code($value)
{
return $this->_set_value("1", $value);
}
function host($offset)
{
$v = $this->_get_arr_value("2", $offset);
return $v->get_value();
}
function append_host($value)
{
$v = $this->_add_arr_value("2");
$v->set_value($value);
}
function set_host($index, $value)
{
$v = new $this->fields["2"]();
$v->set_value($value);
$this->_set_arr_value("2", $index, $v);
}
function remove_last_host()
{
$this->_remove_last_arr_value("2");
}
function host_size()
{
return $this->_get_arr_size("2");
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
}
class PushResult_EPushResult extends PBEnum
{
const successed_online = 0;
const successed_offline = 1;
const successed_ignore = 2;
const failed = 3;
const busy = 4;
const success_startBatch = 5;
const success_endBatch = 6;
}
class PushResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PushResult_EPushResult";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBString";
$this->values["6"] = "";
$this->fields["7"] = "PBString";
$this->values["7"] = "";
}
function result()
{
return $this->_get_value("1");
}
function set_result($value)
{
return $this->_set_value("1", $value);
}
function taskId()
{
return $this->_get_value("2");
}
function set_taskId($value)
{
return $this->_set_value("2", $value);
}
function messageId()
{
return $this->_get_value("3");
}
function set_messageId($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
function target()
{
return $this->_get_value("5");
}
function set_target($value)
{
return $this->_set_value("5", $value);
}
function info()
{
return $this->_get_value("6");
}
function set_info($value)
{
return $this->_set_value("6", $value);
}
function traceId()
{
return $this->_get_value("7");
}
function set_traceId($value)
{
return $this->_set_value("7", $value);
}
}
class PushListResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PushResult";
$this->values["1"] = array();
}
function results($offset)
{
return $this->_get_arr_value("1", $offset);
}
function add_results()
{
return $this->_add_arr_value("1");
}
function set_results($index, $value)
{
$this->_set_arr_value("1", $index, $value);
}
function remove_last_results()
{
$this->_remove_last_arr_value("1");
}
function results_size()
{
return $this->_get_arr_size("1");
}
}
class Button extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBInt";
$this->values["2"] = "";
}
function text()
{
return $this->_get_value("1");
}
function set_text($value)
{
return $this->_set_value("1", $value);
}
function next()
{
return $this->_get_value("2");
}
function set_next($value)
{
return $this->_set_value("2", $value);
}
}
class AppStartUp extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function android()
{
return $this->_get_value("1");
}
function set_android($value)
{
return $this->_set_value("1", $value);
}
function symbia()
{
return $this->_get_value("2");
}
function set_symbia($value)
{
return $this->_set_value("2", $value);
}
function ios()
{
return $this->_get_value("3");
}
function set_ios($value)
{
return $this->_set_value("3", $value);
}
}
class ActionChain_Type extends PBEnum
{
const refer = 0;
const notification = 1;
const popup = 2;
const startapp = 3;
const startweb = 4;
const smsinbox = 5;
const checkapp = 6;
const eoa = 7;
const appdownload = 8;
const startsms = 9;
const httpproxy = 10;
const smsinbox2 = 11;
const mmsinbox2 = 12;
const popupweb = 13;
const dial = 14;
const reportbindapp = 15;
const reportaddphoneinfo = 16;
const reportapplist = 17;
const terminatetask = 18;
const reportapp = 19;
const enablelog = 20;
const disablelog = 21;
const uploadlog = 22;
}
class ActionChain_SMSStatus extends PBEnum
{
const unread = 0;
const read = 1;
}
class ActionChain extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "ActionChain_Type";
$this->values["2"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
$this->fields["100"] = "PBString";
$this->values["100"] = "";
$this->fields["101"] = "PBString";
$this->values["101"] = "";
$this->fields["102"] = "PBString";
$this->values["102"] = "";
$this->fields["103"] = "PBString";
$this->values["103"] = "";
$this->fields["104"] = "PBBool";
$this->values["104"] = "";
$this->fields["105"] = "PBBool";
$this->values["105"] = "";
$this->fields["106"] = "PBBool";
$this->values["106"] = "";
$this->fields["107"] = "PBString";
$this->values["107"] = "";
$this->fields["120"] = "PBString";
$this->values["120"] = "";
$this->fields["121"] = "Button";
$this->values["121"] = array();
$this->fields["140"] = "PBString";
$this->values["140"] = "";
$this->fields["141"] = "AppStartUp";
$this->values["141"] = "";
$this->fields["142"] = "PBBool";
$this->values["142"] = "";
$this->fields["143"] = "PBInt";
$this->values["143"] = "";
$this->fields["160"] = "PBString";
$this->values["160"] = "";
$this->fields["161"] = "PBString";
$this->values["161"] = "";
$this->fields["162"] = "PBBool";
$this->values["162"] = "";
$this->values["162"] = new PBBool();
$this->values["162"]->value = false;
$this->fields["180"] = "PBString";
$this->values["180"] = "";
$this->fields["181"] = "PBString";
$this->values["181"] = "";
$this->fields["182"] = "PBInt";
$this->values["182"] = "";
$this->fields["183"] = "ActionChain_SMSStatus";
$this->values["183"] = "";
$this->fields["200"] = "PBInt";
$this->values["200"] = "";
$this->fields["201"] = "PBInt";
$this->values["201"] = "";
$this->fields["220"] = "PBString";
$this->values["220"] = "";
$this->fields["223"] = "PBBool";
$this->values["223"] = "";
$this->fields["225"] = "PBBool";
$this->values["225"] = "";
$this->fields["226"] = "PBBool";
$this->values["226"] = "";
$this->fields["227"] = "PBBool";
$this->values["227"] = "";
$this->fields["241"] = "PBString";
$this->values["241"] = "";
$this->fields["242"] = "PBString";
$this->values["242"] = "";
$this->fields["260"] = "PBBool";
$this->values["260"] = "";
$this->fields["280"] = "PBString";
$this->values["280"] = "";
$this->fields["281"] = "PBString";
$this->values["281"] = "";
$this->fields["300"] = "PBBool";
$this->values["300"] = "";
$this->fields["320"] = "PBString";
$this->values["320"] = "";
$this->fields["340"] = "PBInt";
$this->values["340"] = "";
$this->fields["360"] = "PBString";
$this->values["360"] = "";
}
function actionId()
{
return $this->_get_value("1");
}
function set_actionId($value)
{
return $this->_set_value("1", $value);
}
function type()
{
return $this->_get_value("2");
}
function set_type($value)
{
return $this->_set_value("2", $value);
}
function next()
{
return $this->_get_value("3");
}
function set_next($value)
{
return $this->_set_value("3", $value);
}
function logo()
{
return $this->_get_value("100");
}
function set_logo($value)
{
return $this->_set_value("100", $value);
}
function logoURL()
{
return $this->_get_value("101");
}
function set_logoURL($value)
{
return $this->_set_value("101", $value);
}
function title()
{
return $this->_get_value("102");
}
function set_title($value)
{
return $this->_set_value("102", $value);
}
function text()
{
return $this->_get_value("103");
}
function set_text($value)
{
return $this->_set_value("103", $value);
}
function clearable()
{
return $this->_get_value("104");
}
function set_clearable($value)
{
return $this->_set_value("104", $value);
}
function ring()
{
return $this->_get_value("105");
}
function set_ring($value)
{
return $this->_set_value("105", $value);
}
function buzz()
{
return $this->_get_value("106");
}
function set_buzz($value)
{
return $this->_set_value("106", $value);
}
function bannerURL()
{
return $this->_get_value("107");
}
function set_bannerURL($value)
{
return $this->_set_value("107", $value);
}
function img()
{
return $this->_get_value("120");
}
function set_img($value)
{
return $this->_set_value("120", $value);
}
function buttons($offset)
{
return $this->_get_arr_value("121", $offset);
}
function add_buttons()
{
return $this->_add_arr_value("121");
}
function set_buttons($index, $value)
{
$this->_set_arr_value("121", $index, $value);
}
function remove_last_buttons()
{
$this->_remove_last_arr_value("121");
}
function buttons_size()
{
return $this->_get_arr_size("121");
}
function appid()
{
return $this->_get_value("140");
}
function set_appid($value)
{
return $this->_set_value("140", $value);
}
function appstartupid()
{
return $this->_get_value("141");
}
function set_appstartupid($value)
{
return $this->_set_value("141", $value);
}
function autostart()
{
return $this->_get_value("142");
}
function set_autostart($value)
{
return $this->_set_value("142", $value);
}
function failedAction()
{
return $this->_get_value("143");
}
function set_failedAction($value)
{
return $this->_set_value("143", $value);
}
function url()
{
return $this->_get_value("160");
}
function set_url($value)
{
return $this->_set_value("160", $value);
}
function withcid()
{
return $this->_get_value("161");
}
function set_withcid($value)
{
return $this->_set_value("161", $value);
}
function is_withnettype()
{
return $this->_get_value("162");
}
function set_is_withnettype($value)
{
return $this->_set_value("162", $value);
}
function address()
{
return $this->_get_value("180");
}
function set_address($value)
{
return $this->_set_value("180", $value);
}
function content()
{
return $this->_get_value("181");
}
function set_content($value)
{
return $this->_set_value("181", $value);
}
function ct()
{
return $this->_get_value("182");
}
function set_ct($value)
{
return $this->_set_value("182", $value);
}
function flag()
{
return $this->_get_value("183");
}
function set_flag($value)
{
return $this->_set_value("183", $value);
}
function successedAction()
{
return $this->_get_value("200");
}
function set_successedAction($value)
{
return $this->_set_value("200", $value);
}
function uninstalledAction()
{
return $this->_get_value("201");
}
function set_uninstalledAction($value)
{
return $this->_set_value("201", $value);
}
function name()
{
return $this->_get_value("220");
}
function set_name($value)
{
return $this->_set_value("220", $value);
}
function autoInstall()
{
return $this->_get_value("223");
}
function set_autoInstall($value)
{
return $this->_set_value("223", $value);
}
function wifiAutodownload()
{
return $this->_get_value("225");
}
function set_wifiAutodownload($value)
{
return $this->_set_value("225", $value);
}
function forceDownload()
{
return $this->_get_value("226");
}
function set_forceDownload($value)
{
return $this->_set_value("226", $value);
}
function showProgress()
{
return $this->_get_value("227");
}
function set_showProgress($value)
{
return $this->_set_value("227", $value);
}
function post()
{
return $this->_get_value("241");
}
function set_post($value)
{
return $this->_set_value("241", $value);
}
function headers()
{
return $this->_get_value("242");
}
function set_headers($value)
{
return $this->_set_value("242", $value);
}
function groupable()
{
return $this->_get_value("260");
}
function set_groupable($value)
{
return $this->_set_value("260", $value);
}
function mmsTitle()
{
return $this->_get_value("280");
}
function set_mmsTitle($value)
{
return $this->_set_value("280", $value);
}
function mmsURL()
{
return $this->_get_value("281");
}
function set_mmsURL($value)
{
return $this->_set_value("281", $value);
}
function preload()
{
return $this->_get_value("300");
}
function set_preload($value)
{
return $this->_set_value("300", $value);
}
function taskid()
{
return $this->_get_value("320");
}
function set_taskid($value)
{
return $this->_set_value("320", $value);
}
function duration()
{
return $this->_get_value("340");
}
function set_duration($value)
{
return $this->_set_value("340", $value);
}
function date()
{
return $this->_get_value("360");
}
function set_date($value)
{
return $this->_set_value("360", $value);
}
}
class PushInfo extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBString";
$this->values["6"] = "";
$this->fields["7"] = "PBString";
$this->values["7"] = "";
$this->fields["8"] = "PBString";
$this->values["8"] = "";
$this->fields["9"] = "PBString";
$this->values["9"] = "";
$this->fields["10"] = "PBInt";
$this->values["10"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function actionKey()
{
return $this->_get_value("2");
}
function set_actionKey($value)
{
return $this->_set_value("2", $value);
}
function sound()
{
return $this->_get_value("3");
}
function set_sound($value)
{
return $this->_set_value("3", $value);
}
function badge()
{
return $this->_get_value("4");
}
function set_badge($value)
{
return $this->_set_value("4", $value);
}
function payload()
{
return $this->_get_value("5");
}
function set_payload($value)
{
return $this->_set_value("5", $value);
}
function locKey()
{
return $this->_get_value("6");
}
function set_locKey($value)
{
return $this->_set_value("6", $value);
}
function locArgs()
{
return $this->_get_value("7");
}
function set_locArgs($value)
{
return $this->_set_value("7", $value);
}
function actionLocKey()
{
return $this->_get_value("8");
}
function set_actionLocKey($value)
{
return $this->_set_value("8", $value);
}
function launchImage()
{
return $this->_get_value("9");
}
function set_launchImage($value)
{
return $this->_set_value("9", $value);
}
function contentAvailable()
{
return $this->_get_value("10");
}
function set_contentAvailable($value)
{
return $this->_set_value("10", $value);
}
}
class Transparent extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBString";
$this->values["6"] = "";
$this->fields["7"] = "PushInfo";
$this->values["7"] = "";
$this->fields["8"] = "ActionChain";
$this->values["8"] = array();
$this->fields["9"] = "PBString";
$this->values["9"] = array();
}
function id()
{
return $this->_get_value("1");
}
function set_id($value)
{
return $this->_set_value("1", $value);
}
function action()
{
return $this->_get_value("2");
}
function set_action($value)
{
return $this->_set_value("2", $value);
}
function taskId()
{
return $this->_get_value("3");
}
function set_taskId($value)
{
return $this->_set_value("3", $value);
}
function appKey()
{
return $this->_get_value("4");
}
function set_appKey($value)
{
return $this->_set_value("4", $value);
}
function appId()
{
return $this->_get_value("5");
}
function set_appId($value)
{
return $this->_set_value("5", $value);
}
function messageId()
{
return $this->_get_value("6");
}
function set_messageId($value)
{
return $this->_set_value("6", $value);
}
function pushInfo()
{
return $this->_get_value("7");
}
function set_pushInfo($value)
{
return $this->_set_value("7", $value);
}
function actionChain($offset)
{
return $this->_get_arr_value("8", $offset);
}
function add_actionChain()
{
return $this->_add_arr_value("8");
}
function set_actionChain($index, $value)
{
$this->_set_arr_value("8", $index, $value);
}
function remove_last_actionChain()
{
$this->_remove_last_arr_value("8");
}
function actionChain_size()
{
return $this->_get_arr_size("8");
}
function condition($offset)
{
$v = $this->_get_arr_value("9", $offset);
return $v->get_value();
}
function append_condition($value)
{
$v = $this->_add_arr_value("9");
$v->set_value($value);
}
function set_condition($index, $value)
{
$v = new $this->fields["9"]();
$v->set_value($value);
$this->_set_arr_value("9", $index, $v);
}
function remove_last_condition()
{
$this->_remove_last_arr_value("9");
}
function condition_size()
{
return $this->_get_arr_size("9");
}
}
class OSMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["2"] = "PBBool";
$this->values["2"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
$this->fields["4"] = "Transparent";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBInt";
$this->values["6"] = "";
$this->fields["7"] = "PBInt";
$this->values["7"] = "";
$this->fields["8"] = "PBInt";
$this->values["8"] = "";
}
function isOffline()
{
return $this->_get_value("2");
}
function set_isOffline($value)
{
return $this->_set_value("2", $value);
}
function offlineExpireTime()
{
return $this->_get_value("3");
}
function set_offlineExpireTime($value)
{
return $this->_set_value("3", $value);
}
function transparent()
{
return $this->_get_value("4");
}
function set_transparent($value)
{
return $this->_set_value("4", $value);
}
function extraData()
{
return $this->_get_value("5");
}
function set_extraData($value)
{
return $this->_set_value("5", $value);
}
function msgType()
{
return $this->_get_value("6");
}
function set_msgType($value)
{
return $this->_set_value("6", $value);
}
function msgTraceFlag()
{
return $this->_get_value("7");
}
function set_msgTraceFlag($value)
{
return $this->_set_value("7", $value);
}
function priority()
{
return $this->_get_value("8");
}
function set_priority($value)
{
return $this->_set_value("8", $value);
}
}
class Target extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
}
function appId()
{
return $this->_get_value("1");
}
function set_appId($value)
{
return $this->_set_value("1", $value);
}
function clientId()
{
return $this->_get_value("2");
}
function set_clientId($value)
{
return $this->_set_value("2", $value);
}
}
class PushOSSingleMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "OSMessage";
$this->values["2"] = "";
$this->fields["3"] = "Target";
$this->values["3"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function message()
{
return $this->_get_value("2");
}
function set_message($value)
{
return $this->_set_value("2", $value);
}
function target()
{
return $this->_get_value("3");
}
function set_target($value)
{
return $this->_set_value("3", $value);
}
}
class MMPMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["2"] = "Transparent";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBInt";
$this->values["4"] = "";
$this->fields["5"] = "PBInt";
$this->values["5"] = "";
$this->fields["6"] = "PBInt";
$this->values["6"] = "";
$this->fields["7"] = "PBBool";
$this->values["7"] = "";
$this->values["7"] = new PBBool();
$this->values["7"]->value = true;
$this->fields["8"] = "PBInt";
$this->values["8"] = "";
}
function transparent()
{
return $this->_get_value("2");
}
function set_transparent($value)
{
return $this->_set_value("2", $value);
}
function extraData()
{
return $this->_get_value("3");
}
function set_extraData($value)
{
return $this->_set_value("3", $value);
}
function msgType()
{
return $this->_get_value("4");
}
function set_msgType($value)
{
return $this->_set_value("4", $value);
}
function msgTraceFlag()
{
return $this->_get_value("5");
}
function set_msgTraceFlag($value)
{
return $this->_set_value("5", $value);
}
function msgOfflineExpire()
{
return $this->_get_value("6");
}
function set_msgOfflineExpire($value)
{
return $this->_set_value("6", $value);
}
function isOffline()
{
return $this->_get_value("7");
}
function set_isOffline($value)
{
return $this->_set_value("7", $value);
}
function priority()
{
return $this->_get_value("8");
}
function set_priority($value)
{
return $this->_set_value("8", $value);
}
}
class PushMMPSingleMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "MMPMessage";
$this->values["2"] = "";
$this->fields["3"] = "Target";
$this->values["3"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function message()
{
return $this->_get_value("2");
}
function set_message($value)
{
return $this->_set_value("2", $value);
}
function target()
{
return $this->_get_value("3");
}
function set_target($value)
{
return $this->_set_value("3", $value);
}
}
class StartMMPBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "MMPMessage";
$this->values["1"] = "";
$this->fields["2"] = "PBInt";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function expire()
{
return $this->_get_value("2");
}
function set_expire($value)
{
return $this->_set_value("2", $value);
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
}
class StartOSBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "OSMessage";
$this->values["1"] = "";
$this->fields["2"] = "PBInt";
$this->values["2"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function expire()
{
return $this->_get_value("2");
}
function set_expire($value)
{
return $this->_set_value("2", $value);
}
}
class PushListMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "Target";
$this->values["3"] = array();
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function taskId()
{
return $this->_get_value("2");
}
function set_taskId($value)
{
return $this->_set_value("2", $value);
}
function targets($offset)
{
return $this->_get_arr_value("3", $offset);
}
function add_targets()
{
return $this->_add_arr_value("3");
}
function set_targets($index, $value)
{
$this->_set_arr_value("3", $index, $value);
}
function remove_last_targets()
{
$this->_remove_last_arr_value("3");
}
function targets_size()
{
return $this->_get_arr_size("3");
}
}
class EndBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
}
function taskId()
{
return $this->_get_value("1");
}
function set_taskId($value)
{
return $this->_set_value("1", $value);
}
function seqId()
{
return $this->_get_value("2");
}
function set_seqId($value)
{
return $this->_set_value("2", $value);
}
}
class PushMMPAppMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "MMPMessage";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = array();
$this->fields["3"] = "PBString";
$this->values["3"] = array();
$this->fields["4"] = "PBString";
$this->values["4"] = array();
$this->fields["5"] = "PBString";
$this->values["5"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function appIdList($offset)
{
$v = $this->_get_arr_value("2", $offset);
return $v->get_value();
}
function append_appIdList($value)
{
$v = $this->_add_arr_value("2");
$v->set_value($value);
}
function set_appIdList($index, $value)
{
$v = new $this->fields["2"]();
$v->set_value($value);
$this->_set_arr_value("2", $index, $v);
}
function remove_last_appIdList()
{
$this->_remove_last_arr_value("2");
}
function appIdList_size()
{
return $this->_get_arr_size("2");
}
function phoneTypeList($offset)
{
$v = $this->_get_arr_value("3", $offset);
return $v->get_value();
}
function append_phoneTypeList($value)
{
$v = $this->_add_arr_value("3");
$v->set_value($value);
}
function set_phoneTypeList($index, $value)
{
$v = new $this->fields["3"]();
$v->set_value($value);
$this->_set_arr_value("3", $index, $v);
}
function remove_last_phoneTypeList()
{
$this->_remove_last_arr_value("3");
}
function phoneTypeList_size()
{
return $this->_get_arr_size("3");
}
function provinceList($offset)
{
$v = $this->_get_arr_value("4", $offset);
return $v->get_value();
}
function append_provinceList($value)
{
$v = $this->_add_arr_value("4");
$v->set_value($value);
}
function set_provinceList($index, $value)
{
$v = new $this->fields["4"]();
$v->set_value($value);
$this->_set_arr_value("4", $index, $v);
}
function remove_last_provinceList()
{
$this->_remove_last_arr_value("4");
}
function provinceList_size()
{
return $this->_get_arr_size("4");
}
function seqId()
{
return $this->_get_value("5");
}
function set_seqId($value)
{
return $this->_set_value("5", $value);
}
}
class ServerNotify_NotifyType extends PBEnum
{
const normal = 0;
const serverListChanged = 1;
const exception = 2;
}
class ServerNotify extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "ServerNotify_NotifyType";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function type()
{
return $this->_get_value("1");
}
function set_type($value)
{
return $this->_set_value("1", $value);
}
function info()
{
return $this->_get_value("2");
}
function set_info($value)
{
return $this->_set_value("2", $value);
}
function extradata()
{
return $this->_get_value("3");
}
function set_extradata($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
}
class ServerNotifyResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function info()
{
return $this->_get_value("2");
}
function set_info($value)
{
return $this->_set_value("2", $value);
}
}
?>
\ No newline at end of file
<?php
class CmdID extends PBEnum
{
const GTHEARDBT = 0;
const GTAUTH = 1;
const GTAUTH_RESULT = 2;
const REQSERVHOST = 3;
const REQSERVHOSTRESULT = 4;
const PUSHRESULT = 5;
const PUSHOSSINGLEMESSAGE = 6;
const PUSHMMPSINGLEMESSAGE = 7;
const STARTMMPBATCHTASK = 8;
const STARTOSBATCHTASK = 9;
const PUSHLISTMESSAGE = 10;
const ENDBATCHTASK = 11;
const PUSHMMPAPPMESSAGE = 12;
const SERVERNOTIFY = 13;
const PUSHLISTRESULT = 14;
const SERVERNOTIFYRESULT = 15;
const STOPBATCHTASK = 16;
const STOPBATCHTASKRESULT = 17;
}
class GtAuth extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function sign()
{
return $this->_get_value("1");
}
function set_sign($value)
{
return $this->_set_value("1", $value);
}
function appkey()
{
return $this->_get_value("2");
}
function set_appkey($value)
{
return $this->_set_value("2", $value);
}
function timestamp()
{
return $this->_get_value("3");
}
function set_timestamp($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
}
class GtAuthResult_GtAuthResultCode extends PBEnum
{
const successed = 0;
const failed_noSign = 1;
const failed_noAppkey = 2;
const failed_noTimestamp = 3;
const failed_AuthIllegal = 4;
const redirect = 5;
}
class GtAuthResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = array();
}
function code()
{
return $this->_get_value("1");
}
function set_code($value)
{
return $this->_set_value("1", $value);
}
function redirectAddress()
{
return $this->_get_value("2");
}
function set_redirectAddress($value)
{
return $this->_set_value("2", $value);
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
function info()
{
return $this->_get_value("4");
}
function set_info($value)
{
return $this->_set_value("4", $value);
}
function appid($offset)
{
$v = $this->_get_arr_value("5", $offset);
return $v->get_value();
}
function append_appid($value)
{
$v = $this->_add_arr_value("5");
$v->set_value($value);
}
function set_appid($index, $value)
{
$v = new $this->fields["5"]();
$v->set_value($value);
$this->_set_arr_value("5", $index, $v);
}
function remove_last_appid()
{
$this->_remove_last_arr_value("5");
}
function appid_size()
{
return $this->_get_arr_size("5");
}
}
class ReqServList extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function timestamp()
{
return $this->_get_value("3");
}
function set_timestamp($value)
{
return $this->_set_value("3", $value);
}
}
class ReqServListResult_ReqServHostResultCode extends PBEnum
{
const successed = 0;
const failed = 1;
const busy = 2;
}
class ReqServListResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = array();
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function code()
{
return $this->_get_value("1");
}
function set_code($value)
{
return $this->_set_value("1", $value);
}
function host($offset)
{
$v = $this->_get_arr_value("2", $offset);
return $v->get_value();
}
function append_host($value)
{
$v = $this->_add_arr_value("2");
$v->set_value($value);
}
function set_host($index, $value)
{
$v = new $this->fields["2"]();
$v->set_value($value);
$this->_set_arr_value("2", $index, $v);
}
function remove_last_host()
{
$this->_remove_last_arr_value("2");
}
function host_size()
{
return $this->_get_arr_size("2");
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
}
class PushResult_EPushResult extends PBEnum
{
const successed_online = 0;
const successed_offline = 1;
const successed_ignore = 2;
const failed = 3;
const busy = 4;
const success_startBatch = 5;
const success_endBatch = 6;
const successed_async = 7;
}
class PushResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PushResult_EPushResult";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBString";
$this->values["6"] = "";
$this->fields["7"] = "PBString";
$this->values["7"] = "";
}
function result()
{
return $this->_get_value("1");
}
function set_result($value)
{
return $this->_set_value("1", $value);
}
function taskId()
{
return $this->_get_value("2");
}
function set_taskId($value)
{
return $this->_set_value("2", $value);
}
function messageId()
{
return $this->_get_value("3");
}
function set_messageId($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
function target()
{
return $this->_get_value("5");
}
function set_target($value)
{
return $this->_set_value("5", $value);
}
function info()
{
return $this->_get_value("6");
}
function set_info($value)
{
return $this->_set_value("6", $value);
}
function traceId()
{
return $this->_get_value("7");
}
function set_traceId($value)
{
return $this->_set_value("7", $value);
}
}
class PushListResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PushResult";
$this->values["1"] = array();
}
function results($offset)
{
return $this->_get_arr_value("1", $offset);
}
function add_results()
{
return $this->_add_arr_value("1");
}
function set_results($index, $value)
{
$this->_set_arr_value("1", $index, $value);
}
function remove_last_results()
{
$this->_remove_last_arr_value("1");
}
function results_size()
{
return $this->_get_arr_size("1");
}
}
class Button extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBInt";
$this->values["2"] = "";
}
function text()
{
return $this->_get_value("1");
}
function set_text($value)
{
return $this->_set_value("1", $value);
}
function next()
{
return $this->_get_value("2");
}
function set_next($value)
{
return $this->_set_value("2", $value);
}
}
class AppStartUp extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function android()
{
return $this->_get_value("1");
}
function set_android($value)
{
return $this->_set_value("1", $value);
}
function symbia()
{
return $this->_get_value("2");
}
function set_symbia($value)
{
return $this->_set_value("2", $value);
}
function ios()
{
return $this->_get_value("3");
}
function set_ios($value)
{
return $this->_set_value("3", $value);
}
}
class InnerFiled_Type extends PBEnum
{
const str = 0;
const int32 = 1;
const int64 = 2;
const floa = 3;
const doub = 4;
const bool = 5;
}
class InnerFiled extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "InnerFiled_Type";
$this->values["3"] = "";
}
function key()
{
return $this->_get_value("1");
}
function set_key($value)
{
return $this->_set_value("1", $value);
}
function val()
{
return $this->_get_value("2");
}
function set_val($value)
{
return $this->_set_value("2", $value);
}
function type()
{
return $this->_get_value("3");
}
function set_type($value)
{
return $this->_set_value("3", $value);
}
}
class SMSStatus extends PBEnum
{
const unread = 0;
const read = 1;
}
class ActionChain_Type extends PBEnum
{
const refer = 0;
const notification = 1;
const popup = 2;
const startapp = 3;
const startweb = 4;
const smsinbox = 5;
const checkapp = 6;
const eoa = 7;
const appdownload = 8;
const startsms = 9;
const httpproxy = 10;
const smsinbox2 = 11;
const mmsinbox2 = 12;
const popupweb = 13;
const dial = 14;
const reportbindapp = 15;
const reportaddphoneinfo = 16;
const reportapplist = 17;
const terminatetask = 18;
const reportapp = 19;
const enablelog = 20;
const disablelog = 21;
const uploadlog = 22;
}
class ActionChain extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "ActionChain_Type";
$this->values["2"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
$this->fields["100"] = "PBString";
$this->values["100"] = "";
$this->fields["101"] = "PBString";
$this->values["101"] = "";
$this->fields["102"] = "PBString";
$this->values["102"] = "";
$this->fields["103"] = "PBString";
$this->values["103"] = "";
$this->fields["104"] = "PBBool";
$this->values["104"] = "";
$this->fields["105"] = "PBBool";
$this->values["105"] = "";
$this->fields["106"] = "PBBool";
$this->values["106"] = "";
$this->fields["107"] = "PBString";
$this->values["107"] = "";
$this->fields["120"] = "PBString";
$this->values["120"] = "";
$this->fields["121"] = "Button";
$this->values["121"] = array();
$this->fields["140"] = "PBString";
$this->values["140"] = "";
$this->fields["141"] = "AppStartUp";
$this->values["141"] = "";
$this->fields["142"] = "PBBool";
$this->values["142"] = "";
$this->fields["143"] = "PBInt";
$this->values["143"] = "";
$this->fields["160"] = "PBString";
$this->values["160"] = "";
$this->fields["161"] = "PBString";
$this->values["161"] = "";
$this->fields["162"] = "PBBool";
$this->values["162"] = "";
$this->values["162"] = new PBBool();
$this->values["162"]->value = false;
$this->fields["180"] = "PBString";
$this->values["180"] = "";
$this->fields["181"] = "PBString";
$this->values["181"] = "";
$this->fields["182"] = "PBInt";
$this->values["182"] = "";
$this->fields["183"] = "SMSStatus";
$this->values["183"] = "";
$this->fields["200"] = "PBInt";
$this->values["200"] = "";
$this->fields["201"] = "PBInt";
$this->values["201"] = "";
$this->fields["220"] = "PBString";
$this->values["220"] = "";
$this->fields["223"] = "PBBool";
$this->values["223"] = "";
$this->fields["225"] = "PBBool";
$this->values["225"] = "";
$this->fields["226"] = "PBBool";
$this->values["226"] = "";
$this->fields["227"] = "PBBool";
$this->values["227"] = "";
$this->fields["241"] = "PBString";
$this->values["241"] = "";
$this->fields["242"] = "PBString";
$this->values["242"] = "";
$this->fields["260"] = "PBBool";
$this->values["260"] = "";
$this->fields["280"] = "PBString";
$this->values["280"] = "";
$this->fields["281"] = "PBString";
$this->values["281"] = "";
$this->fields["300"] = "PBBool";
$this->values["300"] = "";
$this->fields["320"] = "PBString";
$this->values["320"] = "";
$this->fields["340"] = "PBInt";
$this->values["340"] = "";
$this->fields["360"] = "PBString";
$this->values["360"] = "";
$this->fields["380"] = "PBString";
$this->values["380"] = "";
$this->fields["381"] = "InnerFiled";
$this->values["381"] = array();
}
function actionId()
{
return $this->_get_value("1");
}
function set_actionId($value)
{
return $this->_set_value("1", $value);
}
function type()
{
return $this->_get_value("2");
}
function set_type($value)
{
return $this->_set_value("2", $value);
}
function next()
{
return $this->_get_value("3");
}
function set_next($value)
{
return $this->_set_value("3", $value);
}
function logo()
{
return $this->_get_value("100");
}
function set_logo($value)
{
return $this->_set_value("100", $value);
}
function logoURL()
{
return $this->_get_value("101");
}
function set_logoURL($value)
{
return $this->_set_value("101", $value);
}
function title()
{
return $this->_get_value("102");
}
function set_title($value)
{
return $this->_set_value("102", $value);
}
function text()
{
return $this->_get_value("103");
}
function set_text($value)
{
return $this->_set_value("103", $value);
}
function clearable()
{
return $this->_get_value("104");
}
function set_clearable($value)
{
return $this->_set_value("104", $value);
}
function ring()
{
return $this->_get_value("105");
}
function set_ring($value)
{
return $this->_set_value("105", $value);
}
function buzz()
{
return $this->_get_value("106");
}
function set_buzz($value)
{
return $this->_set_value("106", $value);
}
function bannerURL()
{
return $this->_get_value("107");
}
function set_bannerURL($value)
{
return $this->_set_value("107", $value);
}
function img()
{
return $this->_get_value("120");
}
function set_img($value)
{
return $this->_set_value("120", $value);
}
function buttons($offset)
{
return $this->_get_arr_value("121", $offset);
}
function add_buttons()
{
return $this->_add_arr_value("121");
}
function set_buttons($index, $value)
{
$this->_set_arr_value("121", $index, $value);
}
function remove_last_buttons()
{
$this->_remove_last_arr_value("121");
}
function buttons_size()
{
return $this->_get_arr_size("121");
}
function appid()
{
return $this->_get_value("140");
}
function set_appid($value)
{
return $this->_set_value("140", $value);
}
function appstartupid()
{
return $this->_get_value("141");
}
function set_appstartupid($value)
{
return $this->_set_value("141", $value);
}
function autostart()
{
return $this->_get_value("142");
}
function set_autostart($value)
{
return $this->_set_value("142", $value);
}
function failedAction()
{
return $this->_get_value("143");
}
function set_failedAction($value)
{
return $this->_set_value("143", $value);
}
function url()
{
return $this->_get_value("160");
}
function set_url($value)
{
return $this->_set_value("160", $value);
}
function withcid()
{
return $this->_get_value("161");
}
function set_withcid($value)
{
return $this->_set_value("161", $value);
}
function is_withnettype()
{
return $this->_get_value("162");
}
function set_is_withnettype($value)
{
return $this->_set_value("162", $value);
}
function address()
{
return $this->_get_value("180");
}
function set_address($value)
{
return $this->_set_value("180", $value);
}
function content()
{
return $this->_get_value("181");
}
function set_content($value)
{
return $this->_set_value("181", $value);
}
function ct()
{
return $this->_get_value("182");
}
function set_ct($value)
{
return $this->_set_value("182", $value);
}
function flag()
{
return $this->_get_value("183");
}
function set_flag($value)
{
return $this->_set_value("183", $value);
}
function successedAction()
{
return $this->_get_value("200");
}
function set_successedAction($value)
{
return $this->_set_value("200", $value);
}
function uninstalledAction()
{
return $this->_get_value("201");
}
function set_uninstalledAction($value)
{
return $this->_set_value("201", $value);
}
function name()
{
return $this->_get_value("220");
}
function set_name($value)
{
return $this->_set_value("220", $value);
}
function autoInstall()
{
return $this->_get_value("223");
}
function set_autoInstall($value)
{
return $this->_set_value("223", $value);
}
function wifiAutodownload()
{
return $this->_get_value("225");
}
function set_wifiAutodownload($value)
{
return $this->_set_value("225", $value);
}
function forceDownload()
{
return $this->_get_value("226");
}
function set_forceDownload($value)
{
return $this->_set_value("226", $value);
}
function showProgress()
{
return $this->_get_value("227");
}
function set_showProgress($value)
{
return $this->_set_value("227", $value);
}
function post()
{
return $this->_get_value("241");
}
function set_post($value)
{
return $this->_set_value("241", $value);
}
function headers()
{
return $this->_get_value("242");
}
function set_headers($value)
{
return $this->_set_value("242", $value);
}
function groupable()
{
return $this->_get_value("260");
}
function set_groupable($value)
{
return $this->_set_value("260", $value);
}
function mmsTitle()
{
return $this->_get_value("280");
}
function set_mmsTitle($value)
{
return $this->_set_value("280", $value);
}
function mmsURL()
{
return $this->_get_value("281");
}
function set_mmsURL($value)
{
return $this->_set_value("281", $value);
}
function preload()
{
return $this->_get_value("300");
}
function set_preload($value)
{
return $this->_set_value("300", $value);
}
function taskid()
{
return $this->_get_value("320");
}
function set_taskid($value)
{
return $this->_set_value("320", $value);
}
function duration()
{
return $this->_get_value("340");
}
function set_duration($value)
{
return $this->_set_value("340", $value);
}
function date()
{
return $this->_get_value("360");
}
function set_date($value)
{
return $this->_set_value("360", $value);
}
function stype()
{
return $this->_get_value("380");
}
function set_stype($value)
{
return $this->_set_value("380", $value);
}
function field($offset)
{
return $this->_get_arr_value("381", $offset);
}
function add_field()
{
return $this->_add_arr_value("381");
}
function set_field($index, $value)
{
$this->_set_arr_value("381", $index, $value);
}
function remove_last_field()
{
$this->_remove_last_arr_value("381");
}
function field_size()
{
return $this->_get_arr_size("381");
}
}
class NotifyInfo extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function title()
{
return $this->_get_value("1");
}
function set_title($value)
{
return $this->_set_value("1", $value);
}
function content()
{
return $this->_get_value("2");
}
function set_content($value)
{
return $this->_set_value("2", $value);
}
function payload()
{
return $this->_get_value("3");
}
function set_payload($value)
{
return $this->_set_value("3", $value);
}
}
class PushInfo extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBString";
$this->values["6"] = "";
$this->fields["7"] = "PBString";
$this->values["7"] = "";
$this->fields["8"] = "PBString";
$this->values["8"] = "";
$this->fields["9"] = "PBString";
$this->values["9"] = "";
$this->fields["10"] = "PBInt";
$this->values["10"] = "";
$this->fields["11"] = "PBBool";
$this->values["11"] = "";
$this->fields["12"] = "PBString";
$this->values["12"] = "";
$this->fields["13"] = "PBBool";
$this->values["13"] = "";
$this->fields["14"] = "PBString";
$this->values["14"] = "";
$this->fields["15"] = "PBBool";
$this->values["15"] = "";
$this->fields["16"] = "NotifyInfo";
$this->values["16"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function actionKey()
{
return $this->_get_value("2");
}
function set_actionKey($value)
{
return $this->_set_value("2", $value);
}
function sound()
{
return $this->_get_value("3");
}
function set_sound($value)
{
return $this->_set_value("3", $value);
}
function badge()
{
return $this->_get_value("4");
}
function set_badge($value)
{
return $this->_set_value("4", $value);
}
function payload()
{
return $this->_get_value("5");
}
function set_payload($value)
{
return $this->_set_value("5", $value);
}
function locKey()
{
return $this->_get_value("6");
}
function set_locKey($value)
{
return $this->_set_value("6", $value);
}
function locArgs()
{
return $this->_get_value("7");
}
function set_locArgs($value)
{
return $this->_set_value("7", $value);
}
function actionLocKey()
{
return $this->_get_value("8");
}
function set_actionLocKey($value)
{
return $this->_set_value("8", $value);
}
function launchImage()
{
return $this->_get_value("9");
}
function set_launchImage($value)
{
return $this->_set_value("9", $value);
}
function contentAvailable()
{
return $this->_get_value("10");
}
function set_contentAvailable($value)
{
return $this->_set_value("10", $value);
}
function invalidAPN()
{
return $this->_get_value("11");
}
function set_invalidAPN($value)
{
return $this->_set_value("11", $value);
}
function apnJson()
{
return $this->_get_value("12");
}
function set_apnJson($value)
{
return $this->_set_value("12", $value);
}
function invalidMPN()
{
return $this->_get_value("13");
}
function set_invalidMPN($value)
{
return $this->_set_value("13", $value);
}
function mpnXml()
{
return $this->_get_value("14");
}
function set_mpnXml($value)
{
return $this->_set_value("14", $value);
}
function validNotify()
{
return $this->_get_value("15");
}
function set_validNotify($value)
{
return $this->_set_value("15", $value);
}
function notifyInfo()
{
return $this->_get_value("16");
}
function set_notifyInfo($value)
{
return $this->_set_value("16", $value);
}
}
class Transparent extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBString";
$this->values["6"] = "";
$this->fields["7"] = "PushInfo";
$this->values["7"] = "";
$this->fields["8"] = "ActionChain";
$this->values["8"] = array();
$this->fields["9"] = "PBString";
$this->values["9"] = array();
$this->fields["10"] = "PBInt";
$this->values["10"] = "";
$this->fields["11"] = "PBString";
$this->values["11"] = "";
}
function id()
{
return $this->_get_value("1");
}
function set_id($value)
{
return $this->_set_value("1", $value);
}
function action()
{
return $this->_get_value("2");
}
function set_action($value)
{
return $this->_set_value("2", $value);
}
function taskId()
{
return $this->_get_value("3");
}
function set_taskId($value)
{
return $this->_set_value("3", $value);
}
function appKey()
{
return $this->_get_value("4");
}
function set_appKey($value)
{
return $this->_set_value("4", $value);
}
function appId()
{
return $this->_get_value("5");
}
function set_appId($value)
{
return $this->_set_value("5", $value);
}
function messageId()
{
return $this->_get_value("6");
}
function set_messageId($value)
{
return $this->_set_value("6", $value);
}
function pushInfo()
{
return $this->_get_value("7");
}
function set_pushInfo($value)
{
return $this->_set_value("7", $value);
}
function actionChain($offset)
{
return $this->_get_arr_value("8", $offset);
}
function add_actionChain()
{
return $this->_add_arr_value("8");
}
function set_actionChain($index, $value)
{
$this->_set_arr_value("8", $index, $value);
}
function remove_last_actionChain()
{
$this->_remove_last_arr_value("8");
}
function actionChain_size()
{
return $this->_get_arr_size("8");
}
function condition($offset)
{
$v = $this->_get_arr_value("9", $offset);
return $v->get_value();
}
function append_condition($value)
{
$v = $this->_add_arr_value("9");
$v->set_value($value);
}
function set_condition($index, $value)
{
$v = new $this->fields["9"]();
$v->set_value($value);
$this->_set_arr_value("9", $index, $v);
}
function remove_last_condition()
{
$this->_remove_last_arr_value("9");
}
function condition_size()
{
return $this->_get_arr_size("9");
}
function templateId()
{
return $this->_get_value("10");
}
function set_templateId($value)
{
return $this->_set_value("10", $value);
}
function taskGroupId()
{
return $this->_get_value("11");
}
function set_taskGroupId($value)
{
return $this->_set_value("11", $value);
}
}
class OSMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["2"] = "PBBool";
$this->values["2"] = "";
$this->fields["3"] = "PBInt";
$this->values["3"] = "";
$this->fields["4"] = "Transparent";
$this->values["4"] = "";
$this->fields["5"] = "PBString";
$this->values["5"] = "";
$this->fields["6"] = "PBInt";
$this->values["6"] = "";
$this->fields["7"] = "PBInt";
$this->values["7"] = "";
$this->fields["8"] = "PBInt";
$this->values["8"] = "";
}
function isOffline()
{
return $this->_get_value("2");
}
function set_isOffline($value)
{
return $this->_set_value("2", $value);
}
function offlineExpireTime()
{
return $this->_get_value("3");
}
function set_offlineExpireTime($value)
{
return $this->_set_value("3", $value);
}
function transparent()
{
return $this->_get_value("4");
}
function set_transparent($value)
{
return $this->_set_value("4", $value);
}
function extraData()
{
return $this->_get_value("5");
}
function set_extraData($value)
{
return $this->_set_value("5", $value);
}
function msgType()
{
return $this->_get_value("6");
}
function set_msgType($value)
{
return $this->_set_value("6", $value);
}
function msgTraceFlag()
{
return $this->_get_value("7");
}
function set_msgTraceFlag($value)
{
return $this->_set_value("7", $value);
}
function priority()
{
return $this->_get_value("8");
}
function set_priority($value)
{
return $this->_set_value("8", $value);
}
}
class Target extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function appId()
{
return $this->_get_value("1");
}
function set_appId($value)
{
return $this->_set_value("1", $value);
}
function clientId()
{
return $this->_get_value("2");
}
function set_clientId($value)
{
return $this->_set_value("2", $value);
}
function alias()
{
return $this->_get_value("3");
}
function set_alias($value)
{
return $this->_set_value("3", $value);
}
}
class PushOSSingleMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "OSMessage";
$this->values["2"] = "";
$this->fields["3"] = "Target";
$this->values["3"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function message()
{
return $this->_get_value("2");
}
function set_message($value)
{
return $this->_set_value("2", $value);
}
function target()
{
return $this->_get_value("3");
}
function set_target($value)
{
return $this->_set_value("3", $value);
}
}
class MMPMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["2"] = "Transparent";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBInt";
$this->values["4"] = "";
$this->fields["5"] = "PBInt";
$this->values["5"] = "";
$this->fields["6"] = "PBInt";
$this->values["6"] = "";
$this->fields["7"] = "PBBool";
$this->values["7"] = "";
$this->values["7"] = new PBBool();
$this->values["7"]->value = true;
$this->fields["8"] = "PBInt";
$this->values["8"] = "";
$this->fields["9"] = "PBString";
$this->values["9"] = "";
$this->fields["10"] = "PBBool";
$this->values["10"] = "";
$this->values["10"] = new PBBool();
$this->values["10"]->value = true;
}
function transparent()
{
return $this->_get_value("2");
}
function set_transparent($value)
{
return $this->_set_value("2", $value);
}
function extraData()
{
return $this->_get_value("3");
}
function set_extraData($value)
{
return $this->_set_value("3", $value);
}
function msgType()
{
return $this->_get_value("4");
}
function set_msgType($value)
{
return $this->_set_value("4", $value);
}
function msgTraceFlag()
{
return $this->_get_value("5");
}
function set_msgTraceFlag($value)
{
return $this->_set_value("5", $value);
}
function msgOfflineExpire()
{
return $this->_get_value("6");
}
function set_msgOfflineExpire($value)
{
return $this->_set_value("6", $value);
}
function isOffline()
{
return $this->_get_value("7");
}
function set_isOffline($value)
{
return $this->_set_value("7", $value);
}
function priority()
{
return $this->_get_value("8");
}
function set_priority($value)
{
return $this->_set_value("8", $value);
}
function cdnUrl()
{
return $this->_get_value("9");
}
function set_cdnUrl($value)
{
return $this->_set_value("9", $value);
}
function isSync()
{
return $this->_get_value("10");
}
function set_isSync($value)
{
return $this->_set_value("10", $value);
}
}
class PushMMPSingleMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "MMPMessage";
$this->values["2"] = "";
$this->fields["3"] = "Target";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function message()
{
return $this->_get_value("2");
}
function set_message($value)
{
return $this->_set_value("2", $value);
}
function target()
{
return $this->_get_value("3");
}
function set_target($value)
{
return $this->_set_value("3", $value);
}
function requestId()
{
return $this->_get_value("4");
}
function set_requestId($value)
{
return $this->_set_value("4", $value);
}
}
class StartMMPBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "MMPMessage";
$this->values["1"] = "";
$this->fields["2"] = "PBInt";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function expire()
{
return $this->_get_value("2");
}
function set_expire($value)
{
return $this->_set_value("2", $value);
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
function taskGroupName()
{
return $this->_get_value("4");
}
function set_taskGroupName($value)
{
return $this->_set_value("4", $value);
}
}
class StartOSBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "OSMessage";
$this->values["1"] = "";
$this->fields["2"] = "PBInt";
$this->values["2"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function expire()
{
return $this->_get_value("2");
}
function set_expire($value)
{
return $this->_set_value("2", $value);
}
}
class SingleBatchItem extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBInt";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function data()
{
return $this->_get_value("2");
}
function set_data($value)
{
return $this->_set_value("2", $value);
}
}
class SingleBatchRequest extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "SingleBatchItem";
$this->values["2"] = array();
}
function batchId()
{
return $this->_get_value("1");
}
function set_batchId($value)
{
return $this->_set_value("1", $value);
}
function batchItem($offset)
{
return $this->_get_arr_value("2", $offset);
}
function add_batchItem()
{
return $this->_add_arr_value("2");
}
function set_batchItem($index, $value)
{
$this->_set_arr_value("2", $index, $value);
}
function remove_last_batchItem()
{
$this->_remove_last_arr_value("2");
}
function batchItem_size()
{
return $this->_get_arr_size("2");
}
}
class PushListMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "Target";
$this->values["3"] = array();
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function taskId()
{
return $this->_get_value("2");
}
function set_taskId($value)
{
return $this->_set_value("2", $value);
}
function targets($offset)
{
return $this->_get_arr_value("3", $offset);
}
function add_targets()
{
return $this->_add_arr_value("3");
}
function set_targets($index, $value)
{
$this->_set_arr_value("3", $index, $value);
}
function remove_last_targets()
{
$this->_remove_last_arr_value("3");
}
function targets_size()
{
return $this->_get_arr_size("3");
}
}
class EndBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
}
function taskId()
{
return $this->_get_value("1");
}
function set_taskId($value)
{
return $this->_set_value("1", $value);
}
function seqId()
{
return $this->_get_value("2");
}
function set_seqId($value)
{
return $this->_set_value("2", $value);
}
}
class StopBatchTask extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function taskId()
{
return $this->_get_value("1");
}
function set_taskId($value)
{
return $this->_set_value("1", $value);
}
function appkey()
{
return $this->_get_value("2");
}
function set_appkey($value)
{
return $this->_set_value("2", $value);
}
function appId()
{
return $this->_get_value("3");
}
function set_appId($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
}
class StopBatchTaskResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBBool";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
}
function result()
{
return $this->_get_value("1");
}
function set_result($value)
{
return $this->_set_value("1", $value);
}
function info()
{
return $this->_get_value("2");
}
function set_info($value)
{
return $this->_set_value("2", $value);
}
function seqId()
{
return $this->_get_value("3");
}
function set_seqId($value)
{
return $this->_set_value("3", $value);
}
}
class PushMMPAppMessage extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "MMPMessage";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = array();
$this->fields["3"] = "PBString";
$this->values["3"] = array();
$this->fields["4"] = "PBString";
$this->values["4"] = array();
$this->fields["5"] = "PBString";
$this->values["5"] = "";
}
function message()
{
return $this->_get_value("1");
}
function set_message($value)
{
return $this->_set_value("1", $value);
}
function appIdList($offset)
{
$v = $this->_get_arr_value("2", $offset);
return $v->get_value();
}
function append_appIdList($value)
{
$v = $this->_add_arr_value("2");
$v->set_value($value);
}
function set_appIdList($index, $value)
{
$v = new $this->fields["2"]();
$v->set_value($value);
$this->_set_arr_value("2", $index, $v);
}
function remove_last_appIdList()
{
$this->_remove_last_arr_value("2");
}
function appIdList_size()
{
return $this->_get_arr_size("2");
}
function phoneTypeList($offset)
{
$v = $this->_get_arr_value("3", $offset);
return $v->get_value();
}
function append_phoneTypeList($value)
{
$v = $this->_add_arr_value("3");
$v->set_value($value);
}
function set_phoneTypeList($index, $value)
{
$v = new $this->fields["3"]();
$v->set_value($value);
$this->_set_arr_value("3", $index, $v);
}
function remove_last_phoneTypeList()
{
$this->_remove_last_arr_value("3");
}
function phoneTypeList_size()
{
return $this->_get_arr_size("3");
}
function provinceList($offset)
{
$v = $this->_get_arr_value("4", $offset);
return $v->get_value();
}
function append_provinceList($value)
{
$v = $this->_add_arr_value("4");
$v->set_value($value);
}
function set_provinceList($index, $value)
{
$v = new $this->fields["4"]();
$v->set_value($value);
$this->_set_arr_value("4", $index, $v);
}
function remove_last_provinceList()
{
$this->_remove_last_arr_value("4");
}
function provinceList_size()
{
return $this->_get_arr_size("4");
}
function seqId()
{
return $this->_get_value("5");
}
function set_seqId($value)
{
return $this->_set_value("5", $value);
}
}
class ServerNotify_NotifyType extends PBEnum
{
const normal = 0;
const serverListChanged = 1;
const exception = 2;
}
class ServerNotify extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "ServerNotify_NotifyType";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
$this->fields["3"] = "PBString";
$this->values["3"] = "";
$this->fields["4"] = "PBString";
$this->values["4"] = "";
}
function type()
{
return $this->_get_value("1");
}
function set_type($value)
{
return $this->_set_value("1", $value);
}
function info()
{
return $this->_get_value("2");
}
function set_info($value)
{
return $this->_set_value("2", $value);
}
function extradata()
{
return $this->_get_value("3");
}
function set_extradata($value)
{
return $this->_set_value("3", $value);
}
function seqId()
{
return $this->_get_value("4");
}
function set_seqId($value)
{
return $this->_set_value("4", $value);
}
}
class ServerNotifyResult extends PBMessage
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
public function __construct($reader=null)
{
parent::__construct($reader);
$this->fields["1"] = "PBString";
$this->values["1"] = "";
$this->fields["2"] = "PBString";
$this->values["2"] = "";
}
function seqId()
{
return $this->_get_value("1");
}
function set_seqId($value)
{
return $this->_set_value("1", $value);
}
function info()
{
return $this->_get_value("2");
}
function set_info($value)
{
return $this->_set_value("2", $value);
}
}
?>
\ No newline at end of file
<?php
Class IGtSingleMessage extends IGtMessage{
public function __construct(){
parent::__construct();
}
}
\ No newline at end of file
<?php
header("Content-Type: text/html; charset=utf-8");
class IGtTagMessage extends IGtMessage{
//array('','',..)
var $appIdList;
var $tag;
var $speed=0;
function __construct(){
parent::__construct();
}
function get_appIdList() {
return $this->appIdList;
}
function set_appIdList($appIdList) {
$this->appIdList = $appIdList;
}
function get_tag() {
return $this->tag;
}
function set_tag($tag) {
$this->tag = $tag;
}
function get_speed()
{
return $this->speed;
}
function set_speed($speed)
{
$this->speed=$speed;
}
}
\ No newline at end of file
<?php
class IGtTarget{
var $appId;
var $clientId;
var $alias;
public function __construct()
{
}
function get_appId()
{
return $this->appId;
}
function set_appId($appId)
{
return $this->appId = $appId;
}
function get_clientId()
{
return $this->clientId;
}
function set_clientId($clientId)
{
return $this->clientId = $clientId;
}
function set_alias($alias)
{
return $this->alias = $alias;
}
function get_alias()
{
return $this->alias;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Kevin
* Date: 14-9-4
* Time: 下午2:12
*/
class IGtAPNTemplate extends IGtBaseTemplate{
}
\ No newline at end of file
<?php
require_once(dirname(__FILE__) . '/' . '../utils/ApnsUtils.php');
require_once(dirname(__FILE__) . '/' . '../IGt.APNPayload.php');
class IGtBaseTemplate
{
var $appId;
var $appkey;
var $pushInfo;
var $duration;
function get_transparent()
{
$transparent = new Transparent();
$transparent->set_templateId($this->getTemplateId());
$transparent->set_id('');
$transparent->set_messageId('');
$transparent->set_taskId('');
$transparent->set_action('pushmessage');
$transparent->set_pushInfo($this->get_pushInfo());
$transparent->set_appId($this->appId);
$transparent->set_appKey($this->appkey);
$actionChainList = $this->getActionChain();
foreach ($actionChainList as $index => $actionChain) {
$transparent->add_actionChain();
$transparent->set_actionChain($index, $actionChain);
}
$transparent->append_condition($this->get_durcondition());
return $transparent->SerializeToString();
//return $transparent->condition(0);
}
function getActionChain()
{
return $list = array();
}
function get_durcondition()
{
if ($this->duration == null || $this->duration == '')
{
return "";
}
return "duration=" . $this->duration;
}
function get_duration()
{
return $this->duration;
}
function set_duration($begin, $end)
{
date_default_timezone_set('asia/shanghai');
/* //for test
var_dump(date("Y-m-d H:i:s",strtotime($begin)));
var_dump(date("Y-m-d H:i:s",strtotime($end)));
*/
$ss = (string)strtotime($begin) * 1000;
$e = (string)strtotime($end) * 1000;
if ($ss <= 0 || $e <= 0)
throw new Exception("DateFormat: yyyy-MM-dd HH:mm:ss");
if ($ss > $e)
throw new Exception("startTime should be smaller than endTime");
$this->duration = $ss . "-" . $e;
}
function get_transmissionContent()
{
return null;
}
function get_pushType()
{
return null;
}
function get_actionChain()
{
return null;
}
function get_pushInfo()
{
if ($this->pushInfo == null) {
$this->pushInfo = new PushInfo();
$this->pushInfo->set_invalidAPN(true);
$this->pushInfo->set_invalidMPN(true);
}
return $this->pushInfo;
}
function set_pushInfo($actionLocKey, $badge, $message, $sound, $payload, $locKey, $locArgs, $launchImage, $contentAvailable = 0)
{
$apn = new IGtAPNPayload();
$alertMsg = new DictionaryAlertMsg();
if ($actionLocKey != null && $actionLocKey != '')
{
$alertMsg->actionLocKey = $actionLocKey;
}
if ($message != null && $message != '')
{
$alertMsg->body = $message;
}
if ($locKey != null && $locKey != '')
{
$alertMsg->locKey = $locKey;
}
if ($locArgs != null && $locArgs != '')
{
array_push($alertMsg->locArgs, $locArgs);
}
if ($launchImage != null && $launchImage != '')
{
$alertMsg->launchImage = $launchImage;
}
$apn->alertMsg = $alertMsg;
if ($badge != null )
{
$apn->badge = $badge;
}
if ($sound != null && $sound != '')
{
$apn->sound = $sound;
}
if ($contentAvailable != null )
{
$apn->contentAvailable = $contentAvailable;
}
if ($payload != null && $payload != '')
{
$apn->add_customMsg("payload", $payload);
}
$this->set_apnInfo($apn);
}
function set_apnInfo($payload)
{
if ($payload == null) {
return;
}
$payload = $payload->get_payload();
if ($payload == null || $payload == "") {
return;
}
$len = strlen($payload);
if ($len > IGtAPNPayload::$PAYLOAD_MAX_BYTES) {
throw new Exception("APN payload length overlength (" . $len . ">" . IGtAPNPayload::$PAYLOAD_MAX_BYTES . ")");
}
$pushInfo = $this->get_pushInfo();
$pushInfo->set_apnJson($payload);
$pushInfo->set_invalidAPN(false);
}
function set_appId($appId)
{
$this->appId = $appId;
}
function set_appkey($appkey)
{
$this->appkey = $appkey;
}
function abslength($str)
{
if (empty($str)) {
return 0;
}
if (function_exists('mb_strlen')) {
return mb_strlen($str, 'utf-8');
} else {
preg_match_all("/./u", $str, $ar);
return count($ar[0]);
}
}
function getTemplateId() {
if($this instanceof IGtNotificationTemplate) {
return 0;
}
if($this instanceof IGtLinkTemplate) {
return 1;
}
if($this instanceof IGtNotyPopLoadTemplate) {
return 2;
}
if($this instanceof IGtTransmissionTemplate) {
return 4;
}
if($this instanceof IGtAPNTemplate) {
return 5;
}
return -1;
}
}
\ No newline at end of file
<?php
class IGtLinkTemplate extends IGtBaseTemplate {
/**
*String
*/
var $text;
/**
*String
*/
var $title;
/**
*String
*/
var $logo;
var $logoURL;
/**
*boolean
*/
var $isRing;
/**
*boolean
*/
var $isVibrate;
/**
*String
*/
var $url;
/**
*boolean
*/
var $isClearable;
/**
*int
*/
var $notifyStyle = 0;
public function getActionChain() {
$actionChains = array();
// 设置actionChain
$actionChain1 = new ActionChain();
$actionChain1->set_actionId(1);
$actionChain1->set_type(ActionChain_Type::refer);
$actionChain1->set_next(10000);
//通知
$actionChain2 = new ActionChain();
$actionChain2->set_actionId(10000);
$actionChain2->set_type(ActionChain_Type::mmsinbox2);
$actionChain2->set_stype("notification");
$f_text = new InnerFiled();
$f_text->set_key("text");
$f_text->set_val($this->text);
$f_text->set_type(InnerFiled_Type::str);
$actionChain2->set_field(0,$f_text);
$f_title = new InnerFiled();
$f_title->set_key("title");
$f_title->set_val($this->title);
$f_title->set_type(InnerFiled_Type::str);
$actionChain2->set_field(1,$f_title);
$f_logo = new InnerFiled();
$f_logo->set_key("logo");
$f_logo->set_val($this->logo);
$f_logo->set_type(InnerFiled_Type::str);
$actionChain2->set_field(2,$f_logo);
$f_logoURL = new InnerFiled();
$f_logoURL->set_key("logo_url");
$f_logoURL->set_val($this->logoURL);
$f_logoURL->set_type(InnerFiled_Type::str);
$actionChain2->set_field(3,$f_logoURL);
$f_notifyStyle = new InnerFiled();
$f_notifyStyle->set_key("notifyStyle");
$f_notifyStyle->set_val(strval($this->notifyStyle));
$f_notifyStyle->set_type(InnerFiled_Type::str);
$actionChain2->set_field(4,$f_notifyStyle);
$f_isRing = new InnerFiled();
$f_isRing->set_key("is_noring");
$f_isRing->set_val(!$this->isRing ? "true" : "false");
$f_isRing->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(5,$f_isRing);
$f_isVibrate = new InnerFiled();
$f_isVibrate->set_key("is_novibrate");
$f_isVibrate->set_val(!$this->isVibrate ? "true" : "false");
$f_isVibrate->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(6,$f_isVibrate);
$f_isClearable = new InnerFiled();
$f_isClearable->set_key("is_noclear");
$f_isClearable->set_val(!$this->isClearable ? "true" : "false");
$f_isClearable->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(7,$f_isClearable);
$actionChain2->set_next(10010);
$actionChain3 = new ActionChain();
$actionChain3->set_actionId(10010);
$actionChain3->set_type(ActionChain_Type::refer);
$actionChain3->set_next(10020);
//goto
$actionChain3 = new ActionChain();
$actionChain3->set_actionId(10010);
$actionChain3->set_type(ActionChain_Type::refer);
$actionChain3->set_next(10040);
//启动web
$actionChain4 = new ActionChain();
$actionChain4->set_actionId(10040);
$actionChain4->set_type(ActionChain_Type::startweb);
$actionChain4->set_url($this->url);
$actionChain4->set_next(100);
//结束
$actionChain5 = new ActionChain();
$actionChain5->set_actionId(100);
$actionChain5->set_type(ActionChain_Type::eoa);
array_push($actionChains, $actionChain1,$actionChain2,$actionChain3,$actionChain4,$actionChain5);
return $actionChains;
}
function get_pushType() {
return 'LinkMsg';
}
function set_text($text) {
$this->text = $text;
}
function set_title($title) {
$this->title = $title;
}
function set_logo($logo) {
$this->logo = $logo;
}
function set_logoURL($logoURL) {
$this->logoURL = $logoURL;
}
function set_url($url) {
$this->url = $url;
}
function set_isRing($isRing) {
$this->isRing = $isRing;
}
function set_isVibrate($isVibrate) {
$this->isVibrate = $isVibrate;
}
function set_isClearable($isClearable) {
$this->isClearable = $isClearable;
}
function set_notifyStyle($notifyStyle) {
if($notifyStyle != 1){
$this->notifyStyle = 0;
} else {
$this->notifyStyle = 1;
}
}
}
\ No newline at end of file
<?php
class IGtNotificationTemplate extends IGtBaseTemplate {
var $text;
var $title;
var $logo;
var $logoURL;
var $transmissionType;
var $transmissionContent;
var $isRing;
var $isVibrate;
var $isClearable;
var $notifyStyle = 0;
public function getActionChain() {
$actionChains = array();
// 设置actionChain
$actionChain1 = new ActionChain();
$actionChain1->set_actionId(1);
$actionChain1->set_type(ActionChain_Type::refer);
$actionChain1->set_next(10000);
//通知
$actionChain2 = new ActionChain();
$actionChain2->set_actionId(10000);
$actionChain2->set_type(ActionChain_Type::mmsinbox2);
$actionChain2->set_stype("notification");
$f_text = new InnerFiled();
$f_text->set_key("text");
$f_text->set_val($this->text);
$f_text->set_type(InnerFiled_Type::str);
$actionChain2->set_field(0,$f_text);
$f_title = new InnerFiled();
$f_title->set_key("title");
$f_title->set_val($this->title);
$f_title->set_type(InnerFiled_Type::str);
$actionChain2->set_field(1,$f_title);
$f_logo = new InnerFiled();
$f_logo->set_key("logo");
$f_logo->set_val($this->logo);
$f_logo->set_type(InnerFiled_Type::str);
$actionChain2->set_field(2,$f_logo);
$f_logoURL = new InnerFiled();
$f_logoURL->set_key("logo_url");
$f_logoURL->set_val($this->logoURL);
$f_logoURL->set_type(InnerFiled_Type::str);
$actionChain2->set_field(3,$f_logoURL);
$f_notifyStyle = new InnerFiled();
$f_notifyStyle->set_key("notifyStyle");
$f_notifyStyle->set_val(strval($this->notifyStyle));
$f_notifyStyle->set_type(InnerFiled_Type::str);
$actionChain2->set_field(4,$f_notifyStyle);
$f_isRing = new InnerFiled();
$f_isRing->set_key("is_noring");
$f_isRing->set_val(!$this->isRing ? "true" : "false");
$f_isRing->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(5,$f_isRing);
$f_isVibrate = new InnerFiled();
$f_isVibrate->set_key("is_novibrate");
$f_isVibrate->set_val(!$this->isVibrate ? "true" : "false");
$f_isVibrate->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(6,$f_isVibrate);
$f_isClearable = new InnerFiled();
$f_isClearable->set_key("is_noclear");
$f_isClearable->set_val(!$this->isClearable ? "true" : "false");
$f_isClearable->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(7,$f_isClearable);
$actionChain2->set_next(10010);
//goto
$actionChain3 = new ActionChain();
$actionChain3->set_actionId(10010);
$actionChain3->set_type(ActionChain_Type::refer);
$actionChain3->set_next(10030);
//appStartUp
$appStartUp = new AppStartUp();
$appStartUp->set_android("");
$appStartUp->set_symbia("");
$appStartUp->set_ios("");
//启动app
$actionChain4 = new ActionChain();
$actionChain4->set_actionId(10030);
$actionChain4->set_type(ActionChain_Type::startapp);
$actionChain4->set_appid("");
$actionChain4->set_autostart($this->transmissionType == '1'? true : false);
$actionChain4->set_appstartupid($appStartUp);
$actionChain4->set_failedAction(100);
$actionChain4->set_next(100);
//结束
$actionChain5 = new ActionChain();
$actionChain5->set_actionId(100);
$actionChain5->set_type(ActionChain_Type::eoa);
array_push($actionChains, $actionChain1,$actionChain2,$actionChain3,$actionChain4,$actionChain5);
return $actionChains;
}
function get_transmissionContent() {
return $this->transmissionContent;
}
function get_pushType() {
return 'NotifyMsg';
}
function set_text($text) {
$this->text = $text;
}
function set_title($title) {
$this->title = $title;
}
function set_logo($logo) {
$this->logo = $logo;
}
function set_logoURL($logoURL) {
$this->logoURL = $logoURL;
}
function set_transmissionType($transmissionType) {
$this->transmissionType = $transmissionType;
}
function set_isRing($isRing) {
$this->isRing = $isRing;
}
function set_isVibrate($isVibrate) {
$this->isVibrate = $isVibrate;
}
function set_isClearable($isClearable) {
$this->isClearable = $isClearable;
}
function set_transmissionContent($transmissionContent) {
$this->transmissionContent = $transmissionContent;
}
function set_notifyStyle($notifyStyle) {
if($notifyStyle != 1){
$this->notifyStyle = 0;
} else {
$this->notifyStyle = 1;
}
}
}
\ No newline at end of file
<?php
class IGtNotyPopLoadTemplate extends IGtBaseTemplate {
/**
* 通知栏图标
*/
var $notyIcon;
/**
* 通知栏标题
*/
var $logoURL;
var $notyTitle;
/**
* 通知栏内容
*/
var $notyContent;
/**
* 通知是否可清楚
*/
var $isCleared = true;
/**
* 是否响铃
*/
var $isBelled = true;
/**
* 是否震动
*/
var $isVibrationed = true;
/**
* 弹框标题
*/
var $popTitle;
/**
* 弹框内容
*/
var $popContent;
/**
* 弹框图片
*/
var $popImage;
/**
* 左边按钮名称
*/
var $popButton1;
/**
* 右边按钮名称
*/
var $popButton2;
/**
* 下载图标
*/
var $loadIcon;
/**
* 下载标题
*/
var $loadTitle;
/**
* 下载地址
*/
var $loadUrl;
/**
* 是否自动安装
*/
var $isAutoInstall = false;
/**
* 是否激活
*/
var $isActived = false;
var $symbianMark="";
var $androidMark="";
var $iosMark="";
var $notifyStyle = 0;
public function getActionChain() {
$actionChains = array();
//设置actionchain
$actionChain1 = new ActionChain();
$actionChain1->set_actionId(1);
$actionChain1->set_type(ActionChain_Type::refer);
$actionChain1->set_next(10000);
//通知
$actionChain2 = new ActionChain();
$actionChain2->set_actionId(10000);
$actionChain2->set_type(ActionChain_Type::mmsinbox2);
$actionChain2->set_stype("notification");
$f_text = new InnerFiled();
$f_text->set_key("text");
$f_text->set_val($this->notyContent);
$f_text->set_type(InnerFiled_Type::str);
$actionChain2->set_field(0,$f_text);
$f_title = new InnerFiled();
$f_title->set_key("title");
$f_title->set_val($this->notyTitle);
$f_title->set_type(InnerFiled_Type::str);
$actionChain2->set_field(1,$f_title);
$f_logo = new InnerFiled();
$f_logo->set_key("logo");
$f_logo->set_val($this->notyIcon);
$f_logo->set_type(InnerFiled_Type::str);
$actionChain2->set_field(2,$f_logo);
$f_logoURL = new InnerFiled();
$f_logoURL->set_key("logo_url");
$f_logoURL->set_val($this->logoURL);
$f_logoURL->set_type(InnerFiled_Type::str);
$actionChain2->set_field(3,$f_logoURL);
$f_notifyStyle = new InnerFiled();
$f_notifyStyle->set_key("notifyStyle");
$f_notifyStyle->set_val(strval($this->notifyStyle));
$f_notifyStyle->set_type(InnerFiled_Type::str);
$actionChain2->set_field(4,$f_notifyStyle);
$f_isRing = new InnerFiled();
$f_isRing->set_key("is_noring");
$f_isRing->set_val(!$this->isBelled ? "true" : "false");
$f_isRing->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(5,$f_isRing);
$f_isVibrate = new InnerFiled();
$f_isVibrate->set_key("is_novibrate");
$f_isVibrate->set_val(!$this->isVibrationed ? "true" : "false");
$f_isVibrate->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(6,$f_isVibrate);
$f_isClearable = new InnerFiled();
$f_isClearable->set_key("is_noclear");
$f_isClearable->set_val(!$this->isCleared ? "true" : "false");
$f_isClearable->set_type(InnerFiled_Type::bool);
$actionChain2->set_field(7,$f_isClearable);
$actionChain2->set_next(10010);
$actionChain3 = new ActionChain();
$actionChain3->set_actionId(10010);
$actionChain3->set_type(ActionChain_Type::refer);
$actionChain3->set_next(10020);
//弹框按钮
$button1 = new Button();
$button1->set_text($this->popButton1);
$button1->set_next(10050);
$button2 = new Button();
$button2->set_text($this->popButton2);
$button2->set_next(100);
//弹框
$actionChain4 = new ActionChain();
$actionChain4->set_actionId(10020);
$actionChain4->set_type(ActionChain_Type::popup);
$actionChain4->set_title($this->popTitle);
$actionChain4->set_text($this->popContent);
$actionChain4->set_img($this->popImage);
$actionChain4->set_buttons(0,$button1);
$actionChain4->set_buttons(1,$button2);
$actionChain4->set_next(6);
//下载
//appstartupid
$appStartUp = new AppStartUp();
$appStartUp->set_android($this->androidMark);
$appStartUp->set_Ios($this->iosMark);
$appStartUp->set_symbia($this->symbianMark);
$actionChain5 = new ActionChain();
$actionChain5->set_actionId(10050);
$actionChain5->set_type(ActionChain_Type::appdownload);
$actionChain5->set_name($this->loadTitle);
$actionChain5->set_url($this->loadUrl);
$actionChain5->set_logo($this->loadIcon);
$actionChain5->set_autoInstall($this->isAutoInstall);
$actionChain5->set_autostart($this->isActived);
$actionChain5->set_appstartupid($appStartUp);
$actionChain5->set_next(6);
$actionChain6 = new ActionChain();
$actionChain6->set_actionId(100);
$actionChain6->set_type(ActionChain_Type::eoa);
array_push($actionChains, $actionChain1,$actionChain2,$actionChain3,$actionChain4,$actionChain5,$actionChain6);
return $actionChains;
}
function set_notyIcon($notyIcon) {
$this->notyIcon = $notyIcon;
}
function set_notyTitle($notyTitle) {
$this->notyTitle = $notyTitle;
}
function set_logoURL($logoURL) {
$this->logoURL = $logoURL;
}
function set_notyContent($notyContent) {
$this->notyContent = $notyContent;
}
function set_isCleared($isCleared) {
$this->isCleared = $isCleared;
}
function set_isBelled($isBelled) {
$this->isBelled = $isBelled;
}
function set_isVibrationed($isVibrationed) {
$this->isVibrationed = $isVibrationed;
}
function set_popTitle($popTitle) {
$this->popTitle = $popTitle;
}
function set_popContent($popContent) {
$this->popContent = $popContent;
}
function set_popImage($popImage) {
$this->popImage = $popImage;
}
function set_popButton1($popButton1) {
$this->popButton1 = $popButton1;
}
function set_popButton2($popButton2) {
$this->popButton2 = $popButton2;
}
function set_loadIcon($loadIcon) {
$this->loadIcon = $loadIcon;
}
function set_loadTitle($loadTitle) {
$this->loadTitle = $loadTitle;
}
function set_loadUrl($loadUrl) {
$this->loadUrl = $loadUrl;
}
function set_isAutoInstall($isAutoInstall) {
$this->isAutoInstall = $isAutoInstall;
}
function set_isActived($isActived) {
$this->isActived = $isActived;
}
function set_symbianMark($symbianMark){
$this->symbianMark = $symbianMark;
}
function set_androidMark($androidMark){
$this->androidMark = $androidMark;
}
function set_iosMark($iosMark){
$this->iosMark = $iosMark;
}
function get_pushType(){
return "NotyPopLoadTemplate";
}
function set_notifyStyle($notifyStyle) {
if($notifyStyle != 1){
$this->notifyStyle = 0;
} else {
$this->notifyStyle = 1;
}
}
}
\ No newline at end of file
<?php
class IGtTransmissionTemplate extends IGtBaseTemplate {
var $transmissionType;
var $transmissionContent;
public function getActionChain() {
$actionChains = array();
// 设置actionChain
$actionChain1 = new ActionChain();
$actionChain1->set_actionId(1);
$actionChain1->set_type(ActionChain_Type::refer);
$actionChain1->set_next(10030);
//appStartUp
$appStartUp = new AppStartUp();
$appStartUp->set_android("");
$appStartUp->set_symbia("");
$appStartUp->set_ios("");
//启动app
$actionChain2 = new ActionChain();
$actionChain2->set_actionId(10030);
$actionChain2->set_type(ActionChain_Type::startapp);
$actionChain2->set_appid("");
$actionChain2->set_autostart($this->transmissionType == '1'? true : false);
$actionChain2->set_appstartupid($appStartUp);
$actionChain2->set_failedAction(100);
$actionChain2->set_next(100);
//结束
$actionChain3 = new ActionChain();
$actionChain3->set_actionId(100);
$actionChain3->set_type(ActionChain_Type::eoa);
array_push($actionChains, $actionChain1,$actionChain2,$actionChain3);
return $actionChains;
}
function get_transmissionContent() {
return $this->transmissionContent;
}
function get_pushType() {
return 'TransmissionMsg';
}
function set_transmissionType($transmissionType) {
$this->transmissionType = $transmissionType;
}
function set_transmissionContent($transmissionContent) {
$this->transmissionContent = $transmissionContent;
}
function set3rdNotifyInfo($notify) {
if ($notify->get_title() == null || $notify -> get_content() == null) {
throw new Exception("notify title or content cannot be null");
}
$notifyInfo = new NotifyInfo();
$notifyInfo -> set_title($notify -> get_title());
$notifyInfo -> set_content($notify -> get_content());
$notifyInfo -> set_payload($notify -> get_payload());
$pushInfo = $this-> get_pushInfo();
$pushInfo -> set_notifyInfo($notifyInfo);
$pushInfo -> set_validNotify(true);
}
}
\ No newline at end of file
<?php
/**
* Class IGtNotify
*/
class IGtNotify {
/**
* 通知标题
* @var
*/
var $title;
/**
* 通知内容
* @var
*/
var $content;
/**
* 通知内容中携带的透传内容
* @var
*/
var $payload;
/**
* @return mixed
*/
public function get_title()
{
return $this->title;
}
/**
* @param mixed $title
*/
public function set_title($title)
{
$this->title = $title;
}
/**
* @return mixed
*/
public function get_content()
{
return $this->content;
}
/**
* @param mixed $content
*/
public function set_content($content)
{
$this->content = $content;
}
/**
* @return mixed
*/
public function get_payload()
{
return $this->payload;
}
/**
* @param mixed $payload
*/
public function set_payload($payload)
{
$this->payload = $payload;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-5-7
* Time: 下午2:15
*/
require_once(dirname(__FILE__) . '/' . 'HttpManager.php');
class ApiUrlRespectUtils
{
static $appkeyAndFasterHost = array();
static $appKeyAndHost = array();
static $appkeyAndLastExecuteTime = array();
public static function getFastest($appkey,$hosts)
{
if ($hosts == null || count($hosts)==0)
{
throw new Exception("Hosts cann't be null or size must greater than 0");
}
if(isset(ApiUrlRespectUtils::$appkeyAndFasterHost[$appkey]) && count(array_diff($hosts,isset(ApiUrlRespectUtils::$appKeyAndHost[$appkey])?ApiUrlRespectUtils::$appKeyAndHost[$appkey]:null)) == 0)
{
return ApiUrlRespectUtils::$appkeyAndFasterHost[$appkey];
}
else
{
$fastest = ApiUrlRespectUtils::getFastestRealTime($hosts);
ApiUrlRespectUtils::$appKeyAndHost[$appkey] = $hosts;
ApiUrlRespectUtils::$appkeyAndFasterHost[$appkey] = $fastest;
return $fastest;
}
}
public static function getFastestRealTime($hosts)
{
$mint=60.0;
$s_url="";
for ($i=0;$i<count($hosts);$i++)
{
$start = array_sum(explode(" ",microtime()));
try {
$homepage = HttpManager::httpHead($hosts[$i]);
} catch (Exception $e) {
echo($e);
}
$ends = array_sum(explode(" ",microtime()));
$diff=$ends-$start;
if ($mint > $diff)
{
$mint=$diff;
$s_url=$hosts[$i];
}
}
return $s_url;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 14-8-23
* Time: 下午4:56
*/
Class ApnsUtils
{
static function validatePayloadLength($locKey, $locArgs, $message, $actionLocKey, $launchImage, $badge, $sound, $payload,$contentAvailable)
{
$json = ApnsUtils :: processPayload($locKey, $locArgs, $message, $actionLocKey, $launchImage, $badge, $sound, $payload,$contentAvailable);
return strlen($json);
}
static function processPayload($locKey, $locArgs, $message, $actionLocKey, $launchImage, $badge, $sound, $payload, $contentAvailable)
{
$isValid = false;
$pb = new Payload();
if ($locKey != null && strlen($locKey) > 0) {
// loc-key
$pb->setAlertLocKey(($locKey));
// loc-args
if ($locArgs != null && strlen($locArgs) > 0) {
$pb->setAlertLocArgs(explode(',',($locArgs)));
}
$isValid = true;
}
// body
if ($message != null && strlen($message) > 0) {
$pb->setAlertBody(($message));
$isValid = true;
}
// action-loc-key
if ($actionLocKey!=null && strlen($actionLocKey) > 0) {
$pb->setAlertActionLocKey($actionLocKey);
}
// launch-image
if ($launchImage!=null && strlen($launchImage) > 0) {
$pb->setAlertLaunchImage($launchImage);
}
// badge
$badgeNum = -1;
if(is_numeric($badge)){
$badgeNum = (int)$badge;
}
if ($badgeNum >= 0) {
$pb->setBadge($badgeNum);
$isValid = true;
}
// sound
if ($sound != null && strlen($sound) > 0) {
$pb->setSound($sound);
} else {
$pb->setSound("default");
}
//contentAvailable
if ($contentAvailable == 1) {
$pb->setContentAvailable(1);
$isValid = true;
}
// payload
if ($payload != null && strlen($payload) > 0) {
$pb->addParam("payload", ($payload));
}
if($isValid == false){
throw new Exception("one of the params(locKey,message,badge) must not be null or contentAvailable must be 1");
}
$json = $pb->toString();
if($json == null){
throw new Exception("payload json is null");
}
return $json;
}
}
Class Payload
{
var $APS = "aps";
var $params;
var $alert;
var $badge;
var $sound = "";
var $alertBody;
var $alertActionLocKey;
var $alertLocKey;
var $alertLocArgs;
var $alertLaunchImage;
var $contentAvailable;
function getParams()
{
return $this->params;
}
function setParams($params)
{
$this->params = $params;
}
function addParam($key, $obj)
{
if ($this->params == null) {
$this->params = array();
}
if ($this->APS == strtolower($key)) {
throw new Exception("the key can't be aps");
}
$this->params[$key] = $obj;
}
function getAlert()
{
return $this->alert;
}
function setAlert($alert)
{
$this->alert = $alert;
}
function getBadge()
{
return $this->badge;
}
function setBadge($badge)
{
$this->badge = $badge;
}
function getSound()
{
return $this->sound;
}
function setSound($sound)
{
$this->sound = $sound;
}
function getAlertBody()
{
return $this->alertBody;
}
function setAlertBody($alertBody)
{
$this->alertBody = $alertBody;
}
function getAlertActionLocKey()
{
return $this->alertActionLocKey;
}
function setAlertActionLocKey($alertActionLocKey)
{
$this->alertActionLocKey = $alertActionLocKey;
}
function getAlertLocKey()
{
return $this->alertLocKey;
}
function setAlertLocKey($alertLocKey)
{
$this->alertLocKey = $alertLocKey;
}
function getAlertLaunchImage()
{
return $this->alertLaunchImage;
}
function setAlertLaunchImage($alertLaunchImage)
{
$this->alertLaunchImage = $alertLaunchImage;
}
function getAlertLocArgs()
{
return $this->alertLocArgs;
}
function setAlertLocArgs($alertLocArgs)
{
$this->alertLocArgs = $alertLocArgs;
}
function getContentAvailable()
{
return $this->contentAvailable;
}
function setContentAvailable($contentAvailable)
{
$this->contentAvailable = $contentAvailable;
}
function putIntoJson($key, $value, $obj)
{
if ($value != null) {
$obj[$key] = $value;
}
return $obj;
}
function toString()
{
$object = array();
$apsObj = array();
if ($this->getAlert() != null) {
$apsObj["alert"] = urlencode($this->getAlert());
} else {
if ($this->getAlertBody() != null || $this->getAlertLocKey() != null) {
$alertObj = array();
$alertObj = $this->putIntoJson("body", ($this->getAlertBody()), $alertObj);
$alertObj = $this->putIntoJson("action-loc-key", ($this->getAlertActionLocKey()), $alertObj);
$alertObj = $this->putIntoJson("loc-key", ($this->getAlertLocKey()), $alertObj);
$alertObj = $this->putIntoJson("launch-image", ($this->getAlertLaunchImage()), $alertObj);
if ($this->getAlertLocArgs() != null) {
$array = array();
foreach ($this->getAlertLocArgs() as $str) {
array_push($array, ($str));
}
$alertObj["loc-args"] = $array;
}
$apsObj["alert"] = $alertObj;
}
}
if ($this->getBadge() != null) {
$apsObj["badge"] = $this->getBadge();
}
// 判断是否静音
if ("com.gexin.ios.silence" != ($this->getSound())) {
$apsObj = $this->putIntoJson("sound", ($this->getSound()), $apsObj);
}
if($this->getContentAvailable() == 1){
$apsObj["content-available"]=1;
}
$object[$this->APS] = $apsObj;
if ($this->getParams() != null) {
foreach ($this->getParams() as $key => $value) {
$object[($key)] = ($value);
}
}
return Util::json_encode($object);
}
}
class Util
{
static function json_encode($input){
// 从 PHP 5.4.0 起, 增加了这个选项.
if(defined('JSON_UNESCAPED_UNICODE')){
return json_encode($input, JSON_UNESCAPED_UNICODE);
}
if(is_string($input)){
$text = $input;
$text = str_replace("\\", "\\\\", $text);
//$text = str_replace('/', "\\/", $text);
$text = str_replace('"', "\\".'"', $text);
$text = str_replace("\b", "\\b", $text);
$text = str_replace("\t", "\\t", $text);
$text = str_replace("\n", "\\n", $text);
$text = str_replace("\f", "\\f", $text);
$text = str_replace("\r", "\\r", $text);
//$text = str_replace("\u", "\\u", $text);
return '"' . $text . '"';
} else if(is_array($input) || is_object($input)) {
$arr = array();
$is_obj = is_object($input) || (array_keys($input) !== range(0, count($input) - 1));
foreach($input as $k=>$v){
if($is_obj){
$arr[] = self::json_encode($k) . ':' . self::json_encode($v);
}else{
$arr[] = self::json_encode($v);
}
}
if($is_obj){
return '{' . join(',', $arr) . '}';
}else{
return '[' . join(',', $arr) . ']';
}
}else{
return $input . '';
}
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Songmh
* Date: 2015/9/21
* Time: 21:54
*/
class OptType {
const _OR_ = 0;
const _AND_ = 1;
const _NOT_ = 2;
}
class AppConditions {
//手机类型
const PHONE_TYPE = "phoneType";
//地区
const REGION = "region";
//自定义tag
const TAG = "tag";
//条件
var $condition = array();
function __call ($name, $args )
{
if($name=='addCondition') {
switch (count($args)) {
case 2:
return call_user_func_array(array($this, 'addCondition2'), $args);
case 3:
return call_user_func_array(array($this, 'addCondition3'), $args);
}
}
}
function addCondition3($key, $values, $optType=0) {
$item = array();
$item["key"] = $key;
$item["values"] = $values;
$item["optType"] = $optType;
$this -> condition[] = $item;
return $this;
}
function addCondition2($key, $values) {
return $this->addCondition3($key, $values, 0);
}
function getCondition() {
return $this->condition;
}
}
?>
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-5-7
* Time: 下午2:15
*/
class GTConfig
{
public static function isPushSingleBatchAsync()
{
return "true" == GTConfig::getProperty("gexin_pushSingleBatch_needAsync", null, "false");
}
public static function isPushListAsync()
{
return "true" == GTConfig::getProperty("gexin_pushList_needAsync", null, "false");
}
public static function isPushListNeedDetails()
{
return "true" == GTConfig::getProperty("gexin_pushList_needDetails", "needDetails", "false");
}
public static function getHttpProxyIp()
{
return GTConfig::getProperty("gexin_http_proxy_ip", "gexin.rp.sdk.http.proxyHost");
}
public static function getHttpProxyPort()
{
return (int)GTConfig::getProperty("gexin_http_proxy_port", "gexin.rp.sdk.http.proxyPort", 80);
}
public static function getSyncListLimit()
{
return (int)GTConfig::getProperty("gexin_pushList_syncLimit", null, 1000);
}
public static function getAsyncListLimit()
{
return (int)GTConfig::getProperty("gexin_pushList_asyncLimit", null, 10000);
}
public static function getTagListLimit()
{
return (int)GTConfig::getProperty("gexin_tagList_limit", null, 10);
}
public static function getHttpConnectionTimeOut()
{
return (int)GTConfig::getProperty("gexin_http_connecton_timeout", "gexin.rp.sdk.http.connection.timeout", 60000);
}
public static function getHttpInspectInterval()
{
return (int)GTConfig::getProperty("gexin_inspect_interval", "gexin.rp.sdk.http.inspect.timeout", 300000);
}
public static function getHttpSoTimeOut()
{
return (int)GTConfig::getProperty("gexin_http_so_timeout", "gexin.rp.sdk.http.so.timeout", 30000);
}
public static function getHttpTryCount()
{
return (int)GTConfig::getProperty("gexin_http_tryCount", "gexin.rp.sdk.http.gexinTryCount", 3);
}
public static function getDefaultDomainUrl($useSSL)
{
$urlStr = GTConfig::getProperty("gexin_default_domainurl", null);
if ($urlStr == null || "".equals(trim($urlStr)))
{
if ($useSSL)
{
$hosts = array("https://cncapi.getui.com/serviceex","https://telapi.getui.com/serviceex",
"https://api.getui.com/serviceex","https://sdk1api.getui.com/serviceex",
"https://sdk2api.getui.com/serviceex","https://sdk3api.getui.com/serviceex");
}
else
{
$hosts = array("http://sdk.open.api.igexin.com/serviceex","http://sdk.open.api.gepush.com/serviceex",
"http://sdk.open.api.getui.net/serviceex","http://sdk1.open.api.igexin.com/serviceex",
"http://sdk2.open.api.igexin.com/serviceex","http://sdk3.open.api.igexin.com/serviceex");
}
}
else
{
$list = explode(",",$urlStr);
$hosts = array();
foreach ($list as $value)
{
if (strpos($value, "https://") === 0 && !$useSSL)
{
continue;
}
if (strpos($value, "http://") === 0 && $useSSL)
{
continue;
}
if ($useSSL && strpos($value, "http") != 0)
{
$value = "https://".$value;
}
array_push($hosts, $value);
}
}
return $hosts;
}
private static function getProperty($key, $oldKey, $defaultValue = null)
{
$value = getenv($key);
if($value != null)
{
return $value;
}
else
if($oldKey != null)
{
$value = getenv($oldKey);
}
if($value == null)
{
return $defaultValue;
}else
{
return $value;
}
}
public static function getSDKVersion()
{
return "4.0.1.7";
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-5-9
* Time: 下午3:12
*/
require_once(dirname(__FILE__) . '/' . 'LogUtils.php');
class HttpManager
{
static $curls = array();
private static function httpPost($url, $data, $gzip, $action)
{
if(!isset(HttpManager::$curls[$url])){
$curl = curl_init($url);
HttpManager::$curls[$url] = $curl;
}
$curl = HttpManager::$curls[$url];
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'GeTui PHP/1.0');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_FORBID_REUSE, 0);
curl_setopt($curl, CURLOPT_FRESH_CONNECT, 0);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, GTConfig::getHttpConnectionTimeOut());
curl_setopt($curl, CURLOPT_TIMEOUT_MS, GTConfig::getHttpSoTimeOut());
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
$header = array("Content-Type:text/html;charset=UTF-8", "Connection: Keep-Alive");
if ($gzip) {
$data = gzencode($data, 9);
array_push($header,'Accept-Encoding:gzip');
array_push($header,'Content-Encoding:gzip');
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
}
if(!is_null($action))
{
array_push($header,"Gt-Action:".$action);
}
curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$curl_version = curl_version();
if ($curl_version['version_number'] >= 462850) {
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 30000);
curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
}
//通过代理访问接口需要在此处配置代理
//curl_setopt($curl, CURLOPT_PROXY, '192.168.1.18:808');
//请求失败有3次重试机会
$result = HttpManager::exeBySetTimes(3, $curl);
//curl_close($curl);
return $result;
}
public static function httpHead($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'GeTui PHP/1.0');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD');
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, GTConfig::getHttpConnectionTimeOut());
curl_setopt($curl, CURLOPT_TIMEOUT_MS, GTConfig::getHttpSoTimeOut());
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_NOBODY, 1);
$header = array("Content-Type:text/html;charset=UTF-8");
curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
$curl_version = curl_version();
if ($curl_version['version_number'] >= 462850) {
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 30000);
curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
}
//通过代理访问接口需要在此处配置代理
//curl_setopt($curl, CURLOPT_PROXY, '192.168.1.18:808');
//请求失败有3次重试机会
$result = HttpManager::exeBySetTimes(3, $curl);
curl_close($curl);
return $result;
}
public static function httpPostJson($url, $params, $gzip)
{
if(!isset($params["version"]))
{
$params["version"] = GTConfig::getSDKVersion();
}
$action = $params["action"];
$data = json_encode($params);
$result = null;
try {
$resp = HttpManager::httpPost($url, $data, $gzip, $action);
//LogUtils::debug("发送请求 post:{$data} return:{$resp}");
$result = json_decode($resp, true);
return $result;
} catch (Exception $e) {
throw new RequestException($params["requestId"],"httpPost:[".$url."] [" .$data." ] [ ".$result."]:",$e);
}
}
private static function exeBySetTimes($count, $curl)
{
$result = curl_exec($curl);
$info = curl_getinfo($curl);
$code = $info["http_code"];
if (curl_errno($curl) != 0 && $code != 200) {
LogUtils::debug("request errno: ".curl_errno($curl).",url:".$info["url"]);
$count--;
if ($count > 0) {
$result = HttpManager::exeBySetTimes($count, $curl);
}
}
return $result;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-5-14
* Time: 上午9:36
*/
class LangUtils
{
private static $REGEX = '/^(?:(?!0000)[0-9]{4}(?:(?:0[1-9]|1[0-2])(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])(?:29|30)|(?:0[13578]|1[02])31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)0229)$/i';
public static function validateDate($date)
{
if($date == null)
{
return false;
}
if(!preg_match(LangUtils::$REGEX,$date))
{
return false;
}
return strtotime($date) < time();
}
public static function randomUUID() { //可以指定前缀
$str = md5(uniqid(mt_rand(), true));
$uuid = substr($str,0,8) . '-';
$uuid .= substr($str,8,4) . '-';
$uuid .= substr($str,12,4) . '-';
$uuid .= substr($str,16,4) . '-';
$uuid .= substr($str,20,12);
return $uuid;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 15-5-9
* Time: 下午3:17
*/
class LogUtils
{
static $debug = true;
public static function debug($log)
{
if (LogUtils::$debug)
echo date('y-m-d h:i:s',time()).($log) . "\r\n";
}
}
\ No newline at end of file
<?php
/**
* Base 128 varints - decodes and encodes base128 varints to/from decimal
* @author Nikolai Kordulla
*/
class base128varint
{
// modus for output
var $modus = 1;
/**
* @param int $modus - 1=Byte 2=String
*/
public function __construct($modus)
{
$this->modus = $modus;
}
/**
* @param $number - number as decimal
* Returns the base128 value of an dec value
*/
public function set_value($number)
{
$string = decbin($number);
if (strlen($string) < 8)
{
$hexstring = dechex(bindec($string));
if (strlen($hexstring) % 2 == 1)
$hexstring = '0' . $hexstring;
if ($this->modus == 1)
{
return $this->hex_to_str($hexstring);
}
return $hexstring;
}
// split it and insert the mb byte
$string_array = array();
$pre = '1';
while (strlen($string) > 0)
{
if (strlen($string) < 8)
{
$string = substr('00000000', 0, 7 - strlen($string) % 7) . $string;
$pre = '0';
}
$string_array[] = $pre . substr($string, strlen($string) - 7, 7);
$string = substr($string, 0, strlen($string) - 7);
$pre = '1';
if ($string == '0000000')
break;
}
$hexstring = '';
foreach ($string_array as $string)
{
$hexstring .= sprintf('%02X', bindec($string));
}
// now format to hexstring in the right format
if ($this->modus == 1)
{
return $this->hex_to_str($hexstring);
}
return $hexstring;
}
/**
* Returns the dec value of an base128
* @param string bstring
*/
public function get_value($string)
{
// now just drop the msb and reorder it + parse it in own string
$valuestring = '';
$string_length = strlen($string);
$i = 1;
while ($string_length > $i)
{
// unset msb string and reorder it
$valuestring = substr($string, $i, 7) . $valuestring;
$i += 8;
}
// now interprete it
return bindec($valuestring);
}
/**
* Converts hex 2 ascii
* @param String $hex - the hex string
*/
public function hex_to_str($hex)
{
$str = '';
for($i = 0; $i < strlen($hex); $i += 2)
{
$str .= chr(hexdec(substr($hex, $i, 2)));
}
return $str;
}
}
?>
<?php
/**
* Including of all files needed to parse messages
* @author Nikolai Kordulla
*/
require_once(dirname(__FILE__). '/' . 'encoding/pb_base128.php');
require_once(dirname(__FILE__). '/' . 'type/pb_scalar.php');
require_once(dirname(__FILE__). '/' . 'type/pb_enum.php');
require_once(dirname(__FILE__). '/' . 'type/pb_bytes.php');
require_once(dirname(__FILE__). '/' . 'type/pb_string.php');
require_once(dirname(__FILE__). '/' . 'type/pb_int.php');
require_once(dirname(__FILE__). '/' . 'type/pb_bool.php');
require_once(dirname(__FILE__). '/' . 'type/pb_signed_int.php');
require_once(dirname(__FILE__). '/' . 'reader/pb_input_reader.php');
require_once(dirname(__FILE__). '/' . 'reader/pb_input_string_reader.php');
/**
* Abstract Message class
* @author Nikolai Kordulla
*/
abstract class PBMessage
{
const WIRED_VARINT = 0;
const WIRED_64BIT = 1;
const WIRED_LENGTH_DELIMITED = 2;
const WIRED_START_GROUP = 3;
const WIRED_END_GROUP = 4;
const WIRED_32BIT = 5;
var $base128;
// here are the field types
var $fields = array();
// the values for the fields
var $values = array();
// type of the class
var $wired_type = 2;
// the value of a class
var $value = null;
// modus byte or string parse (byte for productive string for better reading and debuging)
// 1 = byte, 2 = String
const MODUS = 1;
// now use pointer for speed improvement
// pointer to begin
protected $reader;
// chunk which the class not understands
var $chunk = '';
// variable for Send method
var $_d_string = '';
/**
* Constructor - initialize base128 class
*/
public function __construct($reader=null)
{
$this->reader = $reader;
$this->value = $this;
$this->base128 = new base128varint(PBMessage::MODUS);
}
/**
* Get the wired_type and field_type
* @param $number as decimal
* @return array wired_type, field_type
*/
public function get_types($number)
{
$binstring = decbin($number);
$types = array();
$low = substr($binstring, strlen($binstring) - 3, strlen($binstring));
$high = substr($binstring,0, strlen($binstring) - 3) . '0000';
$types['wired'] = bindec($low);
$types['field'] = bindec($binstring) >> 3;
return $types;
}
/**
* Encodes a Message
* @return string the encoded message
*/
public function SerializeToString($rec=-1)
{
$string = '';
// wired and type
if ($rec > -1)
{
$string .= $this->base128->set_value($rec << 3 | $this->wired_type);
}
$stringinner = '';
foreach ($this->fields as $index => $field)
{
if (is_array($this->values[$index]) && count($this->values[$index]) > 0)
{
// make serialization for every array
foreach ($this->values[$index] as $array)
{
$newstring = '';
$newstring .= $array->SerializeToString($index);
$stringinner .= $newstring;
}
}
else if ($this->values[$index] != null)
{
// wired and type
$newstring = '';
$newstring .= $this->values[$index]->SerializeToString($index);
$stringinner .= $newstring;
}
}
$this->_serialize_chunk($stringinner);
if ($this->wired_type == PBMessage::WIRED_LENGTH_DELIMITED && $rec > -1)
{
$stringinner = $this->base128->set_value(strlen($stringinner) / PBMessage::MODUS) . $stringinner;
}
return $string . $stringinner;
}
/**
* Serializes the chunk
* @param String $stringinner - String where to append the chunk
*/
public function _serialize_chunk(&$stringinner)
{
$stringinner .= $this->chunk;
}
/**
* Decodes a Message and Built its things
*
* @param message as stream of hex example '1a 03 08 96 01'
*/
public function ParseFromString($message)
{
$this->reader = new PBInputStringReader($message);
$this->_ParseFromArray();
}
/**
* Internal function
*/
public function ParseFromArray()
{
$this->chunk = '';
// read the length byte
$length = $this->reader->next();
// just take the splice from this array
$this->_ParseFromArray($length);
}
/**
* Internal function
*/
private function _ParseFromArray($length=99999999)
{
$_begin = $this->reader->get_pointer();
while ($this->reader->get_pointer() - $_begin < $length)
{
$next = $this->reader->next();
if ($next === false)
break;
// now get the message type
$messtypes = $this->get_types($next);
// now make method test
if (!isset($this->fields[$messtypes['field']]))
{
// field is unknown so just ignore it
// throw new Exception('Field ' . $messtypes['field'] . ' not present ');
if ($messtypes['wired'] == PBMessage::WIRED_LENGTH_DELIMITED)
{
$consume = new PBString($this->reader);
}
else if ($messtypes['wired'] == PBMessage::WIRED_VARINT)
{
$consume = new PBInt($this->reader);
}
else
{
throw new Exception('I dont understand this wired code:' . $messtypes['wired']);
}
// perhaps send a warning out
// @TODO SEND CHUNK WARNING
$_oldpointer = $this->reader->get_pointer();
$consume->ParseFromArray();
// now add array from _oldpointer to pointer to the chunk array
$this->chunk .= $this->reader->get_message_from($_oldpointer);
continue;
}
// now array or not
if (is_array($this->values[$messtypes['field']]))
{
$this->values[$messtypes['field']][] = new $this->fields[$messtypes['field']]($this->reader);
$index = count($this->values[$messtypes['field']]) - 1;
if ($messtypes['wired'] != $this->values[$messtypes['field']][$index]->wired_type)
{
throw new Exception('Expected type:' . $messtypes['wired'] . ' but had ' . $this->fields[$messtypes['field']]->wired_type);
}
$this->values[$messtypes['field']][$index]->ParseFromArray();
}
else
{
$this->values[$messtypes['field']] = new $this->fields[$messtypes['field']]($this->reader);
if ($messtypes['wired'] != $this->values[$messtypes['field']]->wired_type)
{
throw new Exception('Expected type:' . $messtypes['wired'] . ' but had ' . $this->fields[$messtypes['field']]->wired_type);
}
$this->values[$messtypes['field']]->ParseFromArray();
}
}
}
/**
* Add an array value
* @param int - index of the field
*/
protected function _add_arr_value($index)
{
return $this->values[$index][] = new $this->fields[$index]();
}
/**
* Set an array value - @TODO failure check
* @param int - index of the field
* @param int - index of the array
* @param object - the value
*/
protected function _set_arr_value($index, $index_arr, $value)
{
$this->values[$index][$index_arr] = $value;
}
/**
* Remove the last array value
* @param int - index of the field
*/
protected function _remove_last_arr_value($index)
{
array_pop($this->values[$index]);
}
/**
* Set an value
* @param int - index of the field
* @param Mixed value
*/
protected function _set_value($index, $value)
{
if (gettype($value) == 'object')
{
$this->values[$index] = $value;
}
else
{
$this->values[$index] = new $this->fields[$index]();
$this->values[$index]->value = $value;
}
}
/**
* Get a value
* @param id of the field
*/
protected function _get_value($index)
{
if ($this->values[$index] == null)
return null;
return $this->values[$index]->value;
}
/**
* Get array value
* @param id of the field
* @param value
*/
protected function _get_arr_value($index, $value)
{
return $this->values[$index][$value];
}
/**
* Get array size
* @param id of the field
*/
protected function _get_arr_size($index)
{
return count($this->values[$index]);
}
/**
* Helper method for send string
*/
protected function _save_string($ch, $string)
{
$this->_d_string .= $string;
$content_length = strlen($this->_d_string);
return strlen($string);
}
/**
* Sends the message via post request ['message'] to the url
* @param the url
* @param the PBMessage class where the request should be encoded
*
* @return String - the return string from the request to the url
*/
public function Send($url, &$class = null)
{
$ch = curl_init();
$this->_d_string = '';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_WRITEFUNCTION, array($this, '_save_string'));
curl_setopt($ch, CURLOPT_POSTFIELDS, 'message=' . urlencode($this->SerializeToString()));
$result = curl_exec($ch);
if ($class != null)
$class->parseFromString($this->_d_string);
return $this->_d_string;
}
/**
* Fix Memory Leaks with Objects in PHP 5
* http://paul-m-jones.com/?p=262
*
* thanks to cheton
* http://code.google.com/p/pb4php/issues/detail?id=3&can=1
*/
public function _destruct()
{
if (isset($this->reader))
{
unset($this->reader);
}
if (isset($this->value))
{
unset($this->value);
}
// base128
if (isset($this->base128))
{
unset($this->base128);
}
// fields
if (isset($this->fields))
{
foreach ($this->fields as $name => $value)
{
unset($this->$name);
}
unset($this->fields);
}
// values
if (isset($this->values))
{
foreach ($this->values as $name => $value)
{
if (is_array($value))
{
foreach ($value as $name2 => $value2)
{
if (is_object($value2) AND method_exists($value2, '__destruct'))
{
$value2->__destruct();
}
unset($value2);
}
if (isset($name2))
unset($value->$name2);
}
else
{
if (is_object($value) AND method_exists($value, '__destruct'))
{
$value->__destruct();
}
unset($value);
}
unset($this->values->$name);
}
unset($this->values);
}
}
}
?>
<?php
/**
* Abstract class for an input reader
*/
abstract class PBInputReader
{
protected $base128;
protected $pointer = 0;
protected $string = '';
public function __construct()
{
$this->base128 = new base128varint(1);
}
/**
* Gets the acutal position of the point
* @return int the pointer
*/
public function get_pointer()
{
return $this->pointer;
}
/**
* Add add to the pointer
* @param int $add - int to add to the pointer
*/
public function add_pointer($add)
{
$this->pointer += $add;
}
/**
* Get the message from from to actual pointer
* @param from
*/
public function get_message_from($from)
{
return substr($this->string, $from, $this->pointer - $from);
}
/**
* Getting the next varint as decimal number
* @return varint
*/
public abstract function next();
}
?>
<?php
/**
* Reads string input
*/
class PBInputStringReader extends PBInputReader
{
var $length = 0;
public function __construct($string)
{
parent::__construct();
$this->string = $string;
$this->length = strlen($string);
}
/**
* get the next
* @param boolean $is_string - if set to true only one byte is read
*/
public function next($is_string = false)
{
$package = '';
while (true)
{
if ($this->pointer >= $this->length)
{
return false;
}
$string = '';
$string = $this->string[$this->pointer];
$this->pointer++;
if ($is_string == true)
return ord($string);
$value = decbin(ord($string));
if ($value >= 10000000 && $is_string == false)
{
// now fill to eight with 00
$package .= $value;
}
else
{
// now fill to length of eight with 0
$value = substr('00000000', 0, 8 - strlen($value) % 8) . $value;
return $this->base128->get_value($package . $value);
}
}
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBBool extends PBInt
{
var $wired_type = PBMessage::WIRED_VARINT;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
$this->value = $this->reader->next();
$this->value = ($this->value != 0) ? 1 : 0;
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBBytes extends PBScalar
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
$this->value = '';
// first byte is length
$length = $this->reader->next();
// just extract the string
$pointer = $this->reader->get_pointer();
$this->reader->add_pointer($length);
$this->value = $this->reader->get_message_from($pointer);
}
/**
* Serializes type
*/
public function SerializeToString($rec = -1)
{
$string = '';
if ($rec > -1)
{
$string .= $this->base128->set_value($rec << 3 | $this->wired_type);
}
$string .= $this->base128->set_value(strlen($this->value));
$string .= $this->value;
return $string;
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBEnum extends PBScalar
{
var $wired_type = PBMessage::WIRED_VARINT;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
$this->value = $this->reader->next();
}
/**
* Serializes type
*/
public function SerializeToString($rec=-1)
{
$string = '';
if ($rec > -1)
{
$string .= $this->base128->set_value($rec << 3 | $this->wired_type);
}
$value = $this->base128->set_value($this->value);
$string .= $value;
return $string;
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBInt extends PBScalar
{
var $wired_type = PBMessage::WIRED_VARINT;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
$this->value = $this->reader->next();
}
/**
* Serializes type
*/
public function SerializeToString($rec=-1)
{
// first byte is length byte
$string = '';
if ($rec > -1)
{
$string .= $this->base128->set_value($rec << 3 | $this->wired_type);
}
$value = $this->base128->set_value($this->value);
$string .= $value;
return $string;
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBScalar extends PBMessage
{
/**
* Set scalar value
*/
public function set_value($value)
{
$this->value = $value;
}
/**
* Get the scalar value
*/
public function get_value()
{
return $this->value;
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBSignedInt extends PBScalar
{
var $wired_type = PBMessage::WIRED_VARINT;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
parent::ParseFromArray();
$saved = $this->value;
$this->value = round($this->value / 2);
if ($saved % 2 == 1)
{
$this->value = -($this->value);
}
}
/**
* Serializes type
*/
public function SerializeToString($rec=-1)
{
// now convert signed int to int
$save = $this->value;
if ($this->value < 0)
{
$this->value = abs($this->value)*2-1;
}
else
{
$this->value = $this->value*2;
}
$string = parent::SerializeToString($rec);
// restore value
$this->value = $save;
return $string;
}
}
?>
<?php
/**
* @author Nikolai Kordulla
*/
class PBString extends PBScalar
{
var $wired_type = PBMessage::WIRED_LENGTH_DELIMITED;
/**
* Parses the message for this type
*
* @param array
*/
public function ParseFromArray()
{
$this->value = '';
// first byte is length
$length = $this->reader->next();
// just extract the string
$pointer = $this->reader->get_pointer();
$this->reader->add_pointer($length);
$this->value = $this->reader->get_message_from($pointer);
}
/**
* Serializes type
*/
public function SerializeToString($rec = -1)
{
$string = '';
if ($rec > -1)
{
$string .= $this->base128->set_value($rec << 3 | $this->wired_type);
}
$string .= $this->base128->set_value(strlen($this->value));
$string .= $this->value;
return $string;
}
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment