/*----Tags Example----*/ try { //获取当前应用的所有标签列表 $result = $client->getTags(); $payload = $result->body; echo '<b>getTags</b>' . $br; echo 'Tags:' . json_encode($payload['tags']) . $br; echo $br; } catch (APIRequestException $e) { printAPIRequestErrorStack($e); } catch (APIConnectionException $e) { printAPIConnectionErrorStack($e); } try { //查询某个用户是否在tag下 $result = $client->isDeviceInTag($REGISTRATION_ID1, $TAG1); $payload = $result->body; echo '<b>isDeviceInTag</b>' . $br; echo 'isDeviceInTag:' . json_encode($payload['result']) . $br; echo $br; } catch (APIRequestException $e) { printAPIRequestErrorStack($e); } catch (APIConnectionException $e) { printAPIConnectionErrorStack($e); } try { //对指定tag添加或者删除registrationId $result = $client->updateTagDevices($TAG1, array($REGISTRATION_ID1), array($REGISTRATION_ID2)); echo '<b>updateTagDevices</b>' . $br; if ($result->isOk) { echo 'Update Tag Devices Success' . $br;
function testIsDeviceInTag() { $client = new JPushClient($this->appKey, $this->masterSecret); $result = $client->isDeviceInTag($this->REGISTRATION_ID1, $this->TAG1); $this->assertTrue($result->isOk === true); }