Commit Graph

101 Commits

Author SHA1 Message Date
shanshanzhong147 7308aa9191 无订阅 支付后出现两个订阅
Build docker and publish / build (20.15.1) (push) Failing after 7m37s
2026-03-05 21:53:36 -08:00
shanshanzhong147 70c0483ca9 修复订阅
Build docker and publish / build (20.15.1) (push) Failing after 8m2s
2026-03-04 23:08:46 -08:00
shanshanzhong147 4752f844ef 各种配置项修复,优化到后台管理端配置
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-03-04 17:58:40 -08:00
shanshanzhong147 a01570b59d fix gitea workflow path and runner label
Build docker and publish / build (20.15.1) (push) Failing after 8m21s
2026-03-04 06:33:14 -08:00
shanshanzhong147 b0eb6595ac add: 新增ci diamanté 2026-03-03 17:29:45 -08:00
shanshanzhong147 4d8516b2e1 同步历史版本代码 2026-03-03 09:32:22 -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
EUForest ffe589ff77 feat: Device short code lookup 2026-01-31 11:52:09 +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
EUForest f452838c63 Merge upstream/master into develop 2026-01-06 18:52:28 +08:00
EUForest ec0a0f968e up: Redemption Code 2026-01-06 16:15:24 +08:00
EUForest 518595b058 feat: Redemption Code 2026-01-05 17:53:31 +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 577490749c feat(subscribe): update inventory logic in subscribe table and add migration scripts 2025-12-29 13:29:12 +08:00
Tension d332e760f8 feat(subscribe): add ShowOriginalPrice field and related database changes 2025-12-28 17:08:26 +08:00
Tension 31e634ba66 feat(user): add handlers and logic for resetting user subscribe token and traffic 2025-12-28 16:49:28 +08:00
Chang lue Tsen 67f16ead82 feat(user): add unscoped filter to include soft-deleted records in user queries 2025-12-27 10:57:34 -05:00
Chang lue Tsen a9c832cb7c feat(user): implement soft deletion for user accounts and update related logic 2025-12-27 10:45:28 -05:00
Chang lue Tsen ec510b66fb refactor(server): remove deprecated server types and related methods for cleaner codebase 2025-12-23 07:48:03 -05:00
EUForest 76ff9a658d Merge branch perfect-panel/master/server into develop 2025-12-11 23:53:32 +08:00
Tension 143445a2fc feat(commission): implement commission withdrawal logic and logging 2025-11-29 14:33:05 +08:00
Chang lue Tsen 7277438b07 feat(user): add commission withdrawal and query withdrawal log functionality 2025-11-26 12:13:33 -05:00
Chang lue Tsen 429e535dd4 feat(user): add endpoint and logic for updating user rules 2025-11-24 09:05:49 -05:00
EUForest b9d3446407 Bug fix: Clear server user node cache 2025-11-09 17:18:25 +08:00
EUForest b7eafd0892 Update: Account display priority: phone number > email > device ID 2025-11-08 17:05:05 +08:00
EUForest 52ce054b35 Add: Server location latitude and longitude 2025-11-04 14:53:43 +08:00
EUForest 2605d22f8e Add: ClearServerAllCache Func 2025-11-01 16:05:37 +08:00
lain d8e2e81688 add user subscribe note 2025-10-31 10:00:31 +08:00
Ember Moth 8b48286365 add payment type field (alipay/wxpay) to EPay config 2025-10-15 23:20:33 +09:00
EUForest 96808d531a Application device interface encryption and other bug fixes (#87)
* add: device login

* update: global config

* add: User transmission interface encryption

* update: get global config

* update: User transmission interface encryption

* add: get device list

* add: SecretIsEmpty Message

* update: device middleware

* add: query user subscribe node list

* fix bug: query device list

* fix bug: unbind device

* update: device login

* fix bug: The ad table is missing the description field

* fix bug:page size is zero

* update: Device Middleware

* fix bug: Site custom data update failed
2025-10-15 10:09:19 -04:00
Chang lue Tsen 8562734fde feat(user): add encryption algorithm and salt fields to User model for migrate 2025-10-09 13:33:03 -04:00
Chang lue Tsen 29dd54546d fix(model): enhance InSet function for multi-value OR queries 2025-10-04 11:51:47 -04:00
Chang lue Tsen c5be0081ca fix(model): simplify tag filtering using GORM scopes 2025-10-03 14:53:52 -04:00
Chang lue Tsen 766e210f06 fix(node): update FilterNodeParams to use NodeId and adjust query logic for tags 2025-09-29 11:18:47 -04:00
Chang lue Tsen d6fcff1fee fix(node): NodeId filter to FilterNodeParams and update cache clearing logic 2025-09-29 10:22:11 +09:00
Chang lue Tsen 5aa9bb61b7 refactor(server): remove Ratio field from Server struct and update adapter logic 2025-09-28 11:18:33 -04:00
Chang lue Tsen 0d1df5f905 feat(config): enhance NodeConfig with TrafficReportThreshold, IPStrategy, DNS, Block, and Outbound fields 2025-09-28 19:06:29 +09:00
Chang lue Tsen 64f0bcc55a feat(cache): implement cache clearing for node operations and add delete methods 2025-09-27 11:24:29 -04:00
Chang lue Tsen d2ca3eb961 fix(subscribe): add Enabled filter to node query parameters 2025-09-27 10:18:08 -04:00
Chang lue Tsen 4ad18a8b70 fix(model): update save method to use specific ID for record updates 2025-09-16 11:20:48 -04:00
Chang lue Tsen 596434454c feat(client): add additional options for Shadowsocks and Vless protocols 2025-09-16 11:20:39 -04:00
Chang lue Tsen 26fe430d7c fix(subscribe): update status filter in subscription count query 2025-09-16 10:16:56 -04:00
Chang lue Tsen 0c55d173cb fix(model): add sorting to server and node queries 2025-09-16 10:10:11 -04:00
Chang lue Tsen 2c5efa2026 feat(protocol): add server protocol configuration query and enhance protocol options 2025-09-13 14:20:04 -04:00
Chang lue Tsen 3f5aac239b feat(quota): enhance quota task management with new request structures and processing logic 2025-09-10 14:53:48 -04:00
Chang lue Tsen d1be5febc3 feat(quota): add quota task creation and querying endpoints with updated data structures 2025-09-09 13:39:05 -04:00
Chang lue Tsen 4d95834c22 feat(payment): add support for CryptoSaaS payment platform and enhance configuration handling 2025-09-06 12:22:39 -04:00
Chang lue Tsen 0199dc7fa2 feat(log): add logging for balance, gift amount, and commission adjustments 2025-09-05 11:00:19 -04:00
Chang lue Tsen 1d878592ed fix(log): rename OrderId to OrderNo for consistency in balance logging 2025-09-05 10:25:19 -04:00
Chang lue Tsen 2f4cc46a38 fix(log): correct comment for CommissionTypeRefund to improve clarity 2025-09-05 09:51:28 -04:00