notification

package
v0.0.0-...-15e3088 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PollCreatedNotificationExchange   = "notification"
	PollCreatedNotificationRoutingKey = "notification.hitokoto_poll_created"
)
View Source
const (
	PollDailyReportNotificationExchange   = "notification"
	PollDailyReportNotificationRoutingKey = "notification.hitokoto_poll_daily_report"
)
View Source
const (
	PollFinishedNotificationExchange   = "notification"
	PollFinishedNotificationRoutingKey = "notification.hitokoto_poll_finished"
)
View Source
const (
	SentenceReviewedNotificationExchange   = "notification"
	SentenceReviewedNotificationRoutingKey = "notification.hitokoto_reviewed"
)

Variables

View Source
var PollCreatedNotificationSettingField = dao.UserNotification.Columns().EmailNotificationPollCreated
View Source
var PollDailyReportNotificationSettingField = dao.UserNotification.Columns().EmailNotificationPollDailyReport
View Source
var PollFinishedNotificationSettingField = dao.UserNotification.Columns().EmailNotificationPollResult
View Source
var SentenceReviewedNotificationSettingField = dao.UserNotification.Columns().EmailNotificationHitokotoReviewed

Functions

func DoNotification

func DoNotification(ctx context.Context, exchange, routingKey string, data []any) error

DoNotification 发送通知 TODO: 合并成一条消息,让消费者自行处理

func New

func New() service.INotification

Types

type PollCreatedNotificationMessage

type PollCreatedNotificationMessage struct {
	To         string  `json:"to"`          // Email
	UUID       string  `json:"uuid"`        // SentenceUUID
	Hitokoto   string  `json:"hitokoto"`    // Sentence
	From       string  `json:"from"`        // From
	FromWho    *string `json:"from_who"`    // FromWho
	Type       string  `json:"type"`        // Hitokoto Type
	Creator    string  `json:"creator"`     // Creator
	CreatorUID uint    `json:"creator_uid"` // CreatorUID
	UserName   string  `json:"user_name"`   // receiver name
	ID         int     `json:"id"`          // Poll ID
	CreatedAt  string  `json:"created_at"`  // Poll CreatedAt ISO 时间
}

type PollFinishedNotificationMessage

type PollFinishedNotificationMessage struct {
	To         string  `json:"to"`          // Email
	UUID       string  `json:"uuid"`        // SentenceUUID
	Hitokoto   string  `json:"hitokoto"`    // Sentence
	From       string  `json:"from"`        // From
	FromWho    *string `json:"from_who"`    // FromWho
	Type       string  `json:"type"`        // Hitokoto Type
	Creator    string  `json:"creator"`     // Creator
	CreatorUID uint    `json:"creator_uid"` // CreatorUID

	ID        int    `json:"id"`         // 投票 ID
	UpdatedAt string `json:"updated_at"` // 投票更新时间,这里也是结束时间
	UserName  string `json:"user_name"`  // 审核员名字
	CreatedAt string `json:"created_at"` // 投票创建时间
	Status    int    `json:"status"`     // 投票结果: 200 入库,201 驳回,202 需要修改
	Method    int    `json:"method"`     // 审核员投票方式: 1 入库,2 驳回,3 需要修改
	Point     int    `json:"point"`      // 审核员投的票数

}

type SentenceReviewedNotificationMessage

type SentenceReviewedNotificationMessage struct {
	To         string  `json:"to"`          // Email
	UUID       string  `json:"uuid"`        // SentenceUUID
	Hitokoto   string  `json:"hitokoto"`    // Sentence
	From       string  `json:"from"`        // From
	FromWho    *string `json:"from_who"`    // FromWho
	Type       string  `json:"type"`        // Hitokoto Type
	Creator    string  `json:"creator"`     // Creator
	CreatorUID uint    `json:"creator_uid"` // CreatorUID
	CreatedAt  string  `json:"created_at"`  // Sentence CreatedAt

	OperatedAt   string `json:"operated_at"`   // 操作时间
	ReviewerName string `json:"reviewer_name"` // 审核员名称
	ReviewerUID  int    `json:"reviewer_uid"`  // 审核员用户标识
	Status       int    `json:"status"`        // 审核结果: 200 为通过,201 为驳回
}

Jump to

Keyboard shortcuts

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