243 Commits

Author SHA1 Message Date
4d913c1728 修复缓存
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m26s
2026-03-06 21:58:29 -08:00
19932bb9f7 x
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m56s
2026-03-06 05:47:47 -08:00
b625dda4c9 修复:goctl api 生成的代码没有在路由中加入Ipa模式
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m48s
2026-03-06 00:15:35 -08:00
6e13e67dc8 修改签名头
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m44s
2026-03-05 23:31:45 -08:00
7308aa9191 无订阅 支付后出现两个订阅
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 7m37s
2026-03-05 21:53:36 -08:00
a1ab0fefa4 无订阅 支付后出现两个订阅
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 8m15s
2026-03-05 07:59:49 -08:00
ce6351368d 家庭组逻辑导致支付失败
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 8m11s
2026-03-05 03:20:38 -08:00
9f4d71770b 家庭组逻辑导致支付失败
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 9m9s
2026-03-05 02:13:28 -08:00
f4fe0e32a8 家庭组逻辑导致支付失败
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 8m16s
2026-03-05 00:01:50 -08:00
d962fafe7f 修复订单支付显示方式
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m59s
2026-03-04 23:28:37 -08:00
69ac1f104d 修复订单支付显示方式
Some checks failed
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-03-04 23:20:36 -08:00
70c0483ca9 修复订阅
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 8m2s
2026-03-04 23:08:46 -08:00
4349a7ea2f 家庭组 权益修改
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 8m16s
2026-03-04 22:02:42 -08:00
3594097d47 各种配置项修复,优化到后台管理端配置
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m59s
2026-03-04 20:03:03 -08:00
2215df8c0b 各种配置项修复,优化到后台管理端配置 2026-03-04 19:42:21 -08:00
4752f844ef 各种配置项修复,优化到后台管理端配置
Some checks failed
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-03-04 17:58:40 -08:00
149dfe1ac3 fix gitea workflow path and runner label
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 7m57s
2026-03-04 07:02:51 -08:00
a01570b59d fix gitea workflow path and runner label
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 8m21s
2026-03-04 06:33:14 -08:00
6c8f22adc8 fix gitea workflow path and runner label
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 7m49s
2026-03-04 04:28:54 -08:00
b08202fd08 fix gitea workflow path and runner label
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 7m52s
2026-03-04 03:30:17 -08:00
6c370485d1 fix gitea workflow path and runner label
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
2026-03-04 03:07:41 -08:00
0c544268e5 refactor payment platform canonicalization and order method consistency
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
2026-03-04 02:15:32 -08:00
82626dd749 fix device decrypt flow and delete_account response stability
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 8m0s
2026-03-04 01:37:11 -08:00
8bdc8afea3 fix gitea workflow path and runner label
Some checks failed
Build docker and publish / build (20.15.1) (push) Failing after 7m54s
2026-03-03 19:10:59 -08:00
b0eb6595ac add: 新增ci diamanté 2026-03-03 17:29:45 -08:00
4d8516b2e1 同步历史版本代码 2026-03-03 09:32:22 -08:00
EUForest
31e75efacb Merge upstream/master into master 2026-02-13 23:06:43 +08:00
EUForest
34372fe0b3 fix(redemption): enhance redemption code flow with transaction safety and idempotency
This commit addresses critical issues in the redemption code activation flow
to ensure data consistency, prevent duplicate redemptions, and improve user
experience.

Key improvements:

1. Transaction Safety (P0)
   - Wrap subscription creation, used count update, and record insertion in
     a single database transaction
   - Ensure atomicity: all operations succeed or all rollback
   - Prevent orphaned records and data inconsistencies

2. Idempotency Protection (P0)
   - Add redemption record check before processing to prevent duplicate
     operations on queue task retries
   - Maintain idempotency at multiple layers: interface, order, and record

3. Distributed Lock (P1)
   - Implement Redis-based distributed lock (10s timeout) to prevent
     concurrent duplicate redemptions
   - Lock key format: redemption_lock:{user_id}:{code}

4. IsNew Field Correction (P2)
   - Fix IsNew field to correctly determine first-time purchases using
     IsUserEligibleForNewOrder method
   - Ensure accurate statistics and future commission calculations

5. Quota Pre-check (P2)
   - Add quota validation at interface layer for immediate user feedback
   - Prevent "processing" status followed by eventual failure

6. Extended Cache TTL (P2)
   - Increase Redis cache expiration from 30 minutes to 2 hours
   - Ensure queue tasks can retrieve redemption data even with delays

7. Error Handling (P2)
   - Clean up Order records when Redis cache or queue enqueue fails
   - Prevent orphaned Order records in the database

8. Cache Clearing Optimization
   - Add user subscription cache clearing after activation
   - Ensure both node-side and user-side display latest subscription info

Technical details:
- Modified: internal/logic/public/redemption/redeemCodeLogic.go
- Modified: queue/logic/order/activateOrderLogic.go
- Modified: internal/model/redemption/default.go (transaction support)

Testing:
- All changes compiled successfully
- Comprehensive flow verification completed
- Ready for production deployment

BREAKING CHANGE: None
2026-02-09 01:07:39 +08:00
Chang lue Tsen
701d47ed21 feat(order): add validation for quantity and amount limits in order requests 2026-02-08 06:41:23 -05:00
EUForest
7e08a07e29 fix: resolve balance payment issue with coupon and fee calculation
This commit fixes the inconsistent calculation logic between order preview
and actual order creation, which caused balance payment failures when using
coupons.

Changes:
- Standardized fee calculation order in both preCreateOrderLogic and purchaseLogic
- Moved gift amount deduction after fee calculation to ensure correct total
- Removed premature gift amount deduction before transaction in purchaseLogic
- Gift amount is now only deducted within the database transaction

The calculation order is now unified:
1. Apply coupon discount
2. Calculate handling fee based on post-coupon amount
3. Deduct gift amount from total (including fee)

This ensures the preview amount matches the actual payment amount.
2026-02-06 23:14:04 +08:00
EUForest
37200698ab update: redis config 2026-01-31 12:08:12 +08:00
EUForest
ffe589ff77 feat: Device short code lookup 2026-01-31 11:52:09 +08:00
5f1a546bbe fix: resolve trial subscription cache issue on new user registration
When new users register with trial subscription enabled, the subscription
link fails to connect in Clash clients. This is caused by missing cache
invalidation after transaction commit.

Changes:
- Add cache clearing after successful trial subscription creation
- Clear user subscription cache, subscription details cache, and server cache
- Modify activeTrial functions to return subscription object for cache clearing
- Apply fix to all registration methods: email, phone, device, and OAuth

This ensures subscription links work immediately after registration without
requiring manual subscription reset.
2026-01-22 23:57:15 +07:00
EUForest
5f55b1242e fix: resolve order queue loss issue with retry mechanism and idempotency
- Fix task error handling: return actual errors instead of nil to enable retry
- Add idempotency check: skip processing for already finished orders
- Extend temp order cache: increase from 15 minutes to 24 hours
- Configure retry policy: add MaxRetry(5) for all payment callbacks (Epay, Alipay, Stripe)

This fixes the critical issue where paid orders were being lost due to:
1. Failed tasks being marked as successful and deleted from queue
2. Temporary order info expiring before queue processing
3. No retry mechanism for transient failures

Changes:
- queue/logic/order/activateOrderLogic.go: Fix error returns and add idempotency
- internal/logic/public/portal/purchaseLogic.go: Extend cache to 24 hours
- internal/logic/notify/*NotifyLogic.go: Add retry configuration
2026-01-12 18:30:42 +08:00
EUForest
7d4a19c9a3 fix: add quota limit check to prevent subscription bypass
- Add quota check in preCreateOrderLogic for order preview
- Move quota check inside transaction in purchaseLogic to prevent race condition
- Add quota check in activateOrderLogic as final safeguard when creating subscription
- Add quota check in redeemCodeLogic when redeeming codes for new subscriptions
2026-01-10 21:18:26 +08:00
EUForest
3359704a45 feat: add short_code field to device login API
- Add optional short_code parameter to DeviceLoginRequest
- Add ShortCode field to Device model
- Save short_code to database during device registration
- Add database migration for user_device.short_code column
- Fix duplicate variable declaration in routes.go
2026-01-10 18:11:24 +08:00
Chang lue Tsen
1995987f00 feat(config): add PaddingScheme to configuration and update server config logic 2026-01-07 09:39:10 -05:00
Chang lue Tsen
7d84cf858b fix(currency): initialize exchange rate to 0 and improve error logging in purchase checkout 2026-01-07 09:35:52 -05:00
EUForest
ed669d0620 feat: remove v prefix from service version and disable SECRET_KEY check 2026-01-07 14:40:07 +08:00
EUForest
8f783b162c feat: redemption code 2026-01-06 16:24:24 +08:00
EUForest
23ef9dbff1 feat: bind device limit 2026-01-06 16:15:47 +08:00
EUForest
3f3b0ae6ad up: Redemption Code 2026-01-06 16:15:10 +08:00
EUForest
518595b058 feat: Redemption Code 2026-01-05 17:53:31 +08:00
EUForest
5beff61e91 Merge upstream/master into develop
Sync upstream changes from perfect-panel/server

  Includes updates from v1.0.1 to v1.2.5:
  - Currency configuration support
  - Subscribe improvements (short token, inventory check, etc.)
  - Node management enhancements
  - Database migrations
  - Bug fixes and optimizations
2026-01-03 23:21:41 +08:00
Tension
90e2f24d46 fix(config): conditionally set SubscribePath based on gateway mode 2026-01-03 18:05:17 +08:00
EUForest
80ee9a6acf Merge upstream/master into develop
Sync upstream changes from perfect-panel/server

  Includes updates from v1.0.1 to v1.2.5:
  - Currency configuration support
  - Subscribe improvements (short token, inventory check, etc.)
  - Node management enhancements
  - Database migrations
  - Bug fixes and optimizations
2026-01-02 12:51:55 +08:00
Tension
798fb9e245 feat(currency): add currency configuration support and integrate into payment processing 2025-12-31 11:47:24 +08:00
Tension
780e71441d fix(subscribe): refactor getSubscribeV2URL to remove token parameter and adjust URL construction 2025-12-31 10:53:50 +08:00
Tension
77a5373d44 feat(adapter): add support for additional parameters in Adapter and Client structs 2025-12-30 14:39:15 +08:00
Tension
8436c2d6ee feat(subscribe): add short token generation for user subscriptions 2025-12-30 14:06:46 +08:00