fix: 后台加人审计按实际插入数避免全跳过记成 ok
This commit is contained in:
+4
-2
@@ -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>> {
|
||||
|
||||
Reference in New Issue
Block a user