From 7fa2fe67ca375e7c95c3d394b93690399737a897 Mon Sep 17 00:00:00 2001 From: luorijun Date: Thu, 25 Sep 2025 19:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=A4=9A=E4=BD=99=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prisma/schema.prisma | 44 --------------------------- src/app/dashboard/components/edge.tsx | 2 +- src/lib/formatters.ts | 9 ------ src/lib/utils.ts | 11 +++++++ 4 files changed, 12 insertions(+), 54 deletions(-) delete mode 100644 src/lib/formatters.ts diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 374fd0e..73ae3f6 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -91,37 +91,6 @@ model token { updatetime DateTime @default(now()) @db.DateTime(0) } -model change_city { - id Int @id @default(autoincrement()) - time DateTime? @db.Timestamp(0) - city_id Int? - count Int? - offset_old Int? - offset_new Int? - - @@index([time], map: "change_city_time_index") -} - -model Account { - id String @id @default(cuid()) - userId Int @map("user_id") - type String - provider String - providerAccountId String @map("provider_account_id") - refresh_token String? @db.Text - access_token String? @db.Text - expires_at Int? - token_type String? - scope String? - id_token String? @db.Text - session_state String? - - user User @relation(fields: [userId], references: [id], onDelete: Cascade) - - @@unique([provider, providerAccountId]) - @@map("accounts") -} - model User { id Int @id @default(autoincrement()) account String @unique @@ -130,7 +99,6 @@ model User { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt sessions Session[] - accounts Account[] @@map("users") } @@ -145,15 +113,3 @@ model Session { @@index([userId]) @@map("sessions") } - -model VerificationCode { - id Int @id @default(autoincrement()) - account String - code String - type String - expiresAt DateTime - createdAt DateTime @default(now()) - - @@index([account, type]) - @@map("verification_codes") -} diff --git a/src/app/dashboard/components/edge.tsx b/src/app/dashboard/components/edge.tsx index 91ddadd..c377f77 100644 --- a/src/app/dashboard/components/edge.tsx +++ b/src/app/dashboard/components/edge.tsx @@ -1,7 +1,7 @@ 'use client' import { useEffect, useState } from 'react' -import { validateNumber } from '@/lib/formatters' +import { validateNumber } from '@/lib/utils' import { Pagination } from '@/components/ui/pagination' import { Table, TableHeader, TableBody, TableHead, TableRow, TableCell } from '@/components/ui/table' import { getEdgeNodes } from '@/actions/stats' diff --git a/src/lib/formatters.ts b/src/lib/formatters.ts deleted file mode 100644 index 67faaed..0000000 --- a/src/lib/formatters.ts +++ /dev/null @@ -1,9 +0,0 @@ -// 数据验证函数 -export const validateNumber = (value: unknown): number => { - if (typeof value === 'number') return value - if (typeof value === 'string') { - const num = parseInt(value) - return isNaN(num) ? 0 : num - } - return 0 -} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index fed2fe9..c634481 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,6 +1,17 @@ import { clsx, type ClassValue } from 'clsx' import { twMerge } from 'tailwind-merge' +// 合并 className export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } + +// 数据验证函数 +export const validateNumber = (value: unknown): number => { + if (typeof value === 'number') return value + if (typeof value === 'string') { + const num = parseInt(value) + return isNaN(num) ? 0 : num + } + return 0 +}