function test_fetchMessage($userId) { $apiKey = $this->apiKey; $secretKey = $this->secretKey; $channel = new Channel($apiKey, $secretKey); $ret = $channel->fetchMessage($userId); 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)); } }
/** * 查询离线消息 * @param type $paramArr */ public static function fetchMessage($paramArr) { $options = array('apiKey' => '', 'secretKey' => '', 'userId' => '', 'channelId' => '', 'star' => 0, 'limit' => 10); 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; } if ($star) { $optional[Channel::START] = $star; } if ($limit) { $optional[Channel::LIMIT] = $limit; } $ret = $channel->fetchMessage($userId, $optional); return $ret; }