Skip to content

Commit cd02fa6

Browse files
committed
fix the code error
1 parent d2ed225 commit cd02fa6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/rtc/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- [x] 创建房间: client->createApp()
77
- [x] 查看房间: client->getApp()
88
- [x] 删除房间: client->deleteApp()
9-
- [x] 生成房间token: client->AppToken()
9+
- [x] 生成房间token: client->appToken()
1010

1111

1212

@@ -32,7 +32,7 @@
3232
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
3333
$sk = "xxxx";
3434
$auth = new Auth($ak, $sk);
35-
$client = new QiniuRtc\AppClient($auth);
35+
$client = new Qiniu\Rtc\AppClient($auth);
3636
$resp=$client->createApp("901","testApp");
3737
print_r($resp);
3838
```
@@ -43,7 +43,7 @@ print_r($resp);
4343
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
4444
$sk = "xxxx";
4545
$auth = new Auth($ak, $sk);
46-
$client = new QiniuRtc\AppClient($auth);
46+
$client = new Qiniu\Rtc\AppClient($auth);
4747
$resp=$client->getApp("deq02uhb6");
4848
print_r($resp);
4949
```
@@ -54,7 +54,7 @@ print_r($resp);
5454
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
5555
$sk = "xxxx";
5656
$auth = new Auth($ak, $sk);
57-
$client = new QiniuRtc\AppClient($auth);
57+
$client = new Qiniu\Rtc\AppClient($auth);
5858
$resp=$client->deleteApp("deq02uhb6");
5959
print_r($resp);
6060
```
@@ -65,7 +65,7 @@ print_r($resp);
6565
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
6666
$sk = "xxxx";
6767
$auth = new Auth($ak, $sk);
68-
$client = new QiniuRtc\AppClient($auth);
68+
$client = new Qiniu\Rtc\AppClient($auth);
6969
$resp=$client->appToken("deq02uhb6", "lfx", '1111', (time()+3600), 'user');
7070
print_r($resp);
7171
```

src/Qiniu/Rtc/AppClient.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function listActiveRooms($appId, $prefix = null, $offset = null, $limit =
138138
if (isset($limit)) {
139139
$query['limit'] = $limit;
140140
}
141-
if ($query != null) {
141+
if (isset($query) && !empty($query)) {
142142
$query = '?' . http_build_query($query);
143143
$url = sprintf("%s/%s/rooms%s", $this->baseURL, $appId, $query);
144144
} else {
@@ -170,7 +170,7 @@ public function appToken($appId, $roomName, $userId, $expireAt, $permission)
170170

171171
private function get($url, $cType = null)
172172
{
173-
$rtcToken = $this->auth->authorizationV2($url, "GET", $body, $cType);
173+
$rtcToken = $this->auth->authorizationV2($url, "GET", null, $cType);
174174
$rtcToken['Content-Type'] = $cType;
175175
$ret = Client::get($url, $rtcToken);
176176
if (!$ret->ok()) {
@@ -179,21 +179,21 @@ private function get($url, $cType = null)
179179
return array($ret->json(), null);
180180
}
181181

182-
private function delete($url, $cType = 'application/json')
182+
private function delete($url, $contentType = 'application/json')
183183
{
184-
$rtcToken = $this->auth->authorizationV2($url, "DELETE", $body, $cType);
185-
$rtcToken['Content-Type'] = $cType;
184+
$rtcToken = $this->auth->authorizationV2($url, "DELETE", null, $contentType);
185+
$rtcToken['Content-Type'] = $contentType;
186186
$ret = Client::delete($url, $rtcToken);
187187
if (!$ret->ok()) {
188188
return array(null, new Error($url, $ret));
189189
}
190190
return array($ret->json(), null);
191191
}
192192

193-
private function post($url, $body, $cType = 'application/json')
193+
private function post($url, $body, $contentType = 'application/json')
194194
{
195-
$rtcToken = $this->auth->authorizationV2($url, "POST", $body, $cType);
196-
$rtcToken['Content-Type'] = $cType;
195+
$rtcToken = $this->auth->authorizationV2($url, "POST", $body, $contentType);
196+
$rtcToken['Content-Type'] = $contentType;
197197
$ret = Client::post($url, $body, $rtcToken);
198198
if (!$ret->ok()) {
199199
return array(null, new Error($url, $ret));

0 commit comments

Comments
 (0)