微信号的好友列表

This commit is contained in:
柳清爽
2025-04-03 10:12:02 +08:00
parent bb44a51f33
commit 170192c7a3
5 changed files with 527 additions and 262 deletions

View File

@@ -204,4 +204,39 @@ const mapRestrictionType = (type: string): "friend_limit" | "marketing" | "spam"
};
return typeMap[type] || 'other';
};
};
/**
* 获取微信好友列表
* @param wechatId 微信账号ID
* @param page 页码
* @param limit 每页数量
* @param keyword 搜索关键词
* @returns 好友列表数据
*/
export const fetchWechatFriends = async (
wechatId: string | number,
page: number = 1,
limit: number = 20,
keyword: string = ""
): Promise<{ code: number; msg: string; data: any }> => {
try {
const params = new URLSearchParams({
wechatId: String(wechatId),
page: String(page),
limit: String(limit)
});
if (keyword) {
params.append('keyword', keyword);
}
const url = `/v1/device/wechats/friends?${params.toString()}`;
const response = await api.get<{ code: number; msg: string; data: any }>(url);
return response;
} catch (error) {
console.error('获取微信好友列表失败:', error);
throw error;
}
}