Skip to content

Commit 93be358

Browse files
committed
1. FIX codeBeat
1 parent 46b7203 commit 93be358

File tree

8 files changed

+48
-16
lines changed

8 files changed

+48
-16
lines changed

src/main/java/com/qiniu/rtc/QRTC.java

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,51 @@ public static QRTCClient init(String accessKey, String secretKey, String appId)
5353
/**
5454
* 创建app
5555
*
56-
* @param appParam
56+
* @param appParam APP创建参数
5757
* @return
5858
* @throws QiniuException
5959
*/
6060
public static QRTCResult<AppResult> createApp(AppParam appParam, String accessKey, String secretKey) throws QiniuException {
6161
Response response = null;
6262
try {
63-
AppService appService = new AppService(Auth.create(accessKey, secretKey));
64-
response = appService.createApp(appParam);
65-
if (null == response || StringUtils.isNullOrEmpty(response.bodyString())) {
66-
return QRTCResult.fail(-1, "result is null");
67-
}
68-
AppResult t = Json.decode(response.bodyString(), AppResult.class);
69-
return QRTCResult.success(response.statusCode, t);
63+
response = fetchCreateApp(appParam, accessKey, secretKey);
64+
return formatCreateAppResult(response);
7065
} finally {
7166
// 释放资源
7267
if (response != null) response.close();
7368
}
7469
}
7570

71+
/**
72+
* 结果格式化
73+
*
74+
* @param response
75+
* @return
76+
* @throws QiniuException
77+
*/
78+
private static QRTCResult<AppResult> formatCreateAppResult(Response response) throws QiniuException {
79+
if (null == response || StringUtils.isNullOrEmpty(response.bodyString())) {
80+
return QRTCResult.fail(-1, "result is null");
81+
}
82+
AppResult t = Json.decode(response.bodyString(), AppResult.class);
83+
return QRTCResult.success(response.statusCode, t);
84+
}
85+
86+
/**
87+
* 创建请求处理
88+
*
89+
* @param appParam
90+
* @param accessKey
91+
* @param secretKey
92+
* @return
93+
* @throws QiniuException
94+
*/
95+
private static Response fetchCreateApp(AppParam appParam, String accessKey, String secretKey) throws QiniuException {
96+
AppService appService = new AppService(Auth.create(accessKey, secretKey));
97+
return appService.createApp(appParam);
98+
}
99+
100+
76101
/**
77102
* 根据appId 获取当前的client
78103
*

src/main/java/com/qiniu/rtc/RtcAppManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ public Response updateApp(String appId, String hub, String title, int maxUsers,
121121
return client.post(url, body, headers, Client.JsonMime);
122122
}
123123

124-
}
124+
}

src/main/java/com/qiniu/rtc/RtcRoomManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ public String getRoomToken(String appId, String roomName, String userId,
9999
return auth.signRoomToken(json);
100100
}
101101

102-
}
102+
}

src/main/java/com/qiniu/rtc/model/AppResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class AppResult {
1111
private int maxUsers;
1212
private boolean noAutoKickUser;
1313
private String createdAt;
14-
private String UpdatedAt;
14+
private String updatedAt;
1515
private String error;
1616
private String status;
1717

src/main/java/com/qiniu/rtc/model/ForwardResult.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
@Data
66
public class ForwardResult {
7+
/**
8+
* 单路转推状态
9+
*/
710
private String status;
8-
private String id;//forward id
11+
/**
12+
* 单路转推ID
13+
*/
14+
private String id;
915
}

src/main/java/com/qiniu/rtc/model/MergeTrackParam.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ public static class MergeTrack {
2121
private String stretchMode;
2222
private boolean supportSei = false;
2323
}
24-
}
24+
}

src/main/java/com/qiniu/rtc/service/CallbackService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ public CallbackService(Auth auth) {
3030
* @throws QiniuException
3131
*/
3232
public Response setHttpCallback(String appId, CallbackParam param) throws QiniuException {
33-
if (null == param || StringUtils.isNullOrEmpty(param.getEventCbUrl()) ||
34-
StringUtils.isNullOrEmpty(param.getEventCbSecret())) {
33+
if (null == param
34+
|| StringUtils.isNullOrEmpty(param.getEventCbUrl())
35+
|| StringUtils.isNullOrEmpty(param.getEventCbSecret())) {
3536
throw new IllegalArgumentException("CallbackParam cannot be null...");
3637
}
3738
param.setEventCbVersion("1");

src/main/java/com/qiniu/rtc/service/MergeService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Response updateMergeWatermarks(WatermarksParam watermarksParam, UrlParam
6969
* @throws QiniuException
7070
*/
7171
public Response stopMergeJob(String appId, String roomName, String jobId) throws QiniuException {
72-
String urlPattern = "/v3/apps/<appID>/rooms/<roomName>/merge_job/<jobID>";
72+
String urlPattern = "/v3/apps/%s/rooms/%s/merge_job/%s";
7373
return deleteCall(null, urlPattern, appId, roomName, jobId);
7474
}
7575

0 commit comments

Comments
 (0)