notification

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableGormErrorMail

func DisableGormErrorMail()

DisableGormErrorMail 禁用GORM错误邮件报警

func EnableGormErrorMail

func EnableGormErrorMail(appName, host string, port int, from, to, username, password string) error

func FeishuRobotDetail

func FeishuRobotDetail(msg string, appName ...string)

func IsGormErrorMailEnabled

func IsGormErrorMailEnabled() bool

IsGormErrorMailEnabled 检查GORM错误邮件报警是否启用

func RequestJson

func RequestJson(method string, url string, paramBody io.Reader, headerMap map[string]string)

func SendRobotMessage

func SendRobotMessage(content string, talkType, ReceiverId, RobotId int)

func SendToRobotMessage

func SendToRobotMessage(appName, msg string, talkType, ReceiverId, RobotId int)

Types

type GormErrorMailHook

type GormErrorMailHook struct {
	AppName  string
	Host     string
	Port     int
	From     *mail.Address
	To       *mail.Address
	Username string
	Password string
	Enable   bool // 是否启用GORM错误邮件报警
}

GormErrorMailHook 专门用于GORM错误日志的邮件报警Hook

func GetGormErrorMailHook

func GetGormErrorMailHook() *GormErrorMailHook

GetGormErrorMailHook 获取全局GORM错误邮件报警Hook实例

func NewGormErrorMailHook

func NewGormErrorMailHook(appName, host string, port int, from, to, username, password string) (*GormErrorMailHook, error)

创建GORM错误邮件报警Hook

func (*GormErrorMailHook) Fire

func (hook *GormErrorMailHook) Fire(entry *logrus.Entry) error

Fire 处理日志条目

func (*GormErrorMailHook) Levels

func (hook *GormErrorMailHook) Levels() []logrus.Level

Levels 返回处理的日志级别

type MailAuthHook

type MailAuthHook struct {
	AppName  string
	Host     string
	Port     int
	From     *mail.Address
	To       *mail.Address
	Username string
	Password string
}

MailAuthHook to sends logs by email with authentication.

func NewMailAuthHook

func NewMailAuthHook(appname string, host string, port int, from string, to string, username string, password string) (*MailAuthHook, error)

creates a hook to be added to an instance of logger.

func (*MailAuthHook) Fire

func (hook *MailAuthHook) Fire(entry *logrus.Entry) error

Fire is called when a log event is fired.

func (*MailAuthHook) Levels

func (hook *MailAuthHook) Levels() []logrus.Level

Levels returns the available logging levels.

type MailHook

type MailHook struct {
	AppName string
	// contains filtered or unexported fields
}

MailHook to sends logs by email without authentication.

func NewMailHook

func NewMailHook(appname string, host string, port int, from string, to string) (*MailHook, error)

NewMailHook creates a hook to be added to an instance of logger.

func (*MailHook) Fire

func (hook *MailHook) Fire(entry *logrus.Entry) error

Fire is called when a log event is fired.

func (*MailHook) Levels

func (hook *MailHook) Levels() []logrus.Level

Levels returns the available logging levels.

type MessageParamIM

type MessageParamIM struct {
	TalkType   int    `form:"talk_type" json:"talk_type" binding:"required,oneof=1 2" label:"talk_type"`
	ReceiverId int    `form:"receiver_id" json:"receiver_id" binding:"required,numeric,gt=0" label:"receiver_id"`
	Text       string `form:"text" json:"text" binding:"required,max=3000" label:"text"`
	RobotId    int    `form:"robot_id" json:"robot_id" label:"robot_id"`
}

type NewMessageParamIM

type NewMessageParamIM struct {
	Type string `json:"type"`
	//SenderId int           `json:"sender_id"` // TODO 最好传过来,可以标记是极兔助手还是快码机器人。但是总体来说没啥关系。
	Content  string        `json:"content"`
	QuoteId  string        `json:"quote_id"`
	Mentions []interface{} `json:"mentions"`
	Receiver struct {
		ReceiverId int `json:"receiver_id"`
		TalkType   int `json:"talk_type"`
	} `json:"receiver"`
}

type NewRobotTextMessageRequest

type NewRobotTextMessageRequest struct {
	NewMessageParamIM
	RobotId int `json:"robot_id"`
}

type RobotLog

type RobotLog struct {
	AppName string
}

func NewRobotLogger

func NewRobotLogger(AppName string) *RobotLog

func (*RobotLog) Fire

func (hook *RobotLog) Fire(entry *log.Entry) error

func (*RobotLog) Levels

func (hook *RobotLog) Levels() []log.Level

type TenantAccessTokenBody

type TenantAccessTokenBody struct {
	Code              int `json:"code"`
	Expire            int `json:"expire"`
	RequestTime       time.Time
	Msg               string `json:"msg"`
	TenantAccessToken string `json:"tenant_access_token"`
}
var LatestToken TenantAccessTokenBody // 最新的token

Jump to

Keyboard shortcuts

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