- Replace zpay with easy-pay payment provider (new lib/easy-pay/ module) - Add order history page for users (pay/orders) - Add GET /api/orders/my endpoint to list user's own orders - Add GET /api/users/[id] endpoint for sub2api user lookup - Add order status tracking module (lib/order/status.ts) - Update config to support easy-pay credentials (merchant ID, key, gateway) - Update PaymentForm and PaymentQRCode components for easy-pay flow - Update pay page and admin page with new order management UI - Update order service to support easy-pay, cancellation, and refund
73 lines
1.9 KiB
Plaintext
73 lines
1.9 KiB
Plaintext
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")
|
|
amount Decimal @db.Decimal(10, 2)
|
|
rechargeCode String @unique @map("recharge_code")
|
|
status OrderStatus @default(PENDING)
|
|
paymentType String @map("payment_type")
|
|
|
|
zpayTradeNo String? @map("zpay_trade_no")
|
|
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")
|
|
|
|
auditLogs AuditLog[]
|
|
|
|
@@index([userId])
|
|
@@index([status])
|
|
@@index([expiresAt])
|
|
@@index([createdAt])
|
|
@@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")
|
|
}
|