40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package model
|
|
|
|
import (
|
|
"gitee.ltd/lxh/wechat-robot/internal/types"
|
|
"time"
|
|
)
|
|
|
|
// ContentType 表示消息类型的枚举
|
|
type ContentType string
|
|
|
|
const (
|
|
ContentTypeText ContentType = "text"
|
|
ContentTypeImage ContentType = "image"
|
|
ContentTypeVoice ContentType = "voice"
|
|
ContentTypeVideo ContentType = "video"
|
|
ContentTypeFile ContentType = "file"
|
|
ContentTypeLocation ContentType = "location"
|
|
ContentTypeSystem ContentType = "system"
|
|
)
|
|
|
|
// Message 表示微信消息
|
|
type Message struct {
|
|
BaseModel
|
|
RobotId uint // 机器人Id
|
|
MsgId int64 // 消息Id
|
|
CreateTime int // 发送时间戳
|
|
CreateAt time.Time // 发送时间
|
|
Type types.MessageType // 消息类型
|
|
Content string // 内容
|
|
DisplayFullContent string // 显示的完整内容
|
|
FromUser string // 发送者
|
|
GroupUser string // 群成员
|
|
ToUser string // 接收者
|
|
}
|
|
|
|
// TableName 指定表名
|
|
func (Message) TableName() string {
|
|
return "messages"
|
|
}
|