Files
jx-callback/business/model/message.go
苏尹岚 ef6bccc543 a
2020-12-30 14:51:40 +08:00

129 lines
3.8 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
MessageTypeUser = 2
)
const (
MessageStatusNew = 0
MessageStatusSendAllSuccess = 1
MessageStatusSendSuccess = 2
MessageStatusSendAllFailed = 3
GroupTypeSingle = 1 //单聊
GroupTypeMulit = 2 //群聊
GroupMemberTypeNormal = 1 //普通群员
)
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
GroupID int `orm:"column(group_id)" json:"groupID"` //组ID
Content string `orm:"type(text)" json:"content"` //消息内容
MessageType int `json:"messageType"` //消息类型1文字2图片,3音频
Seq int `json:"seq"`
Weight int `json:"weight"`
Height int `json:"height"`
AudioLength string `json:"audioLength"`
Key string `orm:"-" json:"key"`
ToUserID string `orm:"size(48);column(to_user_id)" json:"toUserID"` //收消息的userID
UserInfo *GetUserResult `orm:"-" json:"userInfo"`
}
func (*ImMessageRecord) TableIndex() [][]string {
return [][]string{
[]string{"GroupID"},
[]string{"CreatedAt"},
}
}
type MessageGroup struct {
ModelIDCULD
GroupID int `orm:"column(group_id)" json:"groupID"` //组ID
UserID string `orm:"size(48);column(user_id)" json:"userID"` //创建组的userID
Name string `json:"name"` //组名
Type int `json:"type"` //组类型1为单聊2为群聊
MaxCount int `json:"maxCount"` //最大人数
DividePercentage int `json:"dividePercentage"` //分成比例
QuitPrice int `json:"quitPrice"` //退出条件(金额)
GroupAvatar string `json:"groupAvatar"` //群头像
}
func (*MessageGroup) TableIndex() [][]string {
return [][]string{
[]string{"UserID"},
}
}
type MessageGroupMember struct {
ModelIDCULD
GroupID int `orm:"column(group_id)" json:"groupID"` //组ID
MemberUserID string `orm:"column(member_user_id)" json:"memberUserID"` //成员用户ID
Type int `json:"type"` //组员类型,管理员?
}
func (*MessageGroupMember) TableIndex() [][]string {
return [][]string{
[]string{"GroupID"},
[]string{"MemberUserID"},
}
}
type MessageGroupRead struct {
ModelIDCUL
GroupID int `orm:"column(group_id)" json:"groupID"` //组ID
UserID string `orm:"size(48);column(user_id)" json:"userID"` //创建组的userID
UnReadCount int `json:"unReadCount"` //未读数
}
func (*MessageGroupRead) TableIndex() [][]string {
return [][]string{
[]string{"UserID", "GroupID"},
}
}