|
@@ -183,6 +183,41 @@ class RoomController extends Controller {
|
|
|
this.ctx.ok({ data });
|
|
|
}
|
|
|
|
|
|
+ // 解散房间
|
|
|
+ async dismissroom() {
|
|
|
+ // 调用解散房间接口
|
|
|
+ // 取得公共参数头
|
|
|
+ const SecretId = 'AKIDCAtWu3GhY9VbQzJgfOq4QVJq8AxWi3Sa';
|
|
|
+ const SecretKey = '3sRknnwoOhlY4JH2Wjf6VeYCdnhKr88z';
|
|
|
+ // 导入对应产品模块的client models。
|
|
|
+ const TrtcClient = tencentcloud.trtc.v20190722.Client;
|
|
|
+ const models = tencentcloud.trtc.v20190722.Models;
|
|
|
+
|
|
|
+ const Credential = tencentcloud.common.Credential;
|
|
|
+ const ClientProfile = tencentcloud.common.ClientProfile;
|
|
|
+ const HttpProfile = tencentcloud.common.HttpProfile;
|
|
|
+
|
|
|
+ const cred = new Credential(SecretId, SecretKey);
|
|
|
+ const httpProfile = new HttpProfile();
|
|
|
+ httpProfile.endpoint = 'trtc.tencentcloudapi.com';
|
|
|
+ const clientProfile = new ClientProfile();
|
|
|
+ clientProfile.httpProfile = httpProfile;
|
|
|
+ const client = new TrtcClient(cred, 'ap-beijing', clientProfile);
|
|
|
+ const req = new models.DismissRoomRequest();
|
|
|
+
|
|
|
+ const params = {};
|
|
|
+ params.SdkAppId = this.app.config.sdkappid;
|
|
|
+ params.RoomId = this.ctx.query.roomname;
|
|
|
+ req.from_json_string(JSON.stringify(params));
|
|
|
+ client.DismissRoom(req, function(errMsg, response) {
|
|
|
+ if (errMsg) {
|
|
|
+ console.log(errMsg);
|
|
|
+ }
|
|
|
+ console.log(response.to_json_string());
|
|
|
+ });
|
|
|
+ this.ctx.ok({ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
module.exports = CrudController(RoomController, meta);
|