mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
Replace iframe-based external payment with native implementation: Backend (Go): - 5 new Ent schemas: PaymentOrder, PaymentAuditLog, PaymentChannel, SubscriptionPlan, PaymentProviderInstance - 5 SQL migrations (090-094) - Payment provider interface + registry + load balancer - 4 provider implementations (EasyPay, Alipay, WxPay, Stripe) - PaymentService (order lifecycle, fulfillment, refund 3-phase) - PaymentConfigService (settings, instance/channel/plan CRUD) - 31 API endpoints (9 user + 4 webhook + 18 admin) - Wire DI integration Frontend (Vue3): - Payment types, API modules, store, router changes - Sidebar: payment_enabled controls visibility, new menu items - User pages: PaymentView (replace iframe), QR payment, Stripe, result page, order list - Admin pages: Order management (4 tabs), provider instance mgmt - Settings: new payment tab, removed old purchase iframe config - i18n: full payment namespace (en + zh) Docs: - PAYMENT_FRONTEND_MIGRATION_PLAN.md - PAYMENT_BACKEND_MIGRATION_PLAN.md - PAYMENT_IMPLEMENTATION_ROADMAP.md
19 lines
808 B
SQL
19 lines
808 B
SQL
CREATE TABLE IF NOT EXISTS subscription_plans (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
group_id BIGINT NOT NULL,
|
|
name VARCHAR(100) NOT NULL,
|
|
description TEXT NOT NULL DEFAULT '',
|
|
price DECIMAL(20,2) NOT NULL,
|
|
original_price DECIMAL(20,2),
|
|
validity_days INT NOT NULL DEFAULT 30,
|
|
validity_unit VARCHAR(10) NOT NULL DEFAULT 'day',
|
|
features TEXT NOT NULL DEFAULT '',
|
|
product_name VARCHAR(100) NOT NULL DEFAULT '',
|
|
for_sale BOOLEAN NOT NULL DEFAULT TRUE,
|
|
sort_order INT NOT NULL DEFAULT 0,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_subscription_plans_group_id ON subscription_plans(group_id);
|
|
CREATE INDEX IF NOT EXISTS idx_subscription_plans_for_sale ON subscription_plans(for_sale);
|