function test_deleteMessage($userId, $msgIds) { $apiKey = $this->apiKey; $secretKey = $this->secretKey; $channel = new Channel($apiKey, $secretKey); // $optional [ Channel::CHANNEL_ID ] = 4152049051604943232; $ret = $channel->deleteMessage($userId, $msgIds, $optional); 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)); } }
/** * 删除离线消息 */ public static function deleteMessage($paramArr) { $options = array('apiKey' => '', 'secretKey' => '', 'userId' => '', 'msgIdArr' => array(), 'channelId' => ''); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); $channel = new Channel($apiKey, $secretKey); //$optional 可选参数,支持的可选参数包括: $optional = array(); if ($channelId) { $optional[Channel::CHANNEL_ID] = $channelId; } $msgIds = json_encode($msgIdArr); $ret = $channel->deleteMessage($userId, $msgIds, $optional); return $ret; }