新增 mysql.md(t_ 表名与 migrate 流程),补全 /v1/music·square 与 admin 路由说明;description 与 AGENTS/rules 对齐 make test→lint 与 deploy 门禁,减少与 verify-before-done 重复。 Co-authored-by: Cursor <cursoragent@cursor.com>
901 B
901 B
Send / sync examples
Persist then enqueue then ACK
msg.ID, err = idgen.NextMsgID()
if err != nil { return nil, err }
if err := repo.Create(ctx, msg); err != nil { return nil, err }
if err := convRepo.UpdateLastMsg(ctx, msg.ConversationID, msg.ID, now); err != nil { return nil, err }
if err := deliver.Push(ctx, &deliver.Job{MsgID: msg.ID, ExcludeDevice: req.DeviceID}); err != nil {
return nil, err // no SEND_ACK
}
return &SendResponse{MsgID: msg.ID, ClientMsgID: req.ClientMsgID, ServerTimeMS: now}, nil
EventLoop submit
if frame.Command == protocol.CmdHeartbeat {
return writeHeartbeat(c, frame)
}
_ = pool.Submit(ctx, func() { router.Dispatch(ctx, frame) })
Sync
SELECT * FROM t_messages
WHERE conversation_id = ? AND id > ?
ORDER BY id ASC LIMIT 200;
Inbox sync reads Redis ZSET by dialog_score, then mailbox events by mailbox_seq.