shanshanzhong147
cce147108c
修复( #4 ): 抽奖 8 宫格默认值 + 100500 msg 脱敏
...
Closes part of HIF-4 (Stage 2 前端集成反馈 F8 + F10)
F8 (P1): Activity.GridSize 默认值 9 → 8
- migration 02160 ALTER DEFAULT 8(幂等)
- 02156 up.sql 注释同步更新
- admin/lottery.go 兜底值 9 → 8
- 布局 A:3x3 挖中心,中心是抽奖按钮不是奖品
F10 (P1): wrapInternal msg 脱敏
- 内部错误 err.Error() 只写日志,不外传
- 用户端 msg 只带通用文案 (xerr.MapErrMsg lookup)
- 回归护栏:TestWrapInternal_ScrubsErrorDetailsFromMsg + TestWrapInternal_PreservesCodeErrors
CI 全绿;无 API 契约变更;F9 独立在 PR #45 处理
2026-07-12 19:55:25 -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
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
a46fb83054
新功能( #3 ): 抽奖 Stage 1 handler 真实业务对接 + 邀请钩子
...
Closes HIF-3 (阶段 PR B)
PR B:handler 真实业务对接 + 邀请钩子(迭代含 R1 修复)
- 迁移 02157_lottery_grant_ledger:external_ref UNIQUE 作为发奖幂等键
- log.CommissionTypeLottery=339(架构师批准的新常量)
- DispatchRequest.IdempotencyKey(架构师 review 建议第 2 条)
- GrantLedger + LedgerService.Reserve:INSERT ON CONFLICT DO NOTHING 幂等 upsert
- VPNDurationHandler:ResolveEffectiveUser 归位家庭 owner + UpdateSubscribe,ExpireTime 三分支对齐 grantGiftDays
- CommissionHandler:UpdateCommission + WriteCommissionLog(339),发给中奖者本人,不做家庭组归位
- Handler 从 model 层迁到 logic 层(避免 model → logic 反向依赖);noop 保留在 model 层
- InviteHook:fire-and-forget 独立 goroutine + 10s timeout,扫 running 活动的 invite_success 源
- ServiceContext 新增 LotteryChance / LotteryLedger / LotteryInviteHook
- activateOrderLogic.handleCommission 两条分支通过 invokeInviteHookIfEligible 助手触发,助手内统一 gate IsNew(架构师 R1 打回后的修复)
架构师 R1 打回:branch B 未按"首次付款激活"gate,续费也会给 referer 发抽奖机会 → 已通过助手函数集中收拢,避免 branch A/B 判断漂移。
测试覆盖率:model 76.5% / handler 73.2% / hook 91.7%;补 4 个回归测试覆盖 IsNew 门槛(含关键的 DoesNotFireOnRenewal)。
线上仍零可见变更:无对外路由,钩子仅在活动 status=running 时生效,Stage 1 全流程无活动记录时 loadRunningActivities 返回空。
2026-07-08 21:19:28 -07:00
shanshanzhong147
9933d34bdd
新功能( #3 ): 抽奖活动 Stage 1 骨架(DB + 规则引擎 + Handler 抽象)
...
Closes HIF-3
Stage 1 骨架:7 张表迁移 + 门槛规则引擎 + 加权选奖 + 次数入账/消耗(幂等)+ 发奖 handler 抽象与注册表。
- 单测覆盖 75.5%(未覆盖行 = stub handler ErrNotImplemented,合理)
- CI 全绿(构建/Vet/测试 + golangci-lint)
- 骨架不接入真实业务,vpn_duration/commission handler 在 Dispatch 中返回 ErrNotImplemented;合并后线上零变更
架构师 review 通过,4 项决策已在 issue 上给出:
1. 邀请转化语义 = 首次付款激活
2. 佣金日志类型 = 新增 CommissionTypeLottery=339
3. 家庭组归属 = 穿透到 owner
4. 管理端 IP 白名单 = 不做(推到 nginx/ingress 层)
后续 PR B/C 补真实业务对接 + 用户 API + 后台 CRUD + 集成/并发/概率测试。
2026-07-08 20:05:05 -07:00
shanshanzhong147
3e265bd837
新功能: 还原 v1/public/user/invite_sales 接口 + promo schema 修复迁移
...
Build docker and publish / build (20.15.1) (push) Failing after 13m47s
Build docker and publish / build (20.15.1) (pull_request) Failing after 15m7s
- 还原 /v1/public/user/invite_sales 接口及 /invite/sales 别名(与 invite_records 并存)
逻辑/handler/types 与 197fed7d 删除前版本完全一致,按 fefbd4f5 新 routes 结构注册
- 新增迁移 02155_promo_schema_fix: 幂等修复 subscribe_promo / order 列类型与索引偏差
- 同步 etc/ppanel.yaml 数据库连接配置
- 补齐相关需求与设计文档
2026-05-28 20:46:37 -07:00
shanshanzhong147
82eff47f38
新功能( #69 ): 用户级限速覆盖 — 数据层 + 核心逻辑 + 管理接口
...
Build docker and publish / build (20.15.1) (push) Failing after 8m52s
Build docker and publish / build (20.15.1) (pull_request) Successful in 7m51s
- 新增 migration 02153: user_subscribe 表添加 speed_limit、traffic_limit 列(幂等)
- model 层 Subscribe/SubscribeDetails 新增用户级限速字段(*string 类型支持 nil 回退)
- server 用户列表和管理员详情接口支持用户级限速覆盖优先级计算
- 更新管理员订阅更新接口支持写入/清除用户级限速
Co-authored-by: multica-agent <github@multica.ai >
2026-05-27 08:07:16 -07:00
shanshanzhong147
02b41e7a2c
修复( #85 ): 促销系统 quantity 设计修正补丁(跨任务统一修复)
...
Build docker and publish / build (20.15.1) (push) Failing after 8m50s
Build docker and publish / build (20.15.1) (pull_request) Successful in 8m19s
- subscribe_promo 表加 quantity 字段,BIGINT NOT NULL DEFAULT 1
- EvaluatePromo 加 quantity 参数,按 subscribeID + quantity 精确匹配
- Promo 从 Subscribe 顶层移到 SubscribeDiscount
- 查询加 quantity,返回 map[subscribeID][quantity] 二级映射
- recordPromoUsage 错误向上传播,不再静默吞掉
- preCreate 和 purchase 的 allowPromo 判定统一为 orderType==1
- 迁移脚本增加幂等处理(guarded DROP/ADD/MODIFY)
Co-authored-by: multica-agent <github@multica.ai >
2026-05-27 05:57:21 -07:00
shanshanzhong147
c90edac630
修复( #73 ): 修正促销迁移表结构 — subscribe_promo 加 quantity + 索引优化
...
Build docker and publish / build (20.15.1) (push) Failing after 8m28s
Build docker and publish / build (20.15.1) (pull_request) Successful in 7m59s
- subscribe_promo 新增 quantity 列,唯一键改为 (subscribe_id, quantity, promo_rule_id)
- promo_rule 索引合并为 idx_enabled_priority_deleted (enabled, deleted_at, priority DESC)
Co-authored-by: multica-agent <github@multica.ai >
2026-05-27 01:10:31 -07:00
shanshanzhong147
b9192db042
feat: 文件上传接口直接返回完整 URL + 提现 content 改为非必填
...
Build docker and publish / build (20.15.1) (push) Failing after 8m29s
Build docker and publish / build (20.15.1) (pull_request) Successful in 8m3s
- FileUploadResponse / FileUploadCompleteResponse 精简为只返回 url
- S3Store.BuildObjectURL 拼接完整访问地址
- 提现 method=0 时 content 不再参与必填校验
- 新增用户端 API 接口文档
2026-05-27 00:57:21 -07:00
shanshanzhong147
d2f9289338
新功能( #76 ): 促销系统下单流程集成
...
Build docker and publish / build (20.15.1) (push) Has been cancelled
Build docker and publish / build (20.15.1) (pull_request) Successful in 8m28s
- 新增促销规则/规格促销价/使用记录模型与幂等迁移
- EvaluatePromo 支持 new_user/inactive_user/campaign 规则判定
- purchase/preCreate 接入促销判定:命中促销时跳过百分比折扣
- activate 激活后按 order_no 幂等写入 promo_usage
- 订单模型和响应结构新增 promo_rule_id、promo_discount 字段
Co-authored-by: multica-agent <github@multica.ai >
2026-05-26 22:18:44 -07:00
shanshanzhong147
5ebfe0a981
新功能( #65 ): 添加用户订阅限速数据层字段
...
Build docker and publish / build (20.15.1) (push) Failing after 8m30s
Build docker and publish / build (20.15.1) (pull_request) Successful in 7m58s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-26 11:23:57 -07:00
shanshanzhong147
22d9773f1b
x
Build docker and publish / build (20.15.1) (pull_request) Has been cancelled
Build docker and publish / build (20.15.1) (push) Failing after 8m56s
2026-05-26 10:02:38 -07:00
shanshanzhong147
f9fa4756e9
新功能( #41 ): 提现优化 — 收款方式选择 + 取消提现 + 收款码上传
...
Build docker and publish / build (20.15.1) (push) Failing after 8m37s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-26 08:36:25 -07:00
shanshanzhong147
0169a16ada
fix: make refund migration compatible with legacy schemas
...
Build docker and publish / build (20.15.1) (push) Failing after 8m17s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-25 11:07:06 -07:00
shanshanzhong147
b6b5bccde6
fix: use withdrawals table consistently
...
Build docker and publish / build (20.15.1) (push) Failing after 8m20s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-25 10:43:24 -07:00
shanshanzhong147
eba256bdc9
merge: sync internal with main
...
Build docker and publish / build (20.15.1) (push) Failing after 8m22s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-25 10:32:06 -07:00
shanshanzhong147
72f2b94263
fix: restore missing migration files
...
Build docker and publish / build (20.15.1) (push) Failing after 8m16s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-25 10:20:46 -07:00
shanshanzhong147
bb67ebcb79
chore: rename activation context migration to 02151
...
Build docker and publish / build (20.15.1) (push) Failing after 8m27s
Co-authored-by: multica-agent <github@multica.ai >
2026-05-25 02:21:37 -07:00
shanshanzhong147
a0f2d8a7b8
fix: persist guest/redemption activation context to DB to survive Redis TTL expiry (Bug 1 + Bug 10)
...
- Add `activation_context` TEXT column to `order` table (migration 02150)
- purchaseLogic: write TemporaryOrderInfo JSON to order.ActivationContext in the same
insert transaction; Redis write is now best-effort (non-fatal)
- redeemCodeLogic: write redemption {type, redemption_code_id, unit_time, quantity} JSON
to order.ActivationContext at order creation; Redis write is now best-effort (non-fatal)
- getTempOrderInfo: on Redis miss, fall back to order.ActivationContext from DB;
logs CRITICAL and returns error if both are missing (old orders with no DB record)
- RedemptionActivate: on Redis miss, fall back to order.ActivationContext from DB;
same CRITICAL log path for legacy orders
Co-authored-by: multica-agent <github@multica.ai >
2026-05-25 02:18:19 -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
fd522b6c71
path
Build docker and publish / build (20.15.1) (push) Successful in 8m56s
2026-05-19 19:35:44 -07:00
shanshanzhong147
54daa923da
补单逻辑
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-05-06 04:59:04 -07:00
shanshanzhong147
c8258dc93b
feat: 设备登录新增 base_payload 字段,前端传入后存储到 user_device 表
Build docker and publish / build (20.15.1) (push) Successful in 4m48s
2026-04-20 20:08:20 -07:00
shanshanzhong147
62cf68b49b
x
Build docker and publish / build (20.15.1) (push) Successful in 6m35s
2026-04-04 11:46:06 -07: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
4b528184ea
devicd_no
Build docker and publish / build (20.15.1) (push) Successful in 7m58s
2026-03-17 08:37:36 -07:00
shanshanzhong147
3db14ae472
feat: 迁移订阅表字段,为用户认证方法添加软删除功能及索引,并调整 Docker Compose 中 MySQL 端口映射。
Build docker and publish / build (20.15.1) (push) Successful in 7m34s
2026-03-15 01:47:01 -07:00
EUForest
06a2425474
feat(subscribe): add traffic limit rules and user traffic stats
...
- Add subscribe traffic_limit schema and migration\n- Support traffic_limit in admin create/update and list/details\n- Apply traffic_limit when building server user list speed limits\n- Add public user traffic stats API
2026-03-14 12:41:52 +08:00
shanshanzhong147
b3c721ee58
fix: schema_compat 跳过不存在的表,避免 columnPatch 对缺失表 panic
...
Build docker and publish / build (20.15.1) (push) Successful in 7m33s
Co-Authored-By: claude-flow <ruv@ruv.net >
2026-03-11 11:33:21 -07:00
shanshanzhong147
4095552252
feat: 为订单表添加 IAP 相关字段并调整 IAP 对账逻辑参数。
Build docker and publish / build (20.15.1) (push) Successful in 7m34s
2026-03-10 21:12:39 -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
2fd22c97e0
feat(migration): add captcha configuration migration
...
- Add CaptchaType field for selecting captcha implementation
- Add EnableUserLoginCaptcha for user login verification
- Add EnableUserRegisterCaptcha for user registration verification
- Add EnableAdminLoginCaptcha for admin login verification
- Add EnableUserResetPasswordCaptcha for password reset verification
- Remove deprecated EnableLoginVerify, EnableRegisterVerify, EnableResetPasswordVerify fields
- Support rollback with down migration
2026-03-09 22:53:45 +08:00
shanshanzhong147
dcfcd036de
x
Build docker and publish / build (20.15.1) (push) Successful in 7m46s
2026-03-08 22:37:58 -07:00
shanshanzhong147
79a97ec569
限制套餐具体到 档位
Build docker and publish / build (20.15.1) (push) Successful in 7m45s
2026-03-08 21:25:07 -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
4907853667
邀请 N天配置
2026-03-08 07:31:11 -07: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
6c370485d1
fix gitea workflow path and runner label
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
2026-03-04 03:07:41 -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
9ad602aabe
fix(migration): remove IF NOT EXISTS for MySQL compatibility
...
Remove IF NOT EXISTS clause from CREATE INDEX statement to ensure
compatibility with older MySQL versions. Migration framework ensures
each migration runs only once, making the clause unnecessary.
2026-02-10 00:45:17 +08:00
EUForest
bacdf2f301
fix(migration): correct SQL syntax for traffic_log index creation
...
Change ALTER TABLE ADD INDEX IF NOT EXISTS to CREATE INDEX IF NOT EXISTS
to comply with MySQL syntax requirements. The IF NOT EXISTS clause is
only supported with CREATE INDEX statement, not with ALTER TABLE ADD INDEX.
2026-02-10 00:25:40 +08:00
EUForest
2a1ae2e1cc
feat: add index on user.refer_code for faster invite code lookup
...
- Add idx_refer_code index to improve query performance
- Prevents full table scan when validating invite codes during registration
2026-01-10 20:37:24 +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
7d84cf858b
fix(currency): initialize exchange rate to 0 and improve error logging in purchase checkout
2026-01-07 09:35:52 -05:00
EUForest
24c7fc8857
add: init sql
2026-01-06 16:16:42 +08:00