本文整理汇总了PHP中Channel::getRequestId方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::getRequestId方法的具体用法?PHP Channel::getRequestId怎么用?PHP Channel::getRequestId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::getRequestId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_pushMessage_ios
private function test_pushMessage_ios($user_id, $body)
{
$channel = new Channel($this->apiKey, $this->secretKey);
$push_type = 1;
//推送单播消息
$optional[Channel::USER_ID] = $user_id;
//如果推送单播消息,需要指定user
//指定发到ios设备
$optional[Channel::DEVICE_TYPE] = 4;
//指定消息类型为通知
$optional[Channel::MESSAGE_TYPE] = 1;
//如果ios应用当前部署状态为开发状态,指定DEPLOY_STATUS为1,默认是生产状态,值为2.
//旧版本曾采用不同的域名区分部署状态,仍然支持。
$optional[Channel::DEPLOY_STATUS] = 2;
//通知类型的内容必须按指定内容发送,示例如下:
// $message = '{
// "aps":{
// "alert":"msg from baidu push",
// "sound":"",
// "badge":0
// }
// }';
$message_key = "msg_key";
$ret = $channel->pushMessage($push_type, $body, $message_key, $optional);
file_put_contents("/tmp/test.log", '########$bodyaps=' . $body . '#######' . "\n", FILE_APPEND);
file_put_contents("/tmp/test.log", '########$ret=' . json_encode($ret) . '#######' . "\n", FILE_APPEND);
if (false === $ret) {
file_put_contents("/tmp/test.log", '########WRONG, ' . __FUNCTION__ . ' ERROR!!!!!#######' . "\n", FILE_APPEND);
file_put_contents("/tmp/test.log", '########ERROR NUMBER: ' . $channel->errno() . '#######' . "\n", FILE_APPEND);
file_put_contents("/tmp/test.log", '########ERROR MESSAGE: ' . $channel->errmsg() . '#######' . "\n", FILE_APPEND);
file_put_contents("/tmp/test.log", '########REQUEST ID: ' . $channel->getRequestId() . '#######' . "\n", FILE_APPEND);
return false;
} else {
//right_output ( 'SUCC, ' . __FUNCTION__ . ' OK!!!!!' ) ;
//right_output ( 'result: ' . print_r ( $ret, true ) ) ;
return TRUE;
}
}
示例2: test_deleteAppIoscert
function test_deleteAppIoscert()
{
global $apiKey;
global $secretKey;
$channel = new Channel($apiKey, $secretKey);
//如果ios应用当前部署状态为开发状态,指定DEPLOY_STATUS为1,默认是生产状态,值为2.
//旧版本曾采用不同的域名区分部署状态,仍然支持。
//$optional[Channel::DEPLOY_STATUS] = 1;
$ret = $channel->deleteAppIoscert();
if (false === $ret) {
error_output('WRONG, ' . __FUNCTION__ . ' ERROR!!!!');
error_output('ERROR NUMBER: ' . $channel->errno());
error_output('ERROR MESSAGE: ' . $channel->errmsg());
error_output('REQUEST ID: ' . $channel->getRequestId());
} else {
right_output('SUCC, ' . __FUNCTION__ . ' OK!!!!!');
right_output('result: ' . print_r($ret, true));
}
}
示例3: Channel
function test_deleteAppIoscert()
{
$apiKey = $this->apiKey;
$secretKey = $this->secretKey;
$channel = new Channel($apiKey, $secretKey);
$ret = $channel->deleteAppIoscert();
if (false === $ret) {
error_output('WRONG, ' . __FUNCTION__ . ' ERROR!!!!');
error_output('ERROR NUMBER: ' . $channel->errno());
error_output('ERROR MESSAGE: ' . $channel->errmsg());
error_output('REQUEST ID: ' . $channel->getRequestId());
} else {
right_output('SUCC, ' . __FUNCTION__ . ' OK!!!!!');
right_output('result: ' . print_r($ret, true));
}
}
示例4: setTagWithPrefix
/**
* 设定用户的推送时间,使用TAG来标记,默认0-24 意味着全天可接受
* @param string $p_buserid 用户推送ID,百度里是buserid
* @param bool $ispushallowed 是否接受推送
* @param integer $pushhourstart 推送开始时间0-23
* @param integer $pushhourend 推送结束时间1-24
*/
public static function setTagWithPrefix($p_buserid, $p_tags = array(), $p_prefix = null)
{
$rets = array();
$channel = new Channel(W2PUSH::$API_KEY, W2PUSH::$SECRET_KEY);
if (isset($p_prefix) && strlen($p_prefix) > 0) {
$tagsList = $channel->queryUserTags($p_buserid);
$optional[Channel::USER_ID] = $p_buserid;
if (is_array($tagsList) && array_key_exists('response_params', $tagsList) && array_key_exists('tags', $tagsList['response_params'])) {
foreach ($tagsList['response_params']['tags'] as $tag) {
if (strpos($tag['name'], $p_prefix) === 0) {
$ret = $channel->deleteTag($tag['name'], $optional);
if (false === $ret) {
$rets[] = array('WRONG' => __FUNCTION__ . ' ERROR!!!!', 'ERROR NUMBER' => $channel->errno(), 'ERROR MESSAGE' => $channel->errmsg(), 'REQUEST ID' => $channel->getRequestId());
} else {
$rets[] = array('SUCC' => __FUNCTION__ . ' OK!!!!!', 'result' => print_r($ret, true));
}
}
}
}
}
$countSucc = 0;
$countWrong = 0;
if (isset($p_tags)) {
$p_tags = is_array($p_tags) ? $p_tags : explode(',', $p_tags);
foreach ($p_tags as $tarName) {
$ret = $channel->setTag($tarName, $optional);
if (false === $ret) {
$countWrong++;
$rets[] = array('WRONG' => __FUNCTION__ . ' ERROR!!!!', 'ERROR NUMBER' => $channel->errno(), 'ERROR MESSAGE' => $channel->errmsg(), 'REQUEST ID' => $channel->getRequestId());
} else {
$countSucc++;
$rets[] = array('SUCC' => __FUNCTION__ . ' OK!!!!!', 'result' => print_r($ret, true));
}
}
}
return array('countSucc' => $countSucc, 'countWrong' => $countWrong, 'rets' => $rets);
}