zerosaturation
8a767fb400
fix(backend): service stability — batch 3 accumulated (bcrypt off-txn / login anti-enum / MQ stub / aiChat / event reliability / gateway aggregate)
...
- 3.1 bcrypt 移出事务 (Register): repository.HashPassword 前移到 db.Transaction 之前。
- 3.2 Login 消除用户枚举 + 限流 + timing 抹平: pkg/errors 加 ErrInvalidCredential / ErrTooManyLoginAttempts;
user-not-found 跑 dummy bcrypt 抹平 ~100ms 时序差; mobile 5次/ip 20次 per 15min 限流 (Redis, fail-open 降级)。
- 3.3 MQ streams adapter 停用 → stub: 0 业务调用方, noop EventProducer.Publish; Init 不再装配 streams;
11 处硬编码 'gallery'/'default' 抽常量到 pkg/queue/consts (值不变, 消漂移)。
- 3.5 JWT 密钥治理: pkg/jwt MustInit fail-fast + atomic.Value, 50-goroutine race_test 零告警;
MustInit 调用点 gateway main + auth_provider + loadgen 同步更新。
- 3.6 aiChat 健壮性: SaveContext 用 persona.ID(非 req.PersonaId); Redis/memory 错误 记 WARN 不静默;
Dify err 映射稳定用户文案。
- 3.7 statistic.Client 重构: TrackEvent 改 buffered channel (cap 1024) + dispatchLoop worker。
- 3.8 网关聚合: StarCache (60s TTL, singleflight) 替换 GetFanIdentities 链式调用;
DeleteAccount 改网关直调 userService.DeleteAccount(避免改 hand-written triple.go);
铸造双写改异步 channel+consumer (3 retry)。
- 大量单测: 各子项 TDD (RED→GREEN), 关键并发 race_test (50 goroutine)。
- .env.example JWT_SECRET 改为 ≥32 字节 base64 示例(原为空, 被 MustInit 立即拒)。
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-24 14:03:21 +08:00
zerosaturation
e1326acaf9
fix(backend): service stability — bcrypt off-txn / login anti-enum / MQ stub / aiChat / event reliability / gateway aggregate (batch 3)
...
- 3.1 bcrypt 移出事务 (Register): repository.HashPassword 前移到 db.Transaction 之前,消除连接池占用。
- 3.2 Login 消除用户枚举 + 限流 + timing 抹平: pkg/errors 加 ErrInvalidCredential
/ErrTooManyLoginAttempts; 用户不存在/密码错/密码空 三路径统一返回同一错误;
mobile 5次/ip 20次 per 15min 限流 (Redis, fail-open 降级); user-not-found 走
dummy bcrypt 抹平 ~100ms 时序差,完全消除枚举侧信道;空密码分支已核实无时序 leak。
- 3.3 MQ streams adapter 停用 → stub: 0 业务调用方, 新 stub EventProducer.Publish no-op;
pkg/mq/mq.go Init 不再装配 streams; 全仓 grep 验证 11 处硬编码
'gallery'/'default' 集中到 pkg/queue/consts (值不变, 仅消漂移)。
- 3.5 JWT 密钥治理: pkg/jwt MustInit fail-fast + atomic.Value (见上一个 commit 293c7b1 )。
- 3.6 aiChat 健壮性: SaveContext 用 persona.ID(非 req.PersonaId); Redis/memory 错误
记 WARN 不静默; Dify err 映射稳定用户文案,原始 err 仅服务端日志。
- 3.7 statistic.Client 重构: TrackEvent 改 buffered channel (cap 1024) + dispatchLoop
worker; 失败 ERROR 日志带字段; drop 记 WARN; Close 可重复调用。
- 3.8 网关聚合: StarCache (60s TTL, singleflight) 替换 5+ 处 GetFanIdentities 链式调用;
DeleteAccount 改网关直调 userService.DeleteAccount(避免改 hand-written triple.go
风险,见报告 §5 proto 风险复盘); 铸造双写改异步 channel+consumer (3 retry)。
- 大量单测: 各子项 TDD (RED→GREEN), 关键并发 race_test (50 goroutine)。
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-23 18:50:40 +08:00
zerosaturation
e5bd0c854c
feat:增加忘记密码的功能
2026-07-09 19:00:03 +08:00
zerosaturation
1afee2de73
feat:修改的欢迎页的冷启动和系统重启的错误触发和一键登录页的路径修改
2026-07-03 18:54:03 +08:00
zerosaturation
271e0350c7
feat:重构code状态码
2026-06-15 16:28:35 +08:00
zerosaturation
56fc2f6beb
feat:修改密码增加手机号+短信验证
2026-06-15 14:15:24 +08:00
zerosaturation
d859650136
feat:修改数据看板
2026-06-09 00:37:42 +08:00
zerosaturation
0029fb8cc8
feat(statistic): T9-T12 dashboard 7 RPCs - additional business-side service modifications
...
Modifications to 5 existing business services for TrackEvent integration:
- socialService/asset_like_service.go: TrackEvent(asset.like) after LikeAsset
- galleryService/exhibition_service.go: TrackEvent(exhibition.start) + (exhibition.end with duration)
- taskService/revenue_service.go: TrackEvent(exhibition.revenue) after OnExhibitionCompleted
- assetService/mint_service.go: TrackEvent(asset.mint) after CreateMintOrder
- assetService/asset_level_service.go: TrackEvent(asset.level_up) in logLevelChange
- userService/user_service.go: fireCrystalChangeEvent wrapper (call site TBD by service owner)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 17:20:53 +08:00
zerosaturation
e1829b2296
feat: 修改短信认证bug
2026-06-02 15:43:57 +08:00
zerosaturation
a39bb7b60f
feat:新增sms短信注册
2026-05-26 13:23:04 +08:00
zerosaturation
afb235afd3
feat: 合并代码,解决冲突
2026-05-16 02:42:32 +08:00