tasks

package
v0.0.0-...-b25a406 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAppendMsgToZSetTask

func NewAppendMsgToZSetTask(p *AppendMsgToZSetPayload) (*asynq.Task, error)

NewAppendMsgToZSetTask 构造将消息追加到 ZSET 的任务

func NewDeleteFriendCacheTask

func NewDeleteFriendCacheTask(userID, friendID int64) (*asynq.Task, error)

NewDeleteFriendCacheTask 构造好友缓存删除任务

func NewDeleteGroupBanCacheTask

func NewDeleteGroupBanCacheTask(groupID int64) (*asynq.Task, error)

NewDeleteGroupBanCacheTask 构造删除群禁言缓存任务(group_members UPDATE/DELETE 时触发)

func NewDeleteGroupInfoCacheTask

func NewDeleteGroupInfoCacheTask(groupID int64) (*asynq.Task, error)

NewDeleteGroupInfoCacheTask 构造删除群信息缓存任务(groups 表变更时触发)

func NewDeleteGroupMembersCacheTask

func NewDeleteGroupMembersCacheTask(groupID int64) (*asynq.Task, error)

NewDeleteGroupMembersCacheTask 构造删除群成员缓存任务(group_members 表变更时触发)

func NewDeleteUserCacheTask

func NewDeleteUserCacheTask(userID int64) (*asynq.Task, error)

NewDeleteUserCacheTask 构造缓存删除任务

func NewDeleteUserGroupsCacheTask

func NewDeleteUserGroupsCacheTask(userID int64) (*asynq.Task, error)

NewDeleteUserGroupsCacheTask 构造删除用户群列表缓存任务(group_members INSERT/DELETE 时触发)

func NewHelperQuestionTask

func NewHelperQuestionTask(p *HelperQuestionPayload) (*asynq.Task, error)

NewHelperQuestionTask 构造 helper:question Asynq 任务。 必填字段缺失时返回参数错误,避免消费端反序列化后遇到零值导致后续逻辑异常。

func NewInvalidateConvCacheTask

func NewInvalidateConvCacheTask(userID int64) (*asynq.Task, error)

NewInvalidateConvCacheTask 构造失效会话列表缓存任务

func NewMeetingNotifyTask

func NewMeetingNotifyTask(payload *MeetingNotifyPayload) (*asynq.Task, error)

NewMeetingNotifyTask 构造 meeting:notify 任务

func NewMeetingRecordingReadyTask

func NewMeetingRecordingReadyTask(payload *MeetingRecordingReadyPayload) (*asynq.Task, error)

NewMeetingRecordingReadyTask 构造 meeting:recording:ready 任务

func NewMeetingSummaryTask

func NewMeetingSummaryTask(meetingID int64) (*asynq.Task, error)

NewMeetingSummaryTask 构造 meeting:summary 任务

func NewRemoveMsgFromZSetTask

func NewRemoveMsgFromZSetTask(p *RemoveMsgFromZSetPayload) (*asynq.Task, error)

NewRemoveMsgFromZSetTask 构造从 ZSET 删除消息的任务

func NewSaveMessageTask

func NewSaveMessageTask(payload *SaveMessagePayload) (*asynq.Task, error)

NewSaveMessageTask 构造 message:save 任务

func NewSetFlashViewCacheTask

func NewSetFlashViewCacheTask(p *SetFlashViewCachePayload) (*asynq.Task, error)

NewSetFlashViewCacheTask 构造回填闪讯已读缓存任务

Types

type AppendMsgToZSetPayload

type AppendMsgToZSetPayload struct {
	ID              int64  `json:"id"`
	FromUserID      int64  `json:"from_user_id"`
	TargetID        int64  `json:"target_id"`
	MessageType     int8   `json:"message_type"`
	ContentType     int8   `json:"content_type"`
	Content         string `json:"content,omitempty"`
	MediaURL        string `json:"media_url,omitempty"`
	MediaName       string `json:"media_name,omitempty"`
	MediaSize       int64  `json:"media_size,omitempty"`
	Duration        int32  `json:"duration,omitempty"`
	ConversationKey string `json:"conversation_key,omitempty"`
	CreatedAt       int64  `json:"created_at"` // Unix 毫秒
}

AppendMsgToZSetPayload messages INSERT 时将消息追加到 ZSET 的任务 payload 字段与 model.Message 对应,Canal 从 binlog row 中提取并填充

type DeleteFriendCachePayload

type DeleteFriendCachePayload struct {
	UserID   int64 `json:"user_id"`
	FriendID int64 `json:"friend_id"`
}

DeleteFriendCachePayload 好友缓存删除任务 payload

type DeleteGroupBanCachePayload

type DeleteGroupBanCachePayload struct {
	GroupID int64 `json:"group_id"`
}

DeleteGroupBanCachePayload 群禁言 Hash 缓存删除任务的 payload

type DeleteGroupInfoCachePayload

type DeleteGroupInfoCachePayload struct {
	GroupID int64 `json:"group_id"`
}

DeleteGroupInfoCachePayload 群信息缓存删除任务的 payload

type DeleteGroupMembersCachePayload

type DeleteGroupMembersCachePayload struct {
	GroupID int64 `json:"group_id"`
}

DeleteGroupMembersCachePayload 群成员 ZSET 缓存删除任务的 payload

type DeleteUserCachePayload

type DeleteUserCachePayload struct {
	UserID int64 `json:"user_id"`
}

DeleteUserCachePayload 缓存删除任务的 payload

type DeleteUserGroupsCachePayload

type DeleteUserGroupsCachePayload struct {
	UserID int64 `json:"user_id"`
}

DeleteUserGroupsCachePayload 用户群列表 ZSET 缓存删除任务的 payload

type HelperQuestionPayload

type HelperQuestionPayload struct {
	QuestionMsgID int64  `json:"question_msg_id"` // 触发的原始消息 ID(用于归因和 SetNX 去重锁)
	HelperMsgID   int64  `json:"helper_msg_id"`   // 预分配的回答消息 ID(前端跳转锚点)
	FromUserID    int64  `json:"from_user_id"`    // 发起人 user_id
	TargetID      int64  `json:"target_id"`       // 单聊=peer user_id,群聊=group_id
	ChatType      int8   `json:"chat_type"`       // 1=单聊 2=群聊
	TriggerType   int8   `json:"trigger_type"`    // constants.HelperTriggerAtMention / HelperTriggerSelfChat
	ContextID     int64  `json:"context_id"`      // 上下文 ID:群聊=group_id,自聊天=HelperSystemUserID
	Question      string `json:"question"`        // 去除 @前缀后的净问题文本
}

HelperQuestionPayload helper:question 任务的载荷

type InvalidateConvCachePayload

type InvalidateConvCachePayload struct {
	UserID int64 `json:"user_id"`
}

InvalidateConvCachePayload conversations INSERT/UPDATE 时失效会话列表缓存的任务 payload

type MeetingNotifyPayload

type MeetingNotifyPayload struct {
	MeetingID   int64  `json:"meeting_id"`
	RoomName    string `json:"room_name"`
	OrganizerID int64  `json:"organizer_id"`
	Title       string `json:"title"`
	ChatType    int8   `json:"chat_type"` // 1=单聊 2=群聊;消费时据此查询参与者
	TargetID    int64  `json:"target_id"` // 单聊=对方 userID,群聊=groupID
}

MeetingNotifyPayload 预约会议定时通知任务 payload 消费时实时查询参与者(群成员可能已变动),不存快照

type MeetingRecordingReadyPayload

type MeetingRecordingReadyPayload struct {
	MeetingID   int64  `json:"meeting_id"`
	RecordingID int64  `json:"recording_id"`
	FileURL     string `json:"file_url"`
	Duration    int32  `json:"duration"`
}

MeetingRecordingReadyPayload 录像就绪通知任务 payload

type MeetingSummaryPayload

type MeetingSummaryPayload struct {
	MeetingID int64 `json:"meeting_id"`
}

MeetingSummaryPayload 会议 AI 总结任务 payload

type RemoveMsgFromZSetPayload

type RemoveMsgFromZSetPayload struct {
	MsgID       int64 `json:"msg_id"`
	FromUserID  int64 `json:"from_user_id"`
	TargetID    int64 `json:"target_id"`
	MessageType int8  `json:"message_type"`
}

RemoveMsgFromZSetPayload messages recalled_at 变更时从 ZSET 删除消息的任务 payload

type SaveMessagePayload

type SaveMessagePayload struct {
	ID              int64  `json:"id"` // 由 Chat 服务雪花算法预生成
	FromUserID      int64  `json:"from_user_id"`
	TargetID        int64  `json:"target_id"`    // 单聊=对方userID,群聊=groupID
	MessageType     int8   `json:"message_type"` // 1=单聊 2=群聊
	ContentType     int8   `json:"content_type"` // 1=文本 2=图片 3=语音 4=视频 5=文件 6=视频会议
	Content         string `json:"content,omitempty"`
	MediaURL        string `json:"media_url,omitempty"`
	MediaName       string `json:"media_name,omitempty"`
	MediaSize       int64  `json:"media_size,omitempty"`
	Duration        int32  `json:"duration,omitempty"`
	ConversationKey string `json:"conversation_key,omitempty"` // 显式指定消息所属会话
	CreatedAt       int64  `json:"created_at"`                 // Unix 毫秒,由 Chat 服务写入
	ClientSeq       int64  `json:"client_seq"`                 // 客户端自增序号,用于消息去重
}

SaveMessagePayload message:save 任务的 payload Chat 服务将收到的消息封装成此结构投递到 Asynq 队列 Message 服务的 Asynq consumer 消费此任务完成消息持久化

func ParseSaveMessagePayload

func ParseSaveMessagePayload(t *asynq.Task) (*SaveMessagePayload, error)

ParseSaveMessagePayload 解析 message:save 任务的 payload 供 internal/message/consumer 中的 handler 使用

type SetFlashViewCachePayload

type SetFlashViewCachePayload struct {
	MsgID  int64 `json:"msg_id"`
	UserID int64 `json:"user_id"`
}

SetFlashViewCachePayload flash_msg_views INSERT 时回填闪讯已读缓存的任务 payload

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL