diff --git a/uniCloud/cloudfunctions/uni-im-co/msg.js b/uniCloud/cloudfunctions/uni-im-co/msg.js index 678a3d36fa8ff606d76d5a2f9c0f353c66524de6..7fb55088455f5c215c0a1ebfafa3c49b5c641bce 100644 --- a/uniCloud/cloudfunctions/uni-im-co/msg.js +++ b/uniCloud/cloudfunctions/uni-im-co/msg.js @@ -290,16 +290,14 @@ async function _checkConversationGrade({ }) { // 客服模式下,如果配置的客服 id。则只能向客服发起会话 let chatToCustomerService = async () => { - const customer_service_uids = uniImConfig.config('customer_service_uids_uids') - if (customer_service_uids) { - if (typeof customer_service_uids == 'string') { - customer_service_uids = [customer_service_uids] - } - if ( - !(customer_service_uids.includes(from_uid) || customer_service_uids.includes(to_uid)) - ) { - throw new Error('非法通讯,会话双方用户 id,均不属于 uni-im-co 中配置的 customer_service_uids') - } + const customer_service_uids = uniImConfig.config('customer_service_uids') || [] + if (typeof customer_service_uids == 'string') { + customer_service_uids = [customer_service_uids] + } + if ( + !(customer_service_uids.includes(from_uid) || customer_service_uids.includes(to_uid)) + ) { + throw new Error('非法通讯,会话双方用户 id,均不属于 uni-im-co 中配置的 customer_service_uids') } return true }