83 lines
2.1 KiB
Go
83 lines
2.1 KiB
Go
package model
|
|
|
|
const (
|
|
MessageTypeStore = 1
|
|
MessageTypeUser = 2
|
|
)
|
|
|
|
const (
|
|
MessageStatusNew = 0
|
|
MessageStatusSendAllSuccess = 1
|
|
MessageStatusSendSuccess = 2
|
|
MessageStatusSendAllFailed = 3
|
|
)
|
|
|
|
var (
|
|
StoreMsgSendStatusName = map[int]string{
|
|
MessageStatusNew: "发送中",
|
|
MessageStatusSendAllSuccess: "成功",
|
|
MessageStatusSendSuccess: "部分成功",
|
|
MessageStatusSendAllFailed: "失败",
|
|
}
|
|
)
|
|
|
|
type Message struct {
|
|
ModelIDCULD
|
|
Type int8 `json:"type"`
|
|
Title string `json:"title"`
|
|
Content string `orm:"type(text)" json:"content"`
|
|
}
|
|
|
|
func (*Message) TableIndex() [][]string {
|
|
return [][]string{
|
|
[]string{"CreatedAt"},
|
|
[]string{"DeletedAt"},
|
|
}
|
|
}
|
|
|
|
type MessageStatus struct {
|
|
ModelIDCULD
|
|
MessageID int `orm:"column(message_id)" json:"messageID"`
|
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
|
Status int8 `json:"status"`
|
|
ReadCount int `json:"readCount"`
|
|
UserID string `orm:"column(user_id)" json:"userID"`
|
|
}
|
|
|
|
func (*MessageStatus) TableIndex() [][]string {
|
|
return [][]string{
|
|
[]string{"MessageID", "Status"},
|
|
[]string{"StoreID", "MessageID", "Status"},
|
|
}
|
|
}
|
|
|
|
type ImMessageRecord struct {
|
|
ModelIDCULD
|
|
UserID string `orm:"size(48);column(user_id)" json:"userID"` //消息发送方userID
|
|
ReceiveID string `orm:"size(48);column(receive_id)" json:"receiveID"` //群组ID
|
|
Name string `json:"name"`
|
|
Content string `orm:"type(text)" json:"content"` //消息内容
|
|
MessageType int `json:"messageType"` //消息类型,文字,图片
|
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
|
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
|
}
|
|
|
|
func (*ImMessageRecord) TableIndex() [][]string {
|
|
return [][]string{
|
|
[]string{"UserID"},
|
|
[]string{"ReceiveID"},
|
|
[]string{"StoreID"},
|
|
[]string{"VendorID"},
|
|
[]string{"VendorOrderID"},
|
|
}
|
|
}
|
|
|
|
type MessageGroup struct {
|
|
ModelIDCUL
|
|
|
|
UserID string `orm:"size(48);column(user_id)" json:"userID"` //创建组的userID
|
|
Name string `json:"name"` //组名
|
|
|
|
}
|