Files
mayfly-go/server/internal/msg/domain/entity/msg.go

51 lines
1.1 KiB
Go
Raw Normal View History

2021-09-11 14:04:09 +08:00
package entity
import (
"mayfly-go/pkg/model"
2021-09-11 14:04:09 +08:00
)
type Msg struct {
model.ExtraData
model.CreateModel
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"
}
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 // 未读
)