fix: 后台加人审计按实际插入数避免全跳过记成 ok

This commit is contained in:
Nixevol
2026-09-30 19:18:48 +08:00
parent f936a6b312
commit b9b88f1bfd
6 changed files with 143 additions and 13 deletions
+4 -2
View File
@@ -691,13 +691,14 @@ export const mockApi = {
return {};
},
async addGroupMembers(id: string, memberIds: string[]): Promise<{ failed: GroupFailed[] }> {
async addGroupMembers(id: string, memberIds: string[]): Promise<{ failed: GroupFailed[]; added: number }> {
requireSession();
const g = groups.find((x) => x.id === id);
if (!g) {
throw new ApiError("not_found", "群不存在", 404);
}
const failed: GroupFailed[] = [];
let added = 0;
for (const mid of memberIds) {
if (!endpoints.some((e) => e.id === mid)) {
failed.push({ id: mid, code: "not_found" });
@@ -705,9 +706,10 @@ export const mockApi = {
}
if (!g.members.some((m) => m.id === mid)) {
g.members.push({ id: mid, joined_at_ms: now() });
added++;
}
}
return { failed };
return { failed, added };
},
async removeGroupMember(id: string, endpointId: string): Promise<Record<string, never>> {