function test_verifyBind($userId) { $apiKey = $this->apiKey; $secretKey = $this->secretKey; $channel = new Channel($apiKey, $secretKey); // $optional [ Channel::CHANNEL_ID ] = 2484515682371722163; $ret = $channel->verifyBind($userId, $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)); } }
/** * 判断设备、应用、用户与Channel的绑定关系是否存在 * @param type $paramArr */ public static function verifyBind($paramArr) { $options = array('apiKey' => '', 'secretKey' => '', 'userId' => '', 'channelId' => '', 'deviceType' => ''); if (is_array($paramArr)) { $options = array_merge($options, $paramArr); } extract($options); //用户标识 必填 if (!$userId) { return false; } $channel = new Channel($apiKey, $secretKey); //$optional 可选参数,支持的可选参数包括: $optional = array(); if ($channelId) { $optional[Channel::CHANNEL_ID] = $channelId; } if ($deviceType) { $optional[Channel::DEVICE_TYPE] = $deviceType; } $ret = $channel->verifyBind($userId, $optional); return $ret; }