Documentation ¶
Overview ¶
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Copyright 2019-2020 Axetroy. All rights reserved. MIT license.
Index ¶
- Variables
- func CreateConsumer(topic Topic, channel Chanel, handler nsq.Handler) (c *nsq.Consumer, err error)
- func DeferredPublish(topic Topic, delay time.Duration, message []byte) (err error)
- func Publish(topic Topic, message []byte) (err error)
- func PublishCheckUserLogin(userID string) error
- func PublishNotifyToAllUser(title string, content string, delay time.Duration, data map[string]interface{}) error
- func PublishNotifyToSpecificUser(userId []string, title string, content string, delay time.Duration, ...) error
- func PublishSystemNotify(notificationID string) error
- func PublishUserMessage(messageID string) error
- type BodySendActivationEmail
- type BodySendNotify
- type Chanel
- type PayloadPublishCheckUserLoginStatus
- type PayloadPublishSystemNotification
- type PayloadPublishUserMessage
- type PayloadToAllUsers
- type PayloadToSpecificUsers
- type Topic
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TopicSendEmail Topic = "topic_send_email" ChanelSendEmail Chanel = "chanel_send_email" TopicPushNotify Topic = "topic_push_notify" ChanelPushNotify Chanel = "chanel_push_notify" Address = net.JoinHostPort(config.MessageQueue.Host, config.MessageQueue.Port) // 消息队列地址 Config *nsq.Config // 消息队列的配置 )
Functions ¶
func CreateConsumer ¶
创建消费者
func DeferredPublish ¶
func PublishNotifyToAllUser ¶
func PublishNotifyToAllUser(title string, content string, delay time.Duration, data map[string]interface{}) error
发送到消息队列 - 发送推送给所有用户
func PublishNotifyToSpecificUser ¶
func PublishNotifyToSpecificUser(userId []string, title string, content string, delay time.Duration, data map[string]interface{}) error
发送到消息队列 - 发送推送给特定用户
func PublishUserMessage ¶ added in v0.7.0
推送 - 用户个人消息
Types ¶
type BodySendActivationEmail ¶
type BodySendNotify ¶
type BodySendNotify struct { Event notify.Event `json:"event" validate:"required" comment:"事件名称"` // 事件名称 Payload interface{} `json:"payload" validate:"required" comment:"数据体"` // 数据体 }
func (*BodySendNotify) ToByte ¶
func (c *BodySendNotify) ToByte() ([]byte, error)
type PayloadPublishCheckUserLoginStatus ¶
type PayloadPublishCheckUserLoginStatus struct {
UserID string `json:"user_id" validate:"required" comment:"用户ID"`
}
type PayloadPublishSystemNotification ¶
type PayloadPublishSystemNotification struct {
NotificationID string `json:"notification_id" validate:"required" comment:"系统通知 ID"`
}
type PayloadPublishUserMessage ¶ added in v0.7.0
type PayloadPublishUserMessage struct {
MessageID string `json:"message_id"`
}
type PayloadToAllUsers ¶
type PayloadToSpecificUsers ¶
type PayloadToSpecificUsers struct { UserID []string `json:"user_id" validate:"required" comment:"用户 ID"` // 要指定的推送用户 ID Title string `json:"title" validate:"required" comment:"标题"` // 推送的标题 Content string `json:"content" validate:"required" comment:"内容"` // 推送的内容 Data map[string]interface{} `json:"data" validate:"omitempty" comment:"附带数据"` // 附带给 APP 的数据 }
Click to show internal directories.
Click to hide internal directories.