Commit Graph
3266 Commits
Author SHA1 Message Date
erio 335aaa733b fix(frontend): fix purchase page icon and title i18n
- Replace fill-based 1024x1024 icon with stroke-based Heroicons banknotes
  icon (24x24) matching sidebar style
- Change titleKey from purchase.title to nav.buySubscription for consistency
2026-04-06 17:40:05 +08:00
erio 5f64f744de chore: bump version to 0.1.108.13 2026-04-06 17:16:59 +08:00
erio f8990f39f8 style(frontend): compact payment settings layout
- Merge amount fields, toggles and limits into fewer rows
- Put payment types + load balance strategy on same line
- Compact provider cards (single-line info, inline edit/delete buttons)
- Reduce padding and gaps throughout
2026-04-06 17:16:59 +08:00
erio 86204170d9 chore: bump version to 0.1.108.12 2026-04-06 16:44:21 +08:00
erio 2f41c71957 feat(payment): prefix order ID with sub2_ for third-party providers
Add formatOrderID/parseOrderID helpers to prepend "sub2_" prefix to
order IDs sent to EasyPay, Alipay, Wxpay, and Stripe. This makes our
orders identifiable in third-party dashboards and prevents ID collision.

Callback handlers strip the prefix before looking up the DB record.
Internal audit logs keep using raw DB IDs.
2026-04-06 16:43:59 +08:00
erio d25669ab52 chore: bump version to 0.1.108.11 2026-04-06 16:19:19 +08:00
erio 611dcb8ccd cleanup: remove duplicate AdminPaymentConfigView, fix group display
- Delete AdminPaymentConfigView.vue (duplicated in SettingsView Payment tab)
- Remove /admin/orders/config route
- Plans table: show red "缺失/Missing" badge for deleted groups
- Plans table: group_id column shows group name or missing indicator
2026-04-06 16:19:19 +08:00
erio 9b8317fc66 chore: bump version to 0.1.108.10 2026-04-06 16:04:20 +08:00
erio 97a9949085 fix(frontend): 7 payment UI issues
1. Remove duplicate page titles (AppLayout bar already shows them)
2. Fix daily_limit empty value causing Go unmarshal error (NaN -> 0)
3. Enabled payment types: text input -> toggle badges
4. Provider dialog: supported types -> toggle badges per provider key
5. Auto-derive supported types when changing provider key
6. Fix ¥ symbol showing as literal \u00A5 in Vue templates
7. Show payment method selector when >= 1 method (was > 1)
2026-04-06 16:03:58 +08:00
erio 1984a19285 chore: bump version to 0.1.108.9 2026-04-06 15:37:39 +08:00
erio 0215b2a1ca refactor(frontend): unify user orders page with DataTable + Pagination
Replace custom table and pill-style filters with project-standard
DataTable, Select, and Pagination components for consistent UI.
2026-04-06 15:37:39 +08:00
erio f72f79f48f chore: bump version to 0.1.108.8 2026-04-06 15:21:25 +08:00
erio 6798de6333 fix(frontend): centralize API error handling with extractApiErrorMessage
- Create utils/apiError.ts with extractApiErrorMessage() utility
- Replace all raw err.message/String(err) patterns in payment views
- Fix error display for API client interceptor's plain object errors
- Update CLAUDE.md with API error handling convention (section 13)
- Copy CLAUDE.md to AGENTS.md
2026-04-06 15:21:05 +08:00
erio 329d3445fa chore: bump version to 0.1.108.7 2026-04-06 15:03:19 +08:00
erio 4cfcbfabe6 fix(frontend): i18n table headers + remove redundant user subscriptions tab
- Plans page: remove user subscriptions sub-tab (already in subscription mgmt)
- Plans page: internationalize all table column headers
- Orders page: internationalize table column headers
- Add missing i18n key: colUser
2026-04-06 15:02:49 +08:00
erio fdc9c6d8b8 chore: bump version to 0.1.108.6 2026-04-06 14:52:16 +08:00
erio a6cd294ab6 feat(frontend): enrich payment settings with provider management inline
- Move payment config out of orders submenu (now 3 items: dashboard, orders, plans)
- Embed provider management directly in SettingsView Payment tab
- Add missing fields: product name prefix/suffix with preview, load balance strategy
- Add full provider CRUD dialog (EasyPay/Alipay/Wxpay/Stripe config fields)
2026-04-06 14:51:14 +08:00
erio 22a3931984 chore: bump version to 0.1.108.5 2026-04-06 14:40:53 +08:00
erio f2b3cf628e feat(frontend): collapsible payment submenu in sidebar
Group the 4 payment admin pages under a single "订单管理" parent menu
item that expands/collapses to show sub-items with indented tree line.
2026-04-06 14:40:37 +08:00
erio fa00ad06d2 chore: bump version to 0.1.108.4 2026-04-06 14:27:10 +08:00
erio 94585c3c21 refactor(frontend): split payment admin into 4 independent pages
Replace the single AdminOrdersView with 4-tab layout with separate pages:
- /admin/orders/dashboard — payment dashboard with 7/30/90 day switcher
- /admin/orders — pure order list (removed channels/plans tabs)
- /admin/orders/config — payment config + provider management
- /admin/orders/plans — subscription plans (group dropdown) + user subscriptions

Delete AdminProvidersView (merged into config page).
Update sidebar to show 4 menu items instead of 1.
2026-04-06 14:26:28 +08:00
erio 26a2c7a364 cleanup: remove Go migration code, rely solely on SQL migration 096 2026-04-06 02:52:20 +08:00
erio 05224be249 fix: use SQL migration for legacy purchase_subscription_url migration
Replace Go startup code with SQL migration 096 to migrate
purchase_subscription_url to custom_menu_items. Database migrations
run exactly once and are tracked by the migration system.
2026-04-06 02:49:46 +08:00
erio acf79ff832 fix: resolve frontend TypeScript build errors
- Remove unused ReceiptIcon/SoraIcon and sora_client_enabled references
- Fix AdminOrdersView pagination response property (data → items)
- Fix PaymentView null safety for amount (use validAmount computed)
- Add missing @stripe/stripe-js dependency
2026-04-06 02:39:07 +08:00
erio 225e8aaa97 fix: resolve golangci-lint errors — errcheck, gofmt, deprecated stripe API, unused func 2026-04-06 02:30:14 +08:00
erio 485b843637 fix: add PaymentOrderExpiryService param to provideCleanup test 2026-04-06 02:17:42 +08:00
erio 7a77ab2d09 chore: bump version to 0.1.108.3 2026-04-06 02:12:39 +08:00
erio 3703b5c08b refactor: migrate legacy purchase subscription to custom menu item
- Restore MigrateLegacyPurchaseURL auto-call on startup: converts old
  purchase_subscription_url into a custom menu item (id: migrated_purchase_subscription)
  and clears the legacy settings
- Delete PurchaseRouter.vue and PurchaseSubscriptionView.vue (replaced
  by existing CustomPageView.vue via custom menu system)
- /purchase route now exclusively serves the new built-in payment system
- Remove purchase_subscription_enabled from sidebar, router, settings UI,
  TypeScript types, and i18n keys
- Legacy purchase URL users will see their link as a custom menu entry
  after upgrade, editable in admin custom menu settings
2026-04-06 02:09:26 +08:00
erio 4a703cb084 fix: backward compatibility for legacy purchase subscription system
- Add PurchaseRouter.vue to dynamically render PaymentView or
  PurchaseSubscriptionView based on payment_enabled vs
  purchase_subscription_enabled settings
- Fix route guard to allow access when either payment system is enabled
- Split sidebar menu: /purchase shows for both systems, /orders only
  for built-in payment
- Remove auto-migration that forcibly disabled legacy purchase system
  on first startup (MigrateLegacyPurchaseURL)
- Add payment_enabled to PublicSettings API response so frontend can
  check both systems from a single endpoint
- Restore legacy purchase link config UI controls in admin Payment tab
- Split payment settings save to use dedicated PUT /admin/payment/config
  API instead of mixing into general settings endpoint
- Add admin payment config API functions (getConfig/updateConfig)
2026-04-06 01:51:12 +08:00
erio 96b1a96cf9 refactor(payment): code quality improvements per project conventions
- payment_service: split GetDashboardStats (131→35 lines) into 4 sub-functions,
  extract applyPagination helper, replace bubble sort with sort.Slice,
  use sync.Once for EnsureProviders, define magic number constants
- providers: merge duplicate PC/Mobile functions in alipay/wxpay,
  extract loadKeyPair/queryOrderTotalFen in wxpay, add centsToYuan in stripe,
  define constants for success codes, currencies, event types
- handlers: extract requireAuth and parseIDParam helpers to eliminate
  repeated auth/ID-parsing boilerplate
- registry: remove dead seen map in GetProviderByKey
- types: centralize order status constants in payment package
- load_balancer+config_service: unify duplicated containsType into
  exported InstanceSupportsType function
2026-04-06 01:13:30 +08:00
erio c69929bbb7 Merge feature/payment into release/custom-0.1.108
集成支付系统(EasyPay、Alipay、WxPay、Stripe),包含完整的订单管理、
Webhook 回调、管理后台仪表盘和用户充值/订阅流程。
2026-04-06 00:53:57 +08:00
erio cb56b96cd1 chore: bump version to 0.1.108.2 2026-04-06 00:00:31 +08:00
erio f9369aa46d fix: remove duplicate isUpstreamModelRestrictedByChannel check from merge 2026-04-06 00:00:07 +08:00
erio c45b0f2238 fix: gofmt formatting after merge 2026-04-05 23:14:23 +08:00
erio db6413039a Merge tag 'v0.1.108' into release/custom-0.1.108
彻底移除 Sora 平台功能,精简代码库约 24000 行;修复渠道平台定价隔离问题。

- 完全移除 Sora 平台:删除所有 Sora 相关的后端服务、前端组件、数据库 Schema 和 ent 代码
- 移除 Sora 相关的 S3 存储、媒体管理、配额管理、生成服务等模块
- 清理前端 Sora 视图、组件、composables、API 调用和国际化文本
- 移除 Sora OAuth 选项,简化 OpenAI OAuth 流程
- 更新 antigravity User-Agent 版本号至 1.21.9

- 修复 antigravity 分组错误匹配其他平台(anthropic/gemini)定价和模型映射的问题
- 修复渠道未映射模型时 BillingModel 被错误还原导致零计费的问题

# Conflicts:
#	backend/cmd/server/VERSION
#	backend/cmd/server/wire_gen.go
#	backend/ent/group.go
#	backend/ent/mutation.go
#	backend/ent/runtime/runtime.go
#	backend/ent/schema/group.go
#	backend/internal/handler/admin/channel_handler.go
#	backend/internal/handler/admin/channel_handler_test.go
#	backend/internal/handler/gateway_handler.go
#	backend/internal/pkg/antigravity/stream_transformer.go
#	backend/internal/server/api_contract_test.go
#	backend/internal/service/billing_service.go
#	backend/internal/service/channel_service.go
#	backend/internal/service/channel_service_test.go
#	backend/internal/service/gateway_service.go
#	backend/internal/service/openai_account_scheduler.go
#	backend/internal/service/openai_gateway_chat_completions.go
#	backend/internal/service/openai_gateway_service.go
#	backend/internal/service/openai_oauth_service.go
2026-04-05 23:11:04 +08:00
erio 4030c5192d fix: split dashboard stats, mutex provider init, CRITICAL logging for fulfillment 2026-04-05 22:52:07 +08:00
erio 5d63dfb0d1 style: minor formatting in registry.go 2026-04-05 22:30:22 +08:00
erio 9af4a53fe9 fix: structured errors, slog logging, snake_case JSON tags
- Registry uses infraerrors.NotFound instead of fmt.Errorf
- Webhook handler uses slog instead of log.Printf
- PaymentConfigService JSON tags unified to snake_case
- PaymentOrderExpiryService uses slog
- Remove duplicate declarations in registry.go
2026-04-05 22:25:51 +08:00
erio 5cde1bcc59 fix: code quality audit — critical bugs + convention compliance
Critical:
- Refund idempotency keys now include UnixNano timestamp (alipay/wxpay)
- PaymentView passes qr/pay_url params to QR code page
- Fix dead code branch in order result handling

Quality:
- Currency symbol $ → ¥ in admin stats and refund dialog
- StripePaymentView setTimeout cleanup on unmount
- Webhook body size limited to 1MB (io.LimitReader)
- SubscriptionPlan features type documented
2026-04-05 22:17:56 +08:00
erio 897244b832 refactor(channel): split long functions, extract shared validation, move billing validation to service
- Split Update (98→25 lines), buildCache (54→20 lines), Create (51→25 lines)
  into focused sub-functions: applyUpdateInput, checkGroupConflicts,
  fetchChannelData, populateChannelCache, storeErrorCache, getOldGroupIDs,
  invalidateAuthCacheForGroups
- Extract validateChannelConfig to eliminate duplicated validation calls
  between Create and Update
- Move validatePricingBillingMode from handler to service layer for
  proper separation of concerns
- Add error logging to IsModelRestricted (was silently swallowing errors)
- Add 12 new tests: ToUsageFields, billing mode validation, antigravity
  wildcard mapping isolation, Create/Update mapping conflict integration
2026-04-05 22:05:13 +08:00
Wesley Liddick c71b1d63e5 Merge pull request #1460 from imfusheng/main
解决issue#1453提到的反重力不可用问题
2026-04-05 22:01:08 +08:00
shaw a07296770c fix: remove remaining Sora references from frontend
The previous Sora removal missed several frontend references, causing
TypeScript build errors for sora_client_enabled and a missing SoraView.vue
import. Clean up all remaining Sora code from types, router, sidebar,
settings, store, and accounts API.
2026-04-05 21:26:47 +08:00
Wesley Liddick 8154575d70 Merge pull request #1464 from touwaeriol/fix/channel-platform-isolation
fix(channel): remove cross-platform pricing/mapping leakage for antigravity groups
2026-04-05 21:09:10 +08:00
Wesley Liddick d757df8a4b Merge pull request #1463 from touwaeriol/feat/remove-sora
revert: completely remove Sora platform
2026-04-05 21:08:48 +08:00
erio c5688fef9a fix: remove cross-platform pricing/mapping leakage for antigravity groups
Antigravity groups were incorrectly matching pricing and model mapping
entries from anthropic/gemini platform tabs. Each platform should be
strictly isolated — antigravity groups only use antigravity-tagged pricing.
2026-04-05 20:42:24 +08:00
erio 19655a15f1 fix: gofmt formatting 2026-04-05 18:56:40 +08:00
erio 1b215c88b5 test: add payment system unit tests (69 test cases)
- fee_test.go: 14 cases for CalculatePayAmount precision/rounding
- crypto_test.go: 9 cases for AES-256-GCM encrypt/decrypt round-trip
- registry_test.go: 10 cases including concurrent thread safety
- easypay_sign_test.go: 9 cases for MD5 signing/verification
- load_balancer_test.go: 10 cases for containsType utility
- payment_config_service_test.go: 17 cases for config parsing
2026-04-05 18:48:51 +08:00
erio f345b0f595 fix: use upstream versions of shared files and remove only Sora code
Restore gateway_service.go, setting_handler.go, routes/admin.go,
dto/settings.go, group_repo.go, api_key_repo.go, wire_gen.go to
upstream/main versions and surgically remove only Sora references.

This preserves upstream-only features (RequireOauthOnly, RequirePrivacySet,
GroupResolution, etc.) that were missing when using release branch versions.
2026-04-05 18:48:41 +08:00
erio aa151ef0e1 fix: resolve all audit findings — registry init, expiry task, dashboard, i18n, stripe
C1: Add EnsureProviders() lazy initialization to populate Registry
    from PaymentProviderInstance DB rows at first use
C2: Delete stale payment/provider_factory.go dead code
C3: Add PaymentOrderExpiryService background ticker (60s interval)
C4: Expand DashboardStats with daily_series, payment_methods, top_users
C5+C6: Add 152 payment i18n keys (en + zh) for admin and settings pages
C7: Fix Stripe global key race — use per-instance client.API
I1: Remove old purchase_subscription_enabled/url from settings form
I2: Add MigrateLegacyPurchaseURL to auto-convert old URL to custom menu
I3: Add migration 092 no-op placeholder for numbering continuity
2026-04-05 18:32:24 +08:00
erio 58707f8a2a fix: restore upstream api_contract_test and remove Sora fields 2026-04-05 18:18:58 +08:00