feat: expand superadmin user detail views

This commit is contained in:
2026-01-15 12:29:52 +08:00
parent 8419ddede7
commit bec984b959
10 changed files with 2874 additions and 12 deletions

View File

@@ -117,5 +117,68 @@ export const UserService = {
total: data?.total ?? 0,
items: normalizeItems(data?.items)
};
},
async getUserRealName(userID) {
if (!userID) throw new Error('userID is required');
return requestJson(`/super/v1/users/${userID}/realname`);
},
async listUserNotifications(userID, { page, limit, tenant_id, type, read, created_at_from, created_at_to } = {}) {
if (!userID) throw new Error('userID is required');
const iso = (d) => {
if (!d) return undefined;
const date = d instanceof Date ? d : new Date(d);
if (Number.isNaN(date.getTime())) return undefined;
return date.toISOString();
};
const query = {
page,
limit,
tenant_id,
type,
read,
created_at_from: iso(created_at_from),
created_at_to: iso(created_at_to)
};
const data = await requestJson(`/super/v1/users/${userID}/notifications`, { query });
return {
page: data?.page ?? page ?? 1,
limit: data?.limit ?? limit ?? 10,
total: data?.total ?? 0,
items: normalizeItems(data?.items)
};
},
async listUserCoupons(userID, { page, limit, tenant_id, tenant_code, tenant_name, status, type, keyword, created_at_from, created_at_to } = {}) {
if (!userID) throw new Error('userID is required');
const iso = (d) => {
if (!d) return undefined;
const date = d instanceof Date ? d : new Date(d);
if (Number.isNaN(date.getTime())) return undefined;
return date.toISOString();
};
const query = {
page,
limit,
tenant_id,
tenant_code,
tenant_name,
status,
type,
keyword,
created_at_from: iso(created_at_from),
created_at_to: iso(created_at_to)
};
const data = await requestJson(`/super/v1/users/${userID}/coupons`, { query });
return {
page: data?.page ?? page ?? 1,
limit: data?.limit ?? limit ?? 10,
total: data?.total ?? 0,
items: normalizeItems(data?.items)
};
}
};