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 +}