Files
jx-callback/business/model/message.go
2020-08-26 09:05:20 +08:00

73 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
const (
MessageTypeStore = 1
)
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"`
}
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可以是userID也可以是群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"},
}
}