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
a337f43f86
fix(config): port alignment + service test doubles (batch 4.1/4.5)
...
- gateway/config Dubbo URL 默认端口修正(原 20004/20005 与服务实际 20001/20004 不符);
- userService main.go 硬编码 WithPort(20000) 修死码, -port flag / PORT env 真正生效;
- .env.example 11 个 DUBBO URL 同步(对齐 serviceDefaultPorts map + 实际服务 bind);
- 删除 DUBBO_STARBOOK_SERVICE_URL 死引用(starbookService 已在 batch 4.2 删除);
- .env.example Service Ports 注释块补全 10 行, 与网关 Dubbo URL + port_test 三方一致;
- 10 个 service 各加 port_test.go, 断言 flag 默认与 serviceDefaultPorts map 一致;
- 11 个 port_test 总计 13 测试覆盖(网关 + 10 service);
- .gitignore 加 userService/main.go.bak 排除(临时备份)。
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-24 14:02:14 +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
b7022d2dc1
fix(backend): auth boundary — trusted identity from ctx (batch 2)
...
- 新增 pkg/authctx: 从 Dubbo attachment/gRPC metadata 提取可信 user_id/star_id,
统一覆盖 req 同名字段, 缺身份返 Unauthenticated。
- 各 provider 接入(堵身份伪造/越权):
* moderation SubmitReport 等 6 RPC(举报人伪造)
* asset CheckAssetLike/GetAssetQrcode/TrackShare(点赞/分享归因伪造)
* social CheckFriendship(修 starID=0 隐私预言机)
* activity PurchaseItem/BatchPurchaseItem(水晶扣费伪造)等 5 RPC
* gallery/aiChat/task/notification 迁移 authctx, 删散落 extractUserInfo*
- social 正确性: GetUserLikedAssets OR 显式分组(防御); GetRandomUsersByStar 真随机(去 rand.Seed)。
- gateway: /auth/validate 移入 AuthMiddleware 保护组(/refresh 保留,依赖注入身份)。
- 删 userService 已迁移死函数; notification 缺身份错误码统一为 Unauthenticated。
- 各 provider 单测(伪造身份被覆盖 + 缺身份拒绝)。
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-23 01:12:35 +08:00
zerosaturation
878bd46399
fix(backend): financial correctness — settlement/hours/mint idempotency (batch 1)
...
- settlement(1.1): exhibition_revenue_records 加 UNIQUE(exhibition_id,cycle_start_time)
+ CreateRevenueRecord ON CONFLICT DO NOTHING; MQ 用 settled_at 替代复用 is_processed;
恢复扫描器过滤改 settled_at IS NULL; created_at 统一毫秒; 删死代码 cleanup_worker.go。
- hours(1.2): 新增 exhibition_hours_log/asset_exhibition_hours_log(source_id 唯一)幂等表;
fan_profile/assetLevel 的 AddExhibitionHours 按 sourceID 幂等(事务包裹); 存量重算脚本。
- mint(1.4/1.5/1.6): crystal_transaction_records (source_id,change_type) 部分唯一索引
+ UpdateCrystalBalance/CreateMintOrder 幂等; 保底改 crypto/rand; 下线伪 tx_hash;
doMint Redis Lua 原子限流。
- migrations 001/002/003; 各服务单测(自包含, 缺 DB t.Skip)。
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-23 01:11:54 +08:00
zerosaturation
e5bd0c854c
feat:增加忘记密码的功能
2026-07-09 19:00:03 +08:00
zerosaturation
dcb4e451a1
fix:修改合并后bug
2026-07-06 10:25:06 +08:00
zerosaturation
1afee2de73
feat:修改的欢迎页的冷启动和系统重启的错误触发和一键登录页的路径修改
2026-07-03 18:54:03 +08:00
zerosaturation
d12a84c1f0
feat:增加队列修改收益方面把轮询改为MQ队列,修改数据看板的数据问题出错
2026-07-03 12:34:55 +08:00
zerosaturation
3cd68acf6d
feat:完善计算点赞押注收益
2026-06-29 14:47:32 +08:00
zerosaturation
060e4944fa
fix:修改JWTbug
2026-06-15 21:12:59 +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
5f4a443a93
feat: 新增余额不足不能铸造的功能提示,新增详细页面图片正常显示,docker修改配置
2026-05-18 18:32:58 +08:00
zerosaturation
afb235afd3
feat: 合并代码,解决冲突
2026-05-16 02:42:32 +08:00
zerosaturation
c5bf9df955
feat: 经济系统重构 - 任务服务与画廊服务解耦
...
- galleryService 独立启动,配置 task-service-url
- 新增 taskService 到 galleryService 的 RPC 调用
- 更新 proto 文件并重新生成代码
- 新增展览唯一约束迁移脚本
- 修复多个 service 的配置和依赖关系
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 23:12:02 +08:00
zerosaturation
3ef3510303
feat:修改展示收益
2026-05-15 11:49:00 +08:00
zerosaturation
74182ad662
feat: 新增经济系统
2026-05-14 15:59:07 +08:00
zerosaturation
112d3907be
feat: 新增账号状态
2026-04-27 12:59:19 +08:00
zerosaturation
e761bde30b
fix: 修复自动升级和展览藏品下架的索引bug
2026-04-23 14:31:40 +08:00
zerosaturation
4e13c86aa4
fix: 修改任务系统奖励修复
2026-04-15 14:11:07 +08:00
zerosaturation
a5e3008819
feat: 增加health健康检查和替换前端跳转路由api
2026-04-14 00:10:24 +08:00
zerosaturation
06f4038a75
提交后端代码
2026-04-07 22:29:48 +08:00