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 int64 `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 } 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"}, } }