UNPKG

fcc-core

Version:

Fusion communication center.

165 lines (157 loc) 4.57 kB
// 前提规则--呼叫前状态判断 export const validateStatus = (xw, sendUserInfo) => { let returnVal = 0 // 不能呼叫自己 if (sendUserInfo.USER_CODE === xw.userInfo.USER_CODE) { // throw new BaseException(416) returnVal = 416 } // 没有ICp_code if (!sendUserInfo.ICP_CODE) { // throw new BaseException(403) returnVal = 403 } // 主叫状态 let myState = xw.agentState ? parseInt(xw.agentState, 10) : 3 switch (myState) { case 2: // throw new BaseException(414) returnVal = 414 break case 3: // throw new BaseException(415) returnVal = 415 break } // 呼叫用户的状态 // let toState = xw.memberStatus[sendUserInfo.USER_CODE] || '3' // // let toState = '1' // if (toState === '2') { // // throw new BaseException(412) // returnVal = 412 // } else if (toState === '3') { // // throw new BaseException(411) // returnVal = 411 // } return returnVal } /** * 通过账号获取用户信息 */ export const getUserInfoByAccount = async (param, xw) => { const localParams = { service: 'E1201402', isHttp: true } let result = await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => { if (res.code === '0') { return res.data[0] } else { return {} } }) return result } // 时间格式化 export const formatDate = function (date, valueFormat) { let o = { 'M+': date.getMonth() + 1, // 月份 'd+': date.getDate(), // 日 'H+': date.getHours(), // 小时 'm+': date.getMinutes(), // 分 's+': date.getSeconds(), // 秒 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度 'S': date.getMilliseconds() // 毫秒 } if (/(y+)/.test(valueFormat)) { valueFormat = valueFormat.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)) } for (let k in o) { if (new RegExp('(' + k + ')').test(valueFormat)) { valueFormat = valueFormat.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) } } return valueFormat } // 修改agentstate export const changeEmployeeICPStatus = async (state, xw) => { xw.agentState = state } // 新增通话记录流水 export const addPhoneCallRecord = async (param, xw) => { const localParams = { service: 'E2802101' } let id = await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => { if (res.code === '0') { return res.data[0].ID } else { return '' } }) return id } /* * 新增话务操作流水 */ export const addOPTRecord = async (param, xw) => { const localParams = { service: 'E2801101' } let id = await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => { if (res.code === '0') { return res.data[0].ID } return '' }) return id } // 修改话务操作流水 export const changeOPTRecord = async (trafficCode, param, xw) => { const localParams = { service: 'E2801301', OPT_SNO: trafficCode } await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => {}) } // 修改通话记录流水 export const changePhoneCallRecord = async (phoneCallCode, param, xw) => { const localParams = { service: 'E2802301', CALL_SNO: phoneCallCode } await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => {}) } // 新增监控流水 export const addMonitorRecord = async (param, xw) => { const localParams = { service: 'E2803101' } let id = await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => { if (res.code === '0') { return res.data[0].ID } else { return '' } }) return id } // 修改监控记录流水 export const changeMonitorRecord = async (monitorSno, param, xw) => { const localParams = { service: 'E2803301', MONITOR_SNO: monitorSno } await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => {}) } // 新增监控截屏流水 export const addMonitorRecordSnapShot = async (param, xw) => { const localParams = { service: 'E2804101' } await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => {}) } // 修改监控截屏流水 export const changeMonitorRecordSnapShot = async (SNO, param, xw) => { const localParams = { service: 'E2804301', SNO: SNO } await xw.ajaxRequest([Object.assign(localParams, param)]).then(res => {}) }