2021-09-11 14:04:09 +08:00
|
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
2023-07-20 22:41:13 +08:00
|
|
|
|
"mayfly-go/pkg/model"
|
2021-09-11 14:04:09 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type Msg struct {
|
2025-07-27 21:02:48 +08:00
|
|
|
|
model.ExtraData
|
|
|
|
|
|
model.CreateModel
|
2023-07-20 22:41:13 +08:00
|
|
|
|
|
2025-07-27 21:02:48 +08:00
|
|
|
|
Type MsgType `json:"type"` // 消息类型
|
|
|
|
|
|
Subtype MsgSubtype `json:"subtype" gorm:"size:100"` // 消息子类型
|
|
|
|
|
|
Status MsgStatus `json:"status"`
|
|
|
|
|
|
Msg string `json:"msg" gorm:"size:2000"`
|
|
|
|
|
|
RecipientId int64 `json:"recipientId"` // 接收人id,-1为所有接收
|
2021-09-11 14:04:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *Msg) TableName() string {
|
|
|
|
|
|
return "t_sys_msg"
|
|
|
|
|
|
}
|
2025-07-27 21:02:48 +08:00
|
|
|
|
|
|
|
|
|
|
type MsgType int8
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
MsgTypeNotify MsgType = 1 // 通知
|
|
|
|
|
|
MsgTypeTodo MsgType = 2 // 代办
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type MsgSubtype string
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
// sys
|
|
|
|
|
|
MsgSubtypeUserLogin MsgSubtype = "user.login"
|
|
|
|
|
|
|
|
|
|
|
|
// machine
|
|
|
|
|
|
MsgSubtypeMachineFileUploadSuccess MsgSubtype = "machine.file.upload.success"
|
|
|
|
|
|
MsgSubtypeMachineFileUploadFail MsgSubtype = "machine.file.upload.fail"
|
|
|
|
|
|
|
|
|
|
|
|
// db
|
|
|
|
|
|
MsgSubtypeDbDumpFail MsgSubtype = "db.dump.fail"
|
|
|
|
|
|
MsgSubtypeSqlScriptRunFail MsgSubtype = "db.sqlscript.run.fail"
|
|
|
|
|
|
MsgSubtypeSqlScriptRunSuccess MsgSubtype = "db.sqlscript.run.success"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type MsgStatus int8
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
MsgStatusRead MsgStatus = 1 // 已读
|
|
|
|
|
|
MsgStatusUnRead MsgStatus = -1 // 未读
|
|
|
|
|
|
)
|