diff --git a/app/api/logs/[[...path]]/route.ts b/app/api/logs/[[...path]]/route.ts index 24466bc4b..3eb62250c 100644 --- a/app/api/logs/[[...path]]/route.ts +++ b/app/api/logs/[[...path]]/route.ts @@ -25,7 +25,11 @@ async function handle( id: user_id, }, }); - if (current_user && current_user.everyLimitToken !== 0) { + if ( + current_user && + current_user.everyLimitToken && + current_user.everyLimitToken > 0 + ) { current_day_limit_token = current_user.everyLimitToken * 1000; } else { current_day_limit_token = 0; diff --git a/app/app/(admin)/components/users-table.tsx b/app/app/(admin)/components/users-table.tsx index d7d029111..403b11241 100644 --- a/app/app/(admin)/components/users-table.tsx +++ b/app/app/(admin)/components/users-table.tsx @@ -6,6 +6,7 @@ import { Space, Table, Input, + InputNumber, Button, notification as notificationModule, Checkbox, @@ -127,6 +128,9 @@ function UsersTable({ users, setUsers, loading }: UserInterface) { + + + @@ -163,6 +167,7 @@ function UsersTable({ users, setUsers, loading }: UserInterface) { allowToLogin: values.allowToLogin ?? true, isAdmin: values.isAdmin ?? false, password: values.password ?? null, + everyLimitToken: values.everyLimitToken ?? 0, }; fetch(`/api/admin/users/${values.id}`, { method: method, @@ -228,13 +233,20 @@ function UsersTable({ users, setUsers, loading }: UserInterface) { }); }; const columns: TableColumnsType = [ - { title: "姓名", dataIndex: "name", width: 80 }, + { title: "姓名", dataIndex: "name", width: 80, align: "center" }, { title: "用户名", dataIndex: "username", width: 80, + align: "center", + }, + { title: "邮箱", dataIndex: "email", width: 180, align: "right" }, + { + title: "每日限额", + dataIndex: "everyLimitToken", + width: 60, + align: "right", }, - { title: "邮箱", dataIndex: "email", width: 180 }, { title: "createdAt", dataIndex: "createdAt", @@ -301,7 +313,7 @@ function UsersTable({ users, setUsers, loading }: UserInterface) { {localStorage.getItem("current_day_token") ?? 0}{" "} - / 200000 + + /{" "} + {parseInt( + localStorage.getItem("current_day_limit_token") ?? + "200000", + )} + } color={"var(--second)"} @@ -1488,7 +1494,10 @@ function _Chat() {