Skip to content

Commit 798b44b

Browse files
committed
fix(contacts): 修复资料面板读取错误数据源
- 新增单联系人资料接口 /api/chat/contacts/profile - realtime 优先读取 wcdb_get_contact,失败后查询 contact/stranger 表 - 前端资料卡改为按 username 拉取单联系人资料,不再拉全量联系人列表匹配 - 解析 extra_buffer 的 blob/hex/base64 形态,返回昵称、微信号、地区、签名和来源 - 补充群成员和非联系人列表资料读取回归测试
1 parent 4bc5764 commit 798b44b

4 files changed

Lines changed: 457 additions & 14 deletions

File tree

frontend/composables/chat/useChatMessages.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,15 +1032,12 @@ export const useChatMessages = ({
10321032
contactProfileLoading.value = true
10331033
contactProfileError.value = ''
10341034
try {
1035-
const response = await api.listChatContacts({
1035+
const response = await api.getChatContactProfile({
10361036
account,
10371037
source: DEFAULT_CHAT_SOURCE,
1038-
include_friends: true,
1039-
include_groups: true,
1040-
include_officials: true
1038+
username
10411039
})
1042-
const list = Array.isArray(response?.contacts) ? response.contacts : []
1043-
const matched = list.find((item) => String(item?.username || '').trim() === username)
1040+
const matched = response?.contact && typeof response.contact === 'object' ? response.contact : null
10441041
if (matched) {
10451042
const normalized = { ...matched, username }
10461043
if (!String(normalized.displayName || '').trim() && displayNameFallback) {

frontend/composables/useApi.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,15 @@ export const useApi = () => {
514514
return await request(url)
515515
}
516516

517+
const getChatContactProfile = async (params = {}) => {
518+
const query = new URLSearchParams()
519+
if (params && params.account) query.set('account', params.account)
520+
if (params && params.source) query.set('source', params.source)
521+
if (params && params.username) query.set('username', params.username)
522+
const url = '/chat/contacts/profile' + (query.toString() ? `?${query.toString()}` : '')
523+
return await request(url)
524+
}
525+
517526
const exportChatContacts = async (payload = {}) => {
518527
return await request('/chat/contacts/export', {
519528
method: 'POST',
@@ -728,6 +737,7 @@ export const useApi = () => {
728737
getSnsExport,
729738
cancelSnsExport,
730739
listChatContacts,
740+
getChatContactProfile,
731741
exportChatContacts,
732742
createAccountArchiveExport,
733743
getAccountArchiveExport,

0 commit comments

Comments
 (0)