shanshanzhong147
634b5a7bd0
feat(simnet): add SimNet protocol end-to-end support
...
- model: SimNet protocol fields + NormalizeSimnet; type+port protocol uniqueness
- server config: OmnXT runtime config delivery via compatible() simnet case
- credentials: derive per-user psk/key_id from subscription (pkg/simnet), no new table
- subscription: adapter buildOmnxtSimnetConfigs + base64 buildOmnxtProtocolLinks + OmnXT SimNet application (migration 02161)
- UA gating: hide experimental protocols from non first-party clients (download + JSON node-list)
- admin: normalize simnet on create/update and on GET responses
- tests: 21 simnet unit tests; full suite green
2026-07-27 00:17:02 -07:00
shanshanzhong147
eac0137069
修复( #4 ): 统一 API 响应格式 — ResponseErrorBean 补 data 字段
...
Closes part of HIF-4 (Stage 2 前端集成反馈 F9 - 全站响应格式)
F9 (P1): 全站响应统一 {code, msg, data} 三字段固定 shape
- ResponseSuccessBean.Data 去掉 omitempty → 空 payload 也返 "data":null
- ResponseErrorBean 加 Data interface{} 字段 → 错误响应也带 "data":null
- App 端强类型 decoder 依赖固定字段 shape,缺 data 键会解码失败
回归护栏 3 用例:
- TestResponseErrorBean_HasDataField: 错误响应必须含 "data":null
- TestResponseSuccessBean_DataAlwaysPresent: Success(nil) 也含 "data":null(防 omitempty 回退)
- TestResponseSuccessBean_WithPayload: 正常 payload 序列化正确
影响面:全站所有响应(不止 lottery),JSON 加字段/字段值变 null 对现有 client 无 breaking(宽松 decoder 全兼容)
CI 全绿;单 file 改动 revert 一步搞定
2026-07-12 19:55:35 -07:00
shanshanzhong147
07409eb602
新功能( #4 ): 抽奖 Stage 2 人工奖领奖工单(crypto / physical / manual_other)
...
Closes HIF-4
Stage 2 交付:人工奖领奖工单完整闭环。crypto / physical / manual_other 三类奖品从抽中到 mark-paid 的全流程可用。
- 迁移 02159_lottery_claim:UNIQUE(draw_id) + 3 支持索引,状态机 pending_claim→reviewing→paying→paid,rejected 可复活,超时 expired
- 3 个 PrizeHandler:Dispatch→ErrDispatchNotSupported 兜底、ClaimSchema 各自形态、ValidateClaim 表驱动
- BuildCryptoClaimSchema:抽中时按奖品 config.networks 注入 enum,前端下拉直接可用
- Draw service dispatchOrEnqueueClaim:人工奖同 tx 插 pending_claim(回滚双清),nonce 重放回读 ExpiresAt + ClaimFormSchema
- POST /claim 实装:ownership 校验 → prize 类型校验 → handler.ValidateClaim → crypto network 白名单二次校验 → tx CAS status IN (pending_claim, rejected) AND expires_at > now
- Admin CRUD 5 接口:list(IN 批拉 snap + user,无 N+1)、summary(GROUP BY 一次拿计数 + overdue 单查)、approve/reject/mark-paid 全走 CAS + audit
- Scheduler @every 1h 扫过期,级联 lottery_draw.dispatch_state → expired
- 新增错误码 100005-100011(already_submitted / invalid_claim_data / draw_not_found / not_your_draw / claim_expired / claim_state_invalid)
- Rebase 后 Stage 2 测试主动 reuse PR E 的 unmetReasonsNotEmpty + evaluatedAtNotZero matcher,人工奖分支若绕过守卫会立即挂
- Stage 1 全部 4 处 guardrail 后端 rebase 时自检过:UnmetReasons、EvaluatedAt、GrantLedger.Payload、AdminMetaMiddleware 全保留
CI 全绿;28 files, +2442/-126;覆盖率 handler 78.9% / model.lottery 74.3% / draw 68.7% / queue/lottery 76.9%
2026-07-10 04:01:34 -07:00
shanshanzhong147
92cf2921dd
修复( #3 ): 抽奖 Stage 1 后台审计 IP/UA 丢失 + 冒烟脚本 Bearer 前缀
...
Closes HIF-3 (Stage 1 P1 defects from QA smoke report)
F2: admin_action_log.ip / user_agent 恒为空
- 根因:requestMeta 从 ctx 读裸字符串 key,全库无 writer 塞
- 修复:新增 AdminMetaMiddleware 用 typed constant.CtxKeyIP / CtxKeyUserAgent
- 挂载:lottery admin 组末尾(不 gate access)
- 回归护栏:UsesTypedKey + IgnoresBareStringKeys 双向断言 typed key,防止未来退化回裸字符串
F3: qa/lottery/stage1_curl.sh Bearer 前缀
- 删除两处 Bearer 前缀 + 加注释说明 ppanel AuthMiddleware 不 strip
单测 5 用例全绿;scope 严格限于 lottery admin 组,其它路径零改动;无 DB 变更。
Merged: architect review 后,将触发 staging 二次部署 — 期望这次能一并解决 shanshanzhong147 手工 SSH 后 Lottery.Enable=true 未生效的问题(若真是 mount/restart 未正确 pick up)。
2026-07-09 07:45:58 -07:00
shanshanzhong147
ce3babcc33
新功能( #3 ): 抽奖 Stage 1 收官 — 用户 API + 后台 CRUD + 集成
...
Closes HIF-3
Stage 1 完整闭环 PR C:用户 API + 后台 CRUD + 抽奖事务服务 + 审计 + QA curl。合并后 Stage 1 可交测试。
架构师 review R1(rulecaps depth≤8/nodes≤64/bytes≤8KB)+ R2(InviteHook source_ref 加 order: 前缀)已全部落地。
- 迁移 02158_admin_action_log:后台写操作审计
- xerr 100xxx 段:抽奖错误码(NotEligible/NoChances/ActivityEnded/RateLimited/NotClaimable/InternalError/RuleTooDeep/RuleTooMany/RuleTooLarge)
- feature flag config.Lottery.Enable 默认 false,合并后线上零副作用
- draw service:feature flag → rate limit → pre-tx reads → nonce dedupe → Consume → Pick → 乐观扣库存 → 双快照 → Dispatch → finalize
- 用户 API 4 个:GET /config、POST /draw、GET /records、POST /claim(Stage 1 返回 100010)
- 后台 CRUD:活动 / 奖品 / rules PUT(rulecaps gate)/ chances/grant
- audit.WriteAdminAction:与调用方 tx 同生共死,SHA1 body 摘要
- QA 脚本:qa/lottery/stage1_curl.sh 全链路 curl
测试覆盖:model 76.5% / draw 69% / handler 68.3% / hook 91.9% / rulecaps 87.8% / audit 100%
100 并发抢库存 + 10000 次概率分布 e2e 推 QA 环境(sqlmock 无法忠实模拟 InnoDB 行锁)
CI 全绿:构建/Vet/测试 + golangci-lint
2026-07-08 22:33:18 -07:00
shanshanzhong147
87ebfa1fac
修复( #137 ): DeferCloseOrder 关单前反查支付网关 (启用 confirmationPayment)
...
Build docker and publish / build (20.15.1) (push) Failing after 18m47s
Build docker and publish / build (20.15.1) (pull_request) Failing after 19m31s
Squash merge of fix/137-defer-close-反查网关 (1367c4f ).
DeferCloseOrder 直接将 status=1 订单关单,会把已经在网关侧完成支付但
notify 静默失败的订单错误关闭。本次在关单前调用 EPay 的网关查询接口
(confirmationPayment) 拿到三态结果:
- Paid: 原子化把 status 1->2,写回 trade_no,再投递 asynq 走激活流程
- Unpaid: 继续原来的 close 事务,把 status 改为 cancelled
- Unknown / 网关失败: 保持 status=1,下一轮 DeferClose 再试
新增 closeOrderLogic_test.go (232 行),覆盖三态分支 + recoverPaidOrder
的并发幂等。单测全量 PASS, go build + go vet 均干净。E2E 验收因测试环境
访问受限暂未跑,QA 已在 issue 上注明阻塞原因 (qa_partial_blocked_on_e2e_access)。
Co-authored-by: multica-agent <github@multica.ai >
2026-06-02 20:24:32 -07:00
架构师
54379976ec
修复( #138 ): 补齐 errMsg 漏掉的错误码映射
...
Build docker and publish / build (20.15.1) (push) Failing after 20m57s
Build docker and publish / build (20.15.1) (pull_request) Failing after 19m44s
新增 UserCommissionNotEnough、SendSmsError、AreaCodeIsEmpty、
DeviceBindLimitExceeded、ExistAvailableTraffic 五个错误码的中文映射,
修复管理后台审批提现等接口业务校验失败时 msg 被误显为
"Internal Server Error" 的问题。
Co-authored-by: multica-agent <github@multica.ai >
2026-06-01 22:29:36 -07:00
shanshanzhong147
197fed7d12
新功能( #102 ): 新增邀请记录接口并删除旧邀请销售接口
...
Build docker and publish / build (20.15.1) (push) Failing after 10m56s
Build docker and publish / build (20.15.1) (pull_request) Successful in 8m50s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-27 22:50:16 -07:00
shanshanzhong147
80751eb8ef
fix: move withdrawal commission deduction from application to approval
...
Build docker and publish / build (20.15.1) (push) Failing after 8m28s
- commissionWithdrawLogic: remove upfront commission deduction;
balance check now includes sum of all pending withdrawals to prevent
double-spending; transaction only creates the withdrawal record (status=0)
- approveWithdrawal: add FOR UPDATE lock on user row, balance check before
deducting, atomic commission decrement and commission log inside one
transaction; clear user cache after commit
- rejectWithdrawal: remove commission refund and log — commission was never
deducted on application under the new flow
- add migration 02150: refund commission for existing status=0 withdrawals
that were deducted under the old logic; includes rollback script
Co-authored-by: multica-agent <github@multica.ai >
2026-05-24 20:26:42 -07:00
shanshanzhong147
1726a584fa
feat: add admin order refund flow
...
Co-authored-by: multica-agent <github@multica.ai >
2026-05-24 17:50:23 -07:00
shanshanzhong147
f2033fd4b9
feat: add rustfs direct upload endpoint
Build docker and publish / build (20.15.1) (push) Failing after 8m36s
2026-05-14 23:33:50 -07:00
shanshanzhong147
4fa9fcd232
feat: add direct s3 upload flow
2026-05-13 11:24:13 -07:00
shanshanzhong147
f6911965dc
chore: snapshot current aws standby and backup tooling work
2026-05-13 10:59:03 -07:00
shanshanzhong147
c4b2ebf7e1
x
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-05-10 10:41:50 -07:00
shanshanzhong147
bcefb274ab
perf(server): cache speed limit calculations
Build docker and publish / build (20.15.1) (push) Successful in 5m37s
2026-04-29 01:37:59 -07:00
shanshanzhong147
ab38cd4943
x
Build docker and publish / build (20.15.1) (push) Failing after 4m44s
2026-04-26 21:12:22 -07:00
shanshanzhong147
a9205cc3fc
feat: 用户订阅显示节点分组名及限速起止时间
...
Build docker and publish / build (20.15.1) (push) Successful in 7m28s
- UserSubscribe/UserSubscribeDetail 新增 node_group_id/node_group_name 字段
- 管理员查询用户订阅列表批量填充分组名
- 管理员查询单个订阅详情填充分组名
- ThrottleResult/UserSubscribeDetail 新增 throttle_start/throttle_end 字段
- 限速时返回限速窗口起止时间(秒级 Unix 时间戳)
Co-Authored-By: claude-flow <ruv@ruv.net >
2026-03-29 10:07:17 -07:00
shanshanzhong147
3b4e882965
feat: 根据 X-App-Id 判断是否裁剪套餐列表,老版客户端去掉最后一个
Build docker and publish / build (20.15.1) (push) Successful in 7m37s
2026-03-28 23:21:00 -07:00
shanshanzhong147
eb414749c3
fix: apiversion.UseLatest 阈值判断改为 >= 避免误判新版本为老版本
...
Build docker and publish / build (20.15.1) (push) Successful in 8m26s
原 compare > 0 要求严格大于阈值,导致 header=1.0.0 被判为老版本,
去掉最后一个套餐后列表为空。改为 >= 0,有 header 且版本 >= 阈值均视为新版本。
Co-Authored-By: claude-flow <ruv@ruv.net >
2026-03-28 20:42:57 -07:00
shanshanzhong147
2db2bc0860
feat: 限速状态可视化 - 后台订阅详情展示实际限速与降速状态
...
Build docker and publish / build (20.15.1) (push) Successful in 8m7s
- 新增 pkg/speedlimit/calculator.go 公共限速计算函数
- UserSubscribeDetail 响应新增 effective_speed/is_throttled/throttle_rule 字段
- GetUserSubscribeById 接口查询时实时计算并返回限速状态
- 重构 getServerUserListLogic 的 calculateEffectiveSpeedLimit,改用共享函数
Co-Authored-By: claude-flow <ruv@ruv.net >
2026-03-28 08:14:07 -07:00
shanshanzhong147
b43dcd8dab
merge: 同步 origin/master 新功能到定制版本
Build docker and publish / build (20.15.1) (push) Successful in 8m8s
2026-03-24 01:03:56 -07:00
EUForest
7fe7243c24
feat: Add slider verification code
2026-03-23 02:42:12 +08:00
shanshanzhong147
f703b5089a
分组概念
Build docker and publish / build (20.15.1) (push) Successful in 7m58s
2026-03-19 03:21:47 -07:00
shanshanzhong147
e5e9f93f68
Merge remote-tracking branch 'origin/master' into internal
2026-03-19 01:55:01 -07:00
shanshanzhong147
de6fbcb518
device_no
Build docker and publish / build (20.15.1) (push) Successful in 7m22s
2026-03-18 10:28:55 -07:00
EUForest
bc721b0ba6
update: Adding interference to CAPTCHA
2026-03-18 12:45:09 +08:00
shanshanzhong147
4b528184ea
devicd_no
Build docker and publish / build (20.15.1) (push) Successful in 7m58s
2026-03-17 08:37:36 -07:00
shanshanzhong147
dcdbabdb13
注销
Build docker and publish / build (20.15.1) (push) Successful in 7m34s
2026-03-17 07:12:42 -07:00
shanshanzhong147
3d732c0361
feat: 为用户设备添加 DeviceNo 字段并实现 ID 混淆,同时在迁移脚本中新增 ID 重建逻辑。
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-03-15 19:38:37 -07:00
shanshanzhong147
7c2eddf9c3
feat: 为订单表添加 app_account_token 字段并增强 Apple IAP 对账逻辑,支持通过交易历史记录查找。
Build docker and publish / build (20.15.1) (push) Successful in 7m25s
2026-03-10 20:47:24 -07:00
EUForest
0f6fddc36d
feat(error): add PermissionDenied error code
...
- Add error code 40008 for permission denied scenarios
- Add corresponding error message for admin permission checks
2026-03-09 22:53:59 +08:00
EUForest
0dbcff85f1
feat(captcha): add captcha service interface and implementations
...
- Add captcha service interface with Generate and Verify methods
- Implement local image captcha using base64Captcha library
- Implement Cloudflare Turnstile verification wrapper
- Support Redis-based captcha storage with 5-minute expiration
- Add factory method for creating captcha service instances
2026-03-09 22:53:13 +08:00
shanshanzhong147
130fb702ab
fix: IAP 支付流程优化与关键 bug 修复
...
Build docker and publish / build (20.15.1) (push) Successful in 7m42s
- getStatusLogic 类型断言修复(*user.User)
- restoreLogic 事务拆分为单条处理 + appAccountToken 解析
- attachTransactionLogic 提取 ParseProductIdDuration 共享函数
- 新增 config_helper.go 统一 Apple API 配置加载
- reconcileLogic 补充 BundleID 配置读取
- activateOrderLogic 邀请赠送天数逻辑完善
Co-Authored-By: claude-flow <ruv@ruv.net >
2026-03-09 00:27:16 -07:00
EUForest
39310d5b9a
Features:
...
- Node group CRUD operations with traffic-based filtering
- Three grouping modes: average distribution, subscription-based, and traffic-based
- Automatic and manual group recalculation with history tracking
- Group assignment preview before applying changes
- User subscription group locking to prevent automatic reassignment
- Subscribe-to-group mapping configuration
- Group calculation history and detailed reports
- System configuration for group management (enabled/mode/auto_create)
Database:
- Add node_group table for group definitions
- Add group_history and group_history_detail tables for tracking
- Add node_group_ids (JSON) to nodes and subscribe tables
- Add node_group_id and group_locked fields to user_subscribe table
- Add migration files for schema changes
2026-03-08 23:22:38 +08:00
shanshanzhong147
1e14e2dbd9
map对齐
Build docker and publish / build (20.15.1) (push) Successful in 7m7s
2026-03-07 07:16:01 -08:00
shanshanzhong147
4d913c1728
修复缓存
Build docker and publish / build (20.15.1) (push) Successful in 7m26s
2026-03-06 21:58:29 -08:00
shanshanzhong147
7308aa9191
无订阅 支付后出现两个订阅
Build docker and publish / build (20.15.1) (push) Failing after 7m37s
2026-03-05 21:53:36 -08:00
shanshanzhong147
2215df8c0b
各种配置项修复,优化到后台管理端配置
2026-03-04 19:42:21 -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
0c544268e5
refactor payment platform canonicalization and order method consistency
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
2026-03-04 02:15:32 -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
31e75efacb
Merge upstream/master into master
2026-02-13 23:06:43 +08:00
EUForest
7197f5dcf6
feat(stripe): update webhook event construction to ignore API version mismatches
2026-02-11 17:29:53 +08:00
Chang lue Tsen
ea94f3c9f9
feat(stripe): update webhook event construction to ignore API version mismatches
2026-02-08 06:43:34 -05:00
Chang lue Tsen
58caa497c3
fix(exchange): update exchange rate API endpoint and adjust request parameters
2026-01-07 09:35:09 -05: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
fb6adc9ae3
feat(subscribe): add inventory check and update logic for subscription plans
2025-12-28 22:44:14 +08:00
Tension
495c4529ed
fix(gorm): adjust caller skip for logging methods to improve stack trace accuracy
2025-12-28 21:52:54 +08:00