zerosaturation
|
ecdd96da5b
|
feat(mq): task:event task type + business event constants
- pkg/mq/tasks/task_events.go (new): business event constants
- EventDailyLogin, EventDailyBrowseAsset, EventDailyMint, EventDailyPlaceAsset
- TaskEventPayload{UserID, StarID, EventType}
- pkg/mq/tasks/registry.go: +TypeTaskEvent = 'task:event'
Spec §3 F3 separation: business event constants live in task_events.go;
MQ task type strings live in registry.go (revenue:/gallery:/* style).
Consumed by:
- assetService/mq/producer.go (Phase F.1 emitter for daily_mint)
- frontend pages (Phase F.2 callers via task-api.js reportEvent -> gateway -> task:event)
- taskService/mq/consumer.go (Phase E consumer -> ProcessTaskEvent)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
2026-07-27 15:41:49 +08:00 |
|
zerosaturation
|
e079a6c2e2
|
feat(asset): restore starbook home More button by Asset.LikeCount ordering
starbook 首页每个 grade/group 按 Asset.LikeCount DESC, Asset.ID ASC 取前三张,超三显示 has_more;
GetAssetsByType 不截断返回全部匹配项。包含:
- proto/asset.proto 声明 GetAssetsByType RPC + 消息,重新生成 .pb.go/.triple.go
- gateway starbook controller 改用标准 AssetService 客户端
- assetService: 三个 build*GroupForAssets 增加 previewLimit 参数
- 新增 sortAndLimitAssetItems 共享助手
- 新增 asset_service_group_test.go DB-free 单测
- 新增 TestStarbookHomePreviewAndMoreUseAssetLikeRanking 端到端回归
- frontend pages/starbook/items.vue 适配嵌套 groups/grades/items 响应,单 grade 竖向展示
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
2026-07-24 19:20:16 +08:00 |
|
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
|
293c7b14ae
|
fix(security): JWT key governance — MustInit fail-fast + atomic.Value
- pkg/jwt: 删 public SetSecret; 加 MustInit(secret string) 启动时强制注入,
缺/为空/等于弱默认值时返回 error(运行期不可再改); 密钥用 atomic.Value
存 []byte,所有读走 mustSecret() 原子 Load,消除 SetSecret/ParseToken 并发
data race(go test -race 零告警)。
- gateway main + auth_provider: 启动时 MustInit 读 JWT_SECRET env,失败 fatal。
- scripts/loadgen/seed/tokens: 同步 MustInit。
- .env.example: JWT_SECRET 改为 ≥32 字节 base64 示例(原为空,被 MustInit
立即拒);注释提示生产 MUST replace。
- 测试: 4 个 MustInit 行为 + 1 个 50-goroutine race 覆盖。
- 行为变更: 任何 .env 缺 JWT_SECRET 或用占位 secret 的服务,启动会 panic
(这是 fail-fast 期望行为);其余 4 个 .env 文件占位由 ops 单独轮换。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-07-23 18:50:12 +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
|
d554d7be83
|
feat:修改周边验证
|
2026-07-17 16:53:57 +08:00 |
|
zerosaturation
|
c0b577dd40
|
feat:增加邮箱管理功能
|
2026-07-14 21:59:15 +08:00 |
|
zerosaturation
|
d900c0d8b2
|
feat:增加验证真伪访问次数和首次验证
|
2026-07-13 14:24:42 +08:00 |
|
zerosaturation
|
74853800b6
|
feat:增加二维码验证真伪的功能
|
2026-07-13 11:22:56 +08:00 |
|
zerosaturation
|
e5bd0c854c
|
feat:增加忘记密码的功能
|
2026-07-09 19:00:03 +08:00 |
|
|
|
fbf3e6c63c
|
feat:增加分享页下载
|
2026-07-09 15:49:06 +08:00 |
|
zerosaturation
|
8376afc5d6
|
feat:修改websocket的性能和相关的问题
|
2026-07-03 22:04:11 +08:00 |
|
zerosaturation
|
c07e8e9c19
|
fix:修改数据看板bug
|
2026-07-03 14:57:14 +08:00 |
|
zerosaturation
|
d12a84c1f0
|
feat:增加队列修改收益方面把轮询改为MQ队列,修改数据看板的数据问题出错
|
2026-07-03 12:34:55 +08:00 |
|
zerosaturation
|
9c3fe6d695
|
feat:修复点赞收益的问题
|
2026-07-01 11:03:50 +08:00 |
|
zerosaturation
|
3cd68acf6d
|
feat:完善计算点赞押注收益
|
2026-06-29 14:47:32 +08:00 |
|
zerosaturation
|
2032246fd0
|
feat:增加分享界面,完善的保存图片功能
|
2026-06-26 16:45:29 +08:00 |
|
zerosaturation
|
b7e2aee399
|
feat:修改活动 TOP3 + 我的排名
|
2026-06-24 18:10:12 +08:00 |
|
zerosaturation
|
37a3f292df
|
feat:访问他人展览页面修改
|
2026-06-23 22:29:39 +08:00 |
|
zerosaturation
|
75ab617c6c
|
feat:增加实时留言功能和修改轮询道具购买记录显示改为websocket显示
|
2026-06-23 18:13:55 +08:00 |
|
zerosaturation
|
7eb6dad434
|
feat:新增举报和反馈功能
|
2026-06-22 17:19:48 +08:00 |
|
|
|
ddc5b89a6c
|
frat:增加uniPush的配置
|
2026-06-16 23:49:40 +08:00 |
|
zerosaturation
|
7074546959
|
feat:新增通知系统
|
2026-06-16 21:30:58 +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
|
dfb79af4b1
|
feat: 铸造菜单改为动态配置
|
2026-06-09 12:38:12 +08:00 |
|
zerosaturation
|
3d3f2260f3
|
feat(statistic): T13-T16 Gateway routes + 5-service business integration (7/7 event types)
Gateway:
- 7 routes /api/v1/dashboard/* with JWT auth (middleware.AuthMiddleware)
- statistic_controller.go: 7 methods, response format {code:200, data:resp}
- gateway/main.go: StatisticServiceClient wired
- gateway/config: StatisticServiceURL (DUBBO_STATISTIC_SERVICE_URL, default tri://127.0.0.1:20009)
pkg/statistic SDK:
- fire-and-forget TrackEvent + BatchTrackEvent
- Init(client) + Get() global singleton pattern
Business-side integration (7/7 event types):
- socialService.LikeAsset → asset.like
- galleryService.PlaceAsset → exhibition.start
- galleryService.RemoveFromSlot → exhibition.end (with duration_ms)
- taskService.OnExhibitionCompleted → exhibition.revenue
- assetService.CreateMintOrder → asset.mint
- assetService.logLevelChange → asset.level_up
- userService.UpdateCrystalBalance → crystal.change (wrapper fn added)
Cache warmup:
- main.go: 7 RPCs x 5 sample starIDs at startup (15s delay)
- prevents cold-start DB thundering herd
Existing service modifications:
- galleryService/exhibition_service.go
- taskService/revenue_service.go
- assetService/{mint_service,asset_level_service}.go
- userService/user_service.go
- socialService/asset_like_service.go
🤖 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
|
4212914057
|
feat(statistic): add event.proto and statistic.proto with 7 RPCs + 2 event RPCs
|
2026-06-08 17:20:53 +08:00 |
|
liulong
|
b9527bee70
|
feat:合并新
|
2026-06-03 22:41:19 +08:00 |
|
liulong
|
10168f8e6b
|
feat:实现AI生成镭射卡功能
|
2026-06-03 22:19:22 +08:00 |
|
zerosaturation
|
e1829b2296
|
feat: 修改短信认证bug
|
2026-06-02 15:43:57 +08:00 |
|
zerosaturation
|
d5a645eaea
|
feat: 给榜单增加字段
|
2026-05-29 19:47:09 +08:00 |
|
zerosaturation
|
3f58a82a91
|
feat: 修改藏品展示等级和藏品没有同步问题
|
2026-05-29 12:18:40 +08:00 |
|
zerosaturation
|
9a9f4d1b96
|
feat: 新增点赞列表标签增加
|
2026-05-28 17:45:07 +08:00 |
|
zerosaturation
|
17c68c9233
|
feat:增加的ai搭子对话功能
|
2026-05-28 12:00:19 +08:00 |
|
zerosaturation
|
b8e462f9b5
|
feat:修改广场页面,铸造页面
|
2026-05-26 19:26:27 +08:00 |
|
zerosaturation
|
a39bb7b60f
|
feat:新增sms短信注册
|
2026-05-26 13:23:04 +08:00 |
|
zerosaturation
|
e545f41c3b
|
feat:修改类型为复合类型
|
2026-05-25 19:03:36 +08:00 |
|
zerosaturation
|
0852f96436
|
feat:去掉重复的点赞约束
|
2026-05-25 19:03:35 +08:00 |
|
zerosaturation
|
7c5d5a7275
|
feat:修改藏品等级硬编码改为根据数据库的配置来定义
|
2026-05-25 19:03:32 +08:00 |
|
zerosaturation
|
6f21c294e9
|
feat: add asset level models
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-25 19:03:31 +08:00 |
|
zerosaturation
|
4d42d9a6d0
|
feat: 新增历史点赞查询和修改点赞规则
|
2026-05-22 18:06:33 +08:00 |
|
zerosaturation
|
ee0433464f
|
feat: 修改铸造消耗确认框和新增批量购买道具的功能,修改回退按钮的颜色
|
2026-05-22 00:14:28 +08:00 |
|
zerosaturation
|
fcebf5a107
|
feat:增加分享页面和举报按钮
|
2026-05-21 18:51:15 +08:00 |
|
zerosaturation
|
afda66cdb9
|
feat: 新增实时应援道具使用显示
|
2026-05-20 18:42:12 +08:00 |
|
zerosaturation
|
0d591fdd94
|
feat: 修改展览页
|
2026-05-20 17:05:02 +08:00 |
|
zerosaturation
|
02598db333
|
feat: 修改当前点赞逻辑
|
2026-05-20 12:36:58 +08:00 |
|