Files
platform/web/events/channel.go

25 lines
456 B
Go

package events
import (
"encoding/json"
"log/slog"
"github.com/hibiken/asynq"
)
const RemoveChannel = "channel:remove"
type RemoveChannelData struct {
Batch string `json:"batch"`
IDs []int32 `json:"ids"`
}
func NewRemoveChannel(data RemoveChannelData) *asynq.Task {
bytes, err := json.Marshal(data)
if err != nil {
slog.Error("序列化删除通道任务失败", "error", err)
return nil
}
return asynq.NewTask(RemoveChannel, bytes)
}