@agent-xy/admin-vue3 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ import type { FormItemConfig } from "@agent-xy/admin-vue3";
2
+ import { buildFormItems } from "@agent-xy/admin-vue3";
3
+ import type { MemberFilters, Option } from "../types";
4
+ import { adStatusOptions, subscriptionStatusOptions } from "./data";
5
+ export const initialValues: MemberFilters = { site_id: [], search: "" };
6
+ export function searchFields(
7
+ sites: Option[],
8
+ countries: Option[],
9
+ subscriptions: Option[],
10
+ loading: { sites: boolean; countries: boolean; subscriptions: boolean },
11
+ onOpen: Record<
12
+ "sites" | "countries" | "subscriptions",
13
+ (open: boolean) => void
14
+ >,
15
+ ): FormItemConfig<MemberFilters>[] {
16
+ return buildFormItems<MemberFilters>([
17
+ {
18
+ propName: "subscription_status",
19
+ itemType: "selectOne",
20
+ labelName: "订阅状态",
21
+ optionsArr: subscriptionStatusOptions,
22
+ },
23
+ {
24
+ propName: "site_id",
25
+ itemType: "selectOne",
26
+ multiple: true,
27
+ labelName: "所属站点",
28
+ optionsArr: sites,
29
+ filterable: true,
30
+ controlProps: { loading: loading.sites, onVisibleChange: onOpen.sites },
31
+ },
32
+ {
33
+ propName: "subscribe_type",
34
+ itemType: "selectOne",
35
+ labelName: "订阅类型",
36
+ optionsArr: subscriptions,
37
+ controlProps: {
38
+ loading: loading.subscriptions,
39
+ onVisibleChange: onOpen.subscriptions,
40
+ },
41
+ },
42
+ {
43
+ propName: "country_name",
44
+ itemType: "selectOne",
45
+ labelName: "国家",
46
+ filterable: true,
47
+ controlProps: {
48
+ loading: loading.countries,
49
+ onVisibleChange: onOpen.countries,
50
+ },
51
+ optionsArr: countries.map((item) => ({
52
+ ...item,
53
+ value: String(item.value),
54
+ })),
55
+ },
56
+ {
57
+ propName: "ad_show_status",
58
+ itemType: "selectOne",
59
+ labelName: "广告状态",
60
+ optionsArr: adStatusOptions,
61
+ },
62
+ {
63
+ propName: "search",
64
+ itemType: "text",
65
+ labelName: "邮箱 / UID",
66
+ width: 240,
67
+ },
68
+ ]);
69
+ }
@@ -0,0 +1,22 @@
1
+ import type { Country } from "./types";
2
+
3
+ export const countryOptions: { label: string; value: Country }[] = [
4
+ { label: "中国香港", value: "HK" },
5
+ { label: "美国", value: "US" },
6
+ { label: "英国", value: "GB" },
7
+ { label: "日本", value: "JP" },
8
+ { label: "新加坡", value: "SG" },
9
+ { label: "中国台湾", value: "TW" },
10
+ ];
11
+
12
+ export const subscriptionStatusOptions = [
13
+ { label: "未订阅", value: 0 },
14
+ { label: "订阅中", value: 1 },
15
+ { label: "退订", value: 2 },
16
+ { label: "重试", value: 3 },
17
+ ];
18
+
19
+ export const adStatusOptions = [
20
+ { label: "关闭广告", value: 1 },
21
+ { label: "打开广告", value: 2 },
22
+ ];
@@ -0,0 +1,34 @@
1
+ import { ref, shallowRef, watchEffect } from "vue";
2
+
3
+ /** 实体变化时清空旧详情;同一实体刷新时保留已加载内容。 */
4
+ export function useRemoteResource<Data>(
5
+ load: (signal: AbortSignal) => Promise<Data>,
6
+ ) {
7
+ const data = shallowRef<Data>(),
8
+ error = shallowRef<Error>();
9
+ const loading = ref(true);
10
+ let request: AbortController | undefined;
11
+ async function run(preserve: boolean) {
12
+ request?.abort();
13
+ const current = new AbortController();
14
+ request = current;
15
+ loading.value = true;
16
+ error.value = undefined;
17
+ if (!preserve) data.value = undefined;
18
+ try {
19
+ const value = await load(current.signal);
20
+ if (!current.signal.aborted) data.value = value;
21
+ } catch (reason) {
22
+ if (!current.signal.aborted)
23
+ error.value =
24
+ reason instanceof Error ? reason : new Error(String(reason));
25
+ } finally {
26
+ if (!current.signal.aborted) loading.value = false;
27
+ }
28
+ }
29
+ watchEffect((onCleanup) => {
30
+ void run(false);
31
+ onCleanup(() => request?.abort());
32
+ });
33
+ return { data, error, loading, reload: () => run(true) };
34
+ }
@@ -0,0 +1,41 @@
1
+ .users-page {
2
+ display: grid;
3
+ grid-template-columns: minmax(0, 1fr);
4
+ gap: 16px;
5
+ min-width: 0;
6
+ padding: 16px;
7
+ box-sizing: border-box;
8
+
9
+ h1 {
10
+ margin: 0;
11
+ font-size: 18px;
12
+ }
13
+
14
+ .user-actions {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: 8px;
18
+ white-space: nowrap;
19
+ }
20
+
21
+ :deep(.base-card) {
22
+ margin-bottom: 0;
23
+ }
24
+
25
+ :deep(.base-card__body) {
26
+ padding: 16px 0;
27
+ }
28
+
29
+ :deep(.ai-code-copy) {
30
+ border: 0;
31
+ background: transparent;
32
+ color: var(--el-color-primary);
33
+ padding: 0;
34
+ font: inherit;
35
+ cursor: pointer;
36
+
37
+ &:hover {
38
+ text-decoration: underline;
39
+ }
40
+ }
41
+ }
@@ -1,21 +1,273 @@
1
1
  <template>
2
- <UsersList v-if="source" :source="source" />
3
- <section v-else class="admin-users" aria-labelledby="users-setup-title">
4
- <h1 id="users-setup-title">用户管理</h1>
5
- <p role="status">尚未接入用户数据源。请在本页面的 data-source.ts 中接入项目请求层。</p>
6
- </section>
7
- </template>
2
+ <main ref="pageElement" class="users-page">
3
+ <BaseCard>
4
+ <template #title>
5
+ <h1>用户管理</h1>
6
+ </template>
7
+ <SearchForm
8
+ :form-header="fields"
9
+ :form-model="initialValues"
10
+ :loading="loading"
11
+ @submit-form="handleSearch"
12
+ @reset-form="handleReset"
13
+ />
14
+ </BaseCard>
15
+
16
+ <section aria-label="用户列表">
17
+ <BaseCard>
18
+ <DataTable
19
+ row-key="uuid"
20
+ :table-columns="columns"
21
+ :table-data="tableData"
22
+ :loading="loading"
23
+ table-height="440"
24
+ :page-params="pageParams"
25
+ @handle-current-change="handlePageChange"
26
+ @handle-size-change="handleSizeChange"
27
+ >
28
+ <template #toolbar>
29
+ <ElButton
30
+ v-bind="{ 'data-users-refresh': '' }"
31
+ :disabled="disabled"
32
+ @click="getData"
33
+ >
34
+ 刷新
35
+ </ElButton>
36
+ </template>
37
+ <template #operation="{ row }">
38
+ <div class="user-actions">
39
+ <ElButton
40
+ v-bind="{ 'data-user-id': row.uuid, 'data-user-action': 'duration' }"
41
+ size="small"
42
+ :disabled="disabled"
43
+ @click="openDuration(row.uuid)"
44
+ >
45
+ 增加订阅时长
46
+ </ElButton>
47
+ <ElDropdown
48
+ :disabled="disabled"
49
+ trigger="click"
50
+ @command="(key: string) => handleCommand(key, row)"
51
+ >
52
+ <ElButton
53
+ v-bind="{ 'data-user-id': row.uuid, 'data-user-action': 'more' }"
54
+ size="small"
55
+ type="primary"
56
+ :disabled="disabled"
57
+ >
58
+ 更多操作
59
+ </ElButton>
60
+ <template #dropdown>
61
+ <ElDropdownMenu>
62
+ <ElDropdownItem
63
+ v-for="item in memberCommands(row)"
64
+ :key="item.key"
65
+ :command="item.key"
66
+ :disabled="item.disabled"
67
+ >
68
+ {{ item.label }}
69
+ </ElDropdownItem>
70
+ </ElDropdownMenu>
71
+ </template>
72
+ </ElDropdown>
73
+ </div>
74
+ </template>
75
+ </DataTable>
76
+ </BaseCard>
77
+ </section>
8
78
 
79
+ <AddExpireTime
80
+ v-if="durationUser"
81
+ :key="durationUser"
82
+ :uuid="durationUser"
83
+ :on-refresh="getData"
84
+ @close="closeAction"
85
+ />
86
+ <RenewalDiscount
87
+ v-if="discountUser"
88
+ :key="discountUser"
89
+ :uuid="discountUser"
90
+ :on-refresh="getData"
91
+ @close="closeAction"
92
+ />
93
+ </main>
94
+ </template>
9
95
  <script setup lang="ts">
10
- import { computed } from 'vue';
11
- import 'element-plus/dist/index.css';
12
- import '@agent-xy/admin-vue3/style.css';
13
- import './style.css';
14
- import UsersList from './UsersList.vue';
15
- import { usersDataSource } from './data-source';
16
- import type { UsersDataSource } from './types';
96
+ import "element-plus/dist/index.css";
97
+ import "@agent-xy/admin-vue3/style.css";
98
+ import { computed, nextTick, onMounted, reactive, ref, watch } from "vue";
99
+ import {
100
+ ElButton,
101
+ ElDropdown,
102
+ ElDropdownItem,
103
+ ElDropdownMenu,
104
+ ElMessage,
105
+ } from "element-plus";
106
+ import {
107
+ BaseCard,
108
+ SearchForm,
109
+ DataTable,
110
+ usePageList,
111
+ useSelectOptions,
112
+ isAbortError,
113
+ useAsyncListAction,
114
+ } from "@agent-xy/admin-vue3";
115
+ import { api } from "./api";
116
+ import type { Member, MemberAction, MemberFilters } from "./types";
117
+ import {
118
+ createColumns,
119
+ initialValues,
120
+ searchFields,
121
+ memberCommands,
122
+ isMemberCommand,
123
+ type MemberCommand,
124
+ } from "./config";
125
+ import AddExpireTime from "./components/AddExpireTime.vue";
126
+ import RenewalDiscount from "./components/RenewalDiscount.vue";
17
127
 
18
- // 示例通过属性提供数据源;业务项目也可以直接编辑 data-source.ts。
19
- const props = defineProps<{ source?: UsersDataSource }>();
20
- const source = computed(() => props.source ?? usersDataSource);
128
+ type Query = { page: number; page_size: number; filters: MemberFilters };
129
+ const initialQuery: Query = { page: 1, page_size: 20, filters: initialValues };
130
+ const query = reactive({ ...initialQuery });
131
+ const {
132
+ tableData,
133
+ loading,
134
+ pageParams,
135
+ getData,
136
+ onSubmit,
137
+ reset,
138
+ handlePageChange,
139
+ handleSizeChange,
140
+ } = usePageList<Query, Member>(query, {
141
+ initialQuery,
142
+ fetchList: api.members.list,
143
+ onError: () => ElMessage.error("用户列表加载失败"),
144
+ });
145
+ const sites = useSelectOptions(
146
+ (signal) => api.members.options("sites", signal),
147
+ (row) => row,
148
+ );
149
+ const countries = useSelectOptions(
150
+ (signal) => api.members.options("countries", signal),
151
+ (row) => row,
152
+ );
153
+ const subscriptions = useSelectOptions(
154
+ (signal) => api.members.options("subscriptions", signal),
155
+ (row) => row,
156
+ );
157
+ const fields = computed(() =>
158
+ searchFields(
159
+ sites.options.value,
160
+ countries.options.value,
161
+ subscriptions.options.value,
162
+ {
163
+ sites: sites.loading.value,
164
+ countries: countries.loading.value,
165
+ subscriptions: subscriptions.loading.value,
166
+ },
167
+ {
168
+ sites: (open) => {
169
+ if (open && sites.error.value && !sites.loading.value)
170
+ void sites.reload();
171
+ },
172
+ countries: (open) => {
173
+ if (open && countries.error.value && !countries.loading.value)
174
+ void countries.reload();
175
+ },
176
+ subscriptions: (open) => {
177
+ if (open && subscriptions.error.value && !subscriptions.loading.value)
178
+ void subscriptions.reload();
179
+ },
180
+ },
181
+ ),
182
+ );
183
+ watch(
184
+ [sites.error, countries.error, subscriptions.error],
185
+ (errors, previous) => {
186
+ if (errors.some((error, index) => error && error !== previous[index]))
187
+ ElMessage.error({ message: "筛选选项加载失败", grouping: true });
188
+ },
189
+ );
190
+ const pageElement = ref<HTMLElement>();
191
+ let returnFocus: { uuid: string; action: "duration" | "more" } | undefined;
192
+ function openDuration(uuid: string) {
193
+ returnFocus = { uuid, action: "duration" };
194
+ durationUser.value = uuid;
195
+ }
196
+ async function closeAction() {
197
+ durationUser.value = undefined;
198
+ discountUser.value = undefined;
199
+ await nextTick();
200
+ // 列表刷新会替换行节点,按标识寻找当前按钮,避免聚焦已移除的节点。
201
+ const target = [
202
+ ...(pageElement.value?.querySelectorAll<HTMLElement>(
203
+ "[data-user-action]",
204
+ ) ?? []),
205
+ ].find(
206
+ (node) =>
207
+ node.dataset.userId === returnFocus?.uuid &&
208
+ node.dataset.userAction === returnFocus?.action,
209
+ );
210
+ (
211
+ target ??
212
+ pageElement.value?.querySelector<HTMLElement>("[data-users-refresh]")
213
+ )?.focus();
214
+ returnFocus = undefined;
215
+ }
216
+ const durationUser = ref<string>(),
217
+ discountUser = ref<string>();
218
+ const { exec, pendingKeys } = useAsyncListAction(getData);
219
+ const disabled = computed(() => loading.value || pendingKeys.value.length > 0);
220
+ const columns = createColumns({
221
+ onCopied: () => {
222
+ ElMessage.success("已复制");
223
+ },
224
+ onCopyError: () => {
225
+ ElMessage.error("复制失败,请手动复制");
226
+ },
227
+ });
228
+ onMounted(() => {
229
+ void getData();
230
+ });
231
+ function handleSearch(filters: Partial<MemberFilters>) {
232
+ void onSubmit({ filters });
233
+ }
234
+ function handleReset() {
235
+ void reset();
236
+ }
237
+ async function execute(row: Member, action: MemberAction) {
238
+ try {
239
+ await exec(
240
+ (signal) => api.members.action(row.uuid, action, signal),
241
+ "操作成功",
242
+ row.uuid,
243
+ );
244
+ } catch (reason) {
245
+ if (!isAbortError(reason)) ElMessage.error("操作失败");
246
+ }
247
+ }
248
+ function handleCommand(key: string, row: Member) {
249
+ const handlers: Record<MemberCommand, () => void> = {
250
+ discount: () => {
251
+ returnFocus = { uuid: row.uuid, action: "more" };
252
+ discountUser.value = row.uuid;
253
+ },
254
+ ad: () => {
255
+ void execute(row, {
256
+ type: "ad",
257
+ value: row.ad_show_status === 1 ? 2 : 1,
258
+ });
259
+ },
260
+ mini: () => {
261
+ void execute(row, {
262
+ type: "mini",
263
+ value: row.mini_video_status === 1 ? 0 : 1,
264
+ });
265
+ },
266
+ ip: () => {
267
+ void execute(row, { type: "release-ip" });
268
+ },
269
+ };
270
+ if (isMemberCommand(key)) handlers[key]();
271
+ }
21
272
  </script>
273
+ <style lang="scss" scoped src="./index.scss" />
@@ -0,0 +1,27 @@
1
+ import type { MemberAction, MemberFilters, PageQuery } from "../types";
2
+ import { createMemberStore } from "./store";
3
+ import { runDemo, type DemoOptions } from "./request";
4
+
5
+ /** 独立演示服务;无网络拦截、无真实地址,刷新浏览器后重新创建。 */
6
+ export function createUsersDemo(options: DemoOptions = {}) {
7
+ const store = createMemberStore();
8
+ return {
9
+ list(query: PageQuery & { filters: MemberFilters }, signal?: AbortSignal) {
10
+ const submitted = structuredClone(query);
11
+ return runDemo(() => store.list(submitted), options, signal);
12
+ },
13
+ options(
14
+ kind: "sites" | "countries" | "subscriptions",
15
+ signal?: AbortSignal,
16
+ ) {
17
+ return runDemo(() => store.options(kind), options, signal);
18
+ },
19
+ detail(uuid: string, signal?: AbortSignal) {
20
+ return runDemo(() => store.detail(uuid), options, signal);
21
+ },
22
+ action(uuid: string, action: MemberAction, signal?: AbortSignal) {
23
+ const submitted = structuredClone(action);
24
+ return runDemo(() => store.action(uuid, submitted), options, signal);
25
+ },
26
+ };
27
+ }
@@ -0,0 +1,32 @@
1
+ export interface DemoOptions {
2
+ delay?: number;
3
+ }
4
+
5
+ function wait(duration: number, signal?: AbortSignal) {
6
+ return new Promise<void>((resolve, reject) => {
7
+ if (signal?.aborted) {
8
+ reject(new DOMException("请求已取消", "AbortError"));
9
+ return;
10
+ }
11
+ const abort = () => {
12
+ clearTimeout(timer);
13
+ reject(new DOMException("请求已取消", "AbortError"));
14
+ };
15
+ const timer = setTimeout(() => {
16
+ signal?.removeEventListener("abort", abort);
17
+ resolve();
18
+ }, duration);
19
+ signal?.addEventListener("abort", abort, { once: true });
20
+ });
21
+ }
22
+
23
+ /** 模拟请求只在等待成功后执行,已取消的操作不会修改演示数据。 */
24
+ export async function runDemo<T>(
25
+ action: () => T,
26
+ options: DemoOptions,
27
+ signal?: AbortSignal,
28
+ ): Promise<T> {
29
+ await wait(options.delay ?? 0, signal);
30
+ if (signal?.aborted) throw new DOMException("请求已取消", "AbortError");
31
+ return action();
32
+ }
@@ -0,0 +1,161 @@
1
+ import type {
2
+ Member,
3
+ MemberAction,
4
+ MemberDetails,
5
+ MemberFilters,
6
+ PageQuery,
7
+ Option,
8
+ } from "../types";
9
+ import { countryOptions } from "../constants";
10
+ const stamp = (value: number) =>
11
+ new Date(value).toISOString().slice(0, 19).replace("T", " ");
12
+ const origin = Date.UTC(2026, 2, 31, 19, 1, 25);
13
+ const sites = [
14
+ { label: "星河站点", value: 1 },
15
+ { label: "青禾站点", value: 2 },
16
+ { label: "远山站点", value: 3 },
17
+ ];
18
+ const subscriptions = [
19
+ { label: "周订阅", value: 1 },
20
+ { label: "月订阅", value: 2 },
21
+ { label: "季订阅", value: 3 },
22
+ ];
23
+ function seedMembers(): Member[] {
24
+ return Array.from({ length: 86 }, (_, index) => ({
25
+ uuid: `USER-${String(index + 1).padStart(5, "0")}`,
26
+ member_email: `member${index + 1}@example.com`,
27
+ email: `subscriber${index + 1}@example.com`,
28
+ created_at: stamp(origin - index * 86400000),
29
+ country: countryOptions[index % countryOptions.length].value,
30
+ site: { id: sites[index % 3].value, site_name: sites[index % 3].label },
31
+ subscription_status: index % 4,
32
+ subscribe_type: (index % 3) + 1,
33
+ subscribe_cycle_type_text: subscriptions[index % 3].label,
34
+ subscription_expire_time: stamp(origin + (index + 1) * 86400000),
35
+ next_charge_time: stamp(origin + (index + 1) * 86400000),
36
+ ad_show_status: index % 2 ? 1 : 2,
37
+ mini_video_status: index % 2 ? 0 : 1,
38
+ ip_limited: index % 2 === 0,
39
+ }));
40
+ }
41
+
42
+ /** 每次创建拥有独立演示状态;返回副本,页面修改不影响服务。 */
43
+ export function createMemberStore() {
44
+ const members = seedMembers();
45
+ const details = new Map<string, MemberDetails>();
46
+ const detail = (uuid: string) => {
47
+ const member = members.find((row) => row.uuid === uuid);
48
+ if (!member) throw new Error("用户不存在");
49
+ if (!details.has(uuid))
50
+ details.set(uuid, { member, price: 19.99, discount: 100, history: [] });
51
+ return details.get(uuid)!;
52
+ };
53
+ function act(uuid: string, action: MemberAction) {
54
+ const current = detail(uuid),
55
+ member = current.member;
56
+ let description: string;
57
+ switch (action.type) {
58
+ case "duration":
59
+ if (
60
+ !Number.isInteger(action.day) ||
61
+ action.day < 1 ||
62
+ action.day > 3650 ||
63
+ ![0, 1].includes(action.timing)
64
+ )
65
+ throw new Error("请输入 1~3650 的整数天数");
66
+ if (action.timing === 0)
67
+ member.subscription_expire_time = stamp(
68
+ Date.parse(
69
+ member.subscription_expire_time.replace(" ", "T") + "Z",
70
+ ) +
71
+ action.day * 86400000,
72
+ );
73
+ description = `${action.timing ? "下次续订后" : "立即"}增加 ${action.day} 天`;
74
+ break;
75
+ case "discount":
76
+ if (
77
+ !Number.isInteger(action.discount) ||
78
+ action.discount < 1 ||
79
+ action.discount > 100 ||
80
+ !action.reason?.trim() ||
81
+ ![0, 1].includes(action.mode)
82
+ )
83
+ throw new Error("请输入 1~100 的整数折扣及原因");
84
+ current.discount = action.discount;
85
+ description = `${action.mode ? "永久" : "下次"}折扣 ${action.discount}%:${action.reason}`;
86
+ break;
87
+ case "ad":
88
+ if (![1, 2].includes(action.value)) throw new Error("广告状态无效");
89
+ member.ad_show_status = action.value;
90
+ description = action.value === 1 ? "关闭广告" : "打开广告";
91
+ break;
92
+ case "mini":
93
+ if (![0, 1].includes(action.value)) throw new Error("精简版状态无效");
94
+ member.mini_video_status = action.value;
95
+ description = action.value ? "开通精简版" : "关闭精简版";
96
+ break;
97
+ case "release-ip":
98
+ member.ip_limited = false;
99
+ description = "解除 IP 限制";
100
+ break;
101
+ default:
102
+ throw new Error("不支持的操作");
103
+ }
104
+ current.history.unshift({
105
+ id: `${uuid}-${current.history.length + 1}`,
106
+ created_at: stamp(Date.now()),
107
+ description,
108
+ });
109
+ return current;
110
+ }
111
+
112
+ return {
113
+ options(kind: "sites" | "countries" | "subscriptions"): Option[] {
114
+ return structuredClone(
115
+ { sites, countries: countryOptions, subscriptions }[kind],
116
+ );
117
+ },
118
+ list(query: PageQuery & { filters: MemberFilters }) {
119
+ if (
120
+ !Number.isInteger(query.page) ||
121
+ query.page < 1 ||
122
+ !Number.isInteger(query.page_size) ||
123
+ query.page_size < 1 ||
124
+ query.page_size > 100
125
+ )
126
+ throw new Error("分页参数无效");
127
+ const f = query.filters;
128
+ const text = f.search?.trim().toLowerCase();
129
+ const rows = members.filter(
130
+ (row) =>
131
+ (!text ||
132
+ [row.uuid, row.email, row.member_email].some((value) =>
133
+ value.toLowerCase().includes(text),
134
+ )) &&
135
+ (f.subscription_status == null ||
136
+ f.subscription_status === "" ||
137
+ row.subscription_status === f.subscription_status) &&
138
+ (!f.site_id?.length || f.site_id.includes(row.site.id)) &&
139
+ (!f.subscribe_type || row.subscribe_type === f.subscribe_type) &&
140
+ (!f.country_name || row.country === f.country_name) &&
141
+ (f.ad_show_status == null ||
142
+ f.ad_show_status === "" ||
143
+ row.ad_show_status === f.ad_show_status),
144
+ );
145
+
146
+ return structuredClone({
147
+ list: rows.slice(
148
+ (query.page - 1) * query.page_size,
149
+ query.page * query.page_size,
150
+ ),
151
+ total: rows.length,
152
+ });
153
+ },
154
+ detail(uuid: string) {
155
+ return structuredClone(detail(uuid));
156
+ },
157
+ action(uuid: string, action: MemberAction) {
158
+ return structuredClone(act(uuid, action));
159
+ },
160
+ };
161
+ }