fcc-core
Version:
Fusion communication center.
89 lines (87 loc) • 3.05 kB
JavaScript
export default async function (xw, params) {
await xw.validate(params, {
'ISVIDEO': { type: 'string', required: true }, // 是否开启摄像头
'ACCESSCODE': { type: 'string', required: true } // 会议接入码
})
return new Promise((resolve, reject) => {
console.log(xw.userInfo)
xw.ajaxRequest([{
service: 'E2601332',
ACCESS_CODE: params.ACCESSCODE
}]).then(data => {
if (data.code === '0') {
if (data.data.length === 0) {
reject(new xw.BaseException(424, '会议号不存在'))
} else {
console.log('到这里1')
var ID = data.data[0].MEETING_ID
xw.exe.emit('JoinConf', {
// 调用exe加入会议接口
resId: xw.userInfo.ICP_CODE,
isVideo: params.ISVIDEO,
confId: ID,
password: '',
accessCode: params.ACCESSCODE
})
// xw.exe.once('JoinConf', res => {
// if (res.resultCode === 0) {
xw.exe.once('OnJoinConf', res => {
if (res.resultCode === 0) {
resolve()
let req = [
{
service: 'E2601331',
ACCESS_CODE: params.ACCESSCODE,
OBJ_TYPE: '2', // 参会对象类型, 1-设备 2-用户 3-通讯录
OBJ_ID: xw.userInfo.USER_CODE, // 参会对象ID
OBJ_NAME: xw.userInfo.USER_NAME, // 参会对象名称
PART_DEV: params.PART_DEV, // 入会方式, 3-语音入会 4-视频入会
PART_SNO: xw.userInfo.ICP_CODE// 会场标识
}
]
xw.ajaxRequest(req).then((res) => {
console.log(res)
if (+res.code === 0) {
resolve()
}
})
} else {
reject(new xw.BaseException(424, '加入会议失败'))
}
})
// } else {
// reject(new xw.BaseException(424, '客户端加入会议失败'))
// }
// })
}
} else {
reject(new xw.BaseException(424, '加入会议失败'))
}
})
// xw.exe.emit('JoinConf', {
// // 调用exe加入会议接口
// resId: params.resId,
// isVideo: params.isVideo,
// confId: params.confId,
// password: params.password,
// accessCode: params.accessCode
// })
// const timer = setTimeout(() => {
// reject(new xw.BaseException(562))
// }, xw.timeout)
// xw.exe.once('JoinConf', data => {
// if (data.resultCode === 0) {
// xw.exe.once('JoinConf', res => {
// if (res.resultCode === 0) {
// clearTimeout(timer)
// resolve()
// } else {
// reject(new xw.BaseException(561))
// }
// })
// } else {
// reject(new xw.BaseException(561))
// }
// })
})
}