2026-03-01 03:04:24 +08:00
|
|
|
generator client {
|
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
|
provider = "postgresql"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model Order {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
userId Int @map("user_id")
|
|
|
|
|
userEmail String? @map("user_email")
|
|
|
|
|
userName String? @map("user_name")
|
2026-03-03 04:37:39 +08:00
|
|
|
userNotes String? @map("user_notes")
|
2026-03-01 03:04:24 +08:00
|
|
|
amount Decimal @db.Decimal(10, 2)
|
2026-03-03 22:00:44 +08:00
|
|
|
payAmount Decimal? @db.Decimal(10, 2) @map("pay_amount")
|
|
|
|
|
feeRate Decimal? @db.Decimal(5, 2) @map("fee_rate")
|
2026-03-01 03:04:24 +08:00
|
|
|
rechargeCode String @unique @map("recharge_code")
|
|
|
|
|
status OrderStatus @default(PENDING)
|
|
|
|
|
paymentType String @map("payment_type")
|
|
|
|
|
|
refactor: extract pay page components and migrate zpay → easypay
Components:
- Add PayPageLayout, OrderFilterBar, MobileOrderList, OrderTable, OrderSummaryCards
- Extract shared pay-utils (types, constants, helper functions)
- Simplify pay/page.tsx and orders/page.tsx
EasyPay migration:
- Remove src/lib/zpay/, api/zpay/notify, zpay test, zpay.md
- Simplify config.ts: single envSchema, no ZPAY_* fallback
- Rename DB field zpay_trade_no → payment_trade_no (migration added)
- Update OrderDetail label: ZPAY订单号 → 支付单号
- Update CLAUDE.md project structure
2026-03-01 15:55:43 +08:00
|
|
|
paymentTradeNo String? @map("payment_trade_no")
|
2026-03-01 03:04:24 +08:00
|
|
|
payUrl String? @map("pay_url")
|
|
|
|
|
qrCode String? @map("qr_code")
|
|
|
|
|
qrCodeImg String? @map("qr_code_img")
|
|
|
|
|
|
|
|
|
|
refundAmount Decimal? @db.Decimal(10, 2) @map("refund_amount")
|
|
|
|
|
refundReason String? @map("refund_reason")
|
|
|
|
|
refundAt DateTime? @map("refund_at")
|
|
|
|
|
forceRefund Boolean @default(false) @map("force_refund")
|
|
|
|
|
|
|
|
|
|
expiresAt DateTime @map("expires_at")
|
|
|
|
|
paidAt DateTime? @map("paid_at")
|
|
|
|
|
completedAt DateTime? @map("completed_at")
|
|
|
|
|
failedAt DateTime? @map("failed_at")
|
|
|
|
|
failedReason String? @map("failed_reason")
|
|
|
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
|
updatedAt DateTime @updatedAt @map("updated_at")
|
|
|
|
|
clientIp String? @map("client_ip")
|
2026-03-02 20:40:16 +08:00
|
|
|
srcHost String? @map("src_host")
|
|
|
|
|
srcUrl String? @map("src_url")
|
2026-03-01 03:04:24 +08:00
|
|
|
|
|
|
|
|
auditLogs AuditLog[]
|
|
|
|
|
|
|
|
|
|
@@index([userId])
|
|
|
|
|
@@index([status])
|
|
|
|
|
@@index([expiresAt])
|
|
|
|
|
@@index([createdAt])
|
2026-03-04 20:08:58 +08:00
|
|
|
@@index([paidAt])
|
2026-03-01 03:04:24 +08:00
|
|
|
@@map("orders")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum OrderStatus {
|
|
|
|
|
PENDING
|
|
|
|
|
PAID
|
|
|
|
|
RECHARGING
|
|
|
|
|
COMPLETED
|
|
|
|
|
EXPIRED
|
|
|
|
|
CANCELLED
|
|
|
|
|
FAILED
|
|
|
|
|
REFUNDING
|
|
|
|
|
REFUNDED
|
|
|
|
|
REFUND_FAILED
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model AuditLog {
|
|
|
|
|
id String @id @default(cuid())
|
|
|
|
|
orderId String @map("order_id")
|
|
|
|
|
order Order @relation(fields: [orderId], references: [id])
|
|
|
|
|
action String
|
|
|
|
|
detail String? @db.Text
|
|
|
|
|
operator String?
|
|
|
|
|
createdAt DateTime @default(now()) @map("created_at")
|
|
|
|
|
|
|
|
|
|
@@index([orderId])
|
|
|
|
|
@@index([createdAt])
|
|
|
|
|
@@map("audit_logs")
|
|
|
|
|
}
|