Documentation
¶
Index ¶
- func DisableGormErrorMail()
- func EnableGormErrorMail(appName, host string, port int, from, to, username, password string) error
- func FeishuRobotDetail(msg string, appName ...string)
- func IsGormErrorMailEnabled() bool
- func RequestJson(method string, url string, paramBody io.Reader, headerMap map[string]string)
- func SendRobotMessage(content string, talkType, ReceiverId, RobotId int)
- func SendToRobotMessage(appName, msg string, talkType, ReceiverId, RobotId int)
- type GormErrorMailHook
- type MailAuthHook
- type MailHook
- type MessageParamIM
- type NewMessageParamIM
- type NewRobotTextMessageRequest
- type RobotLog
- type TenantAccessTokenBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableGormErrorMail ¶
func FeishuRobotDetail ¶
func IsGormErrorMailEnabled ¶
func IsGormErrorMailEnabled() bool
IsGormErrorMailEnabled 检查GORM错误邮件报警是否启用
func RequestJson ¶
func SendRobotMessage ¶
func SendToRobotMessage ¶
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 ¶
NewMailHook creates a hook to be added to an instance of logger.
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 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
Click to show internal directories.
Click to hide internal directories.