!758 【功能完善】商城: 客服 WebSocket 消息统一 json 化

Merge pull request !758 from puhui999/dev
This commit is contained in:
芋道源码 2025-04-01 11:19:52 +00:00 committed by Gitee
commit 0d51ef707a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 6 deletions

View File

@ -503,8 +503,8 @@ export function jsonParse(str: string) {
try {
return JSON.parse(str)
} catch (e) {
console.error(`str[${str}] 不是一个 JSON 字符串`)
return ''
console.warn(`str[${str}] 不是一个 JSON 字符串`)
return str
}
}

View File

@ -16,7 +16,6 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
import { getRefreshToken } from '@/utils/auth'
import { useWebSocket } from '@vueuse/core'
import { useMallKefuStore } from '@/store/modules/mall/kefu'
import { jsonParse } from '@/utils'
defineOptions({ name: 'KeFu' })
@ -66,7 +65,8 @@ watch(
// 2.3 KEFU_MESSAGE_ADMIN_READ
if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) {
//
kefuStore.updateConversationStatus(jsonParse(jsonMessage.content))
const message = JSON.parse(jsonMessage.content)
kefuStore.updateConversationStatus(message.conversationId)
}
} catch (error) {
console.error(error)