parent
ff88f5d54a
commit
b637a29348
@ -1,165 +0,0 @@
|
|||||||
package table
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
FriendModelTableName = ""
|
|
||||||
ConversationModelTableName = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
type FriendModel struct {
|
|
||||||
OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"`
|
|
||||||
FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"`
|
|
||||||
Remark string `gorm:"column:remark;size:255"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time"`
|
|
||||||
AddSource int32 `gorm:"column:add_source"`
|
|
||||||
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConversationModel struct {
|
|
||||||
OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"`
|
|
||||||
ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"`
|
|
||||||
ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"`
|
|
||||||
UserID string `gorm:"column:user_id;type:char(64)" json:"userID"`
|
|
||||||
GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"`
|
|
||||||
RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"`
|
|
||||||
UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"`
|
|
||||||
DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"`
|
|
||||||
IsPinned bool `gorm:"column:is_pinned" json:"isPinned"`
|
|
||||||
IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"`
|
|
||||||
BurnDuration int32 `gorm:"column:burn_duration;default:30" json:"burnDuration"`
|
|
||||||
GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"`
|
|
||||||
IsNotInGroup bool `gorm:"column:is_not_in_group" json:"isNotInGroup"`
|
|
||||||
UpdateUnreadCountTime int64 `gorm:"column:update_unread_count_time" json:"updateUnreadCountTime"`
|
|
||||||
AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"`
|
|
||||||
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupModel struct {
|
|
||||||
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
|
|
||||||
GroupName string `gorm:"column:name;size:255" json:"groupName"`
|
|
||||||
Notification string `gorm:"column:notification;size:255" json:"notification"`
|
|
||||||
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
|
|
||||||
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
|
||||||
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
|
|
||||||
Status int32 `gorm:"column:status"`
|
|
||||||
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
|
|
||||||
GroupType int32 `gorm:"column:group_type"`
|
|
||||||
NeedVerification int32 `gorm:"column:need_verification"`
|
|
||||||
LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"`
|
|
||||||
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
|
|
||||||
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
|
|
||||||
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *GroupModel) EqID(i interface{}) bool {
|
|
||||||
switch v := i.(type) {
|
|
||||||
case GroupModel:
|
|
||||||
return f.GroupID == v.GroupID
|
|
||||||
case *GroupModel:
|
|
||||||
return f.GroupID == v.GroupID
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func DuplicateRemoval[T any](arr []T, fn func(t T) string) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func aaa() {
|
|
||||||
DuplicateRemoval([]GroupModel{}, func(t GroupModel) string {
|
|
||||||
return t.GroupID
|
|
||||||
})
|
|
||||||
|
|
||||||
DuplicateRemoval([]*GroupModel{}, func(t *GroupModel) string {
|
|
||||||
return t.GroupID
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
type FriendRequestModel struct {
|
|
||||||
FromUserID string `gorm:"column:from_user_id;primary_key;size:64"`
|
|
||||||
ToUserID string `gorm:"column:to_user_id;primary_key;size:64"`
|
|
||||||
HandleResult int32 `gorm:"column:handle_result"`
|
|
||||||
ReqMsg string `gorm:"column:req_msg;size:255"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time"`
|
|
||||||
HandlerUserID string `gorm:"column:handler_user_id;size:64"`
|
|
||||||
HandleMsg string `gorm:"column:handle_msg;size:255"`
|
|
||||||
HandleTime time.Time `gorm:"column:handle_time"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupMemberModel struct {
|
|
||||||
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
|
||||||
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
|
||||||
Nickname string `gorm:"column:nickname;size:255"`
|
|
||||||
FaceURL string `gorm:"column:user_group_face_url;size:255"`
|
|
||||||
RoleLevel int32 `gorm:"column:role_level"`
|
|
||||||
JoinTime time.Time `gorm:"column:join_time"`
|
|
||||||
JoinSource int32 `gorm:"column:join_source"`
|
|
||||||
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
|
||||||
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
|
||||||
MuteEndTime time.Time `gorm:"column:mute_end_time"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupRequestModel struct {
|
|
||||||
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
|
||||||
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
|
||||||
HandleResult int32 `gorm:"column:handle_result"`
|
|
||||||
ReqMsg string `gorm:"column:req_msg;size:1024"`
|
|
||||||
HandledMsg string `gorm:"column:handle_msg;size:1024"`
|
|
||||||
ReqTime time.Time `gorm:"column:req_time"`
|
|
||||||
HandleUserID string `gorm:"column:handle_user_id;size:64"`
|
|
||||||
HandledTime time.Time `gorm:"column:handle_time"`
|
|
||||||
JoinSource int32 `gorm:"column:join_source"`
|
|
||||||
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserModel struct {
|
|
||||||
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
|
||||||
Nickname string `gorm:"column:name;size:255"`
|
|
||||||
FaceURL string `gorm:"column:face_url;size:255"`
|
|
||||||
Gender int32 `gorm:"column:gender"`
|
|
||||||
PhoneNumber string `gorm:"column:phone_number;size:32"`
|
|
||||||
Birth time.Time `gorm:"column:birth"`
|
|
||||||
Email string `gorm:"column:email;size:64"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
|
||||||
AppMangerLevel int32 `gorm:"column:app_manger_level"`
|
|
||||||
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BlackModel struct {
|
|
||||||
OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"`
|
|
||||||
BlockUserID string `gorm:"column:block_user_id;primary_key;size:64"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time"`
|
|
||||||
AddSource int32 `gorm:"column:add_source"`
|
|
||||||
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
|
||||||
Ex string `gorm:"column:ex;size:1024"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChatLogModel struct {
|
|
||||||
ServerMsgID string `gorm:"column:server_msg_id;primary_key;type:char(64)" json:"serverMsgID"`
|
|
||||||
ClientMsgID string `gorm:"column:client_msg_id;type:char(64)" json:"clientMsgID"`
|
|
||||||
SendID string `gorm:"column:send_id;type:char(64);index:send_id,priority:2" json:"sendID"`
|
|
||||||
RecvID string `gorm:"column:recv_id;type:char(64);index:recv_id,priority:2" json:"recvID"`
|
|
||||||
SenderPlatformID int32 `gorm:"column:sender_platform_id" json:"senderPlatformID"`
|
|
||||||
SenderNickname string `gorm:"column:sender_nick_name;type:varchar(255)" json:"senderNickname"`
|
|
||||||
SenderFaceURL string `gorm:"column:sender_face_url;type:varchar(255);" json:"senderFaceURL"`
|
|
||||||
SessionType int32 `gorm:"column:session_type;index:session_type,priority:2;index:session_type_alone" json:"sessionType"`
|
|
||||||
MsgFrom int32 `gorm:"column:msg_from" json:"msgFrom"`
|
|
||||||
ContentType int32 `gorm:"column:content_type;index:content_type,priority:2;index:content_type_alone" json:"contentType"`
|
|
||||||
Content string `gorm:"column:content;type:varchar(3000)" json:"content"`
|
|
||||||
Status int32 `gorm:"column:status" json:"status"`
|
|
||||||
SendTime time.Time `gorm:"column:send_time;index:sendTime;index:content_type,priority:1;index:session_type,priority:1;index:recv_id,priority:1;index:send_id,priority:1" json:"sendTime"`
|
|
||||||
CreateTime time.Time `gorm:"column:create_time" json:"createTime"`
|
|
||||||
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
|
||||||
DB *gorm.DB
|
|
||||||
}
|
|
@ -0,0 +1,25 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BlackModelTableName = "blacks"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BlackModel struct {
|
||||||
|
OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"`
|
||||||
|
BlockUserID string `gorm:"column:block_user_id;primary_key;size:64"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time"`
|
||||||
|
AddSource int32 `gorm:"column:add_source"`
|
||||||
|
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (BlackModel) TableName() string {
|
||||||
|
return BlackModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type BlackModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
pbMsg "Open_IM/pkg/proto/msg"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ChatLogModelTableName = "chat_logs"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ChatLogModel struct {
|
||||||
|
ServerMsgID string `gorm:"column:server_msg_id;primary_key;type:char(64)" json:"serverMsgID"`
|
||||||
|
ClientMsgID string `gorm:"column:client_msg_id;type:char(64)" json:"clientMsgID"`
|
||||||
|
SendID string `gorm:"column:send_id;type:char(64);index:send_id,priority:2" json:"sendID"`
|
||||||
|
RecvID string `gorm:"column:recv_id;type:char(64);index:recv_id,priority:2" json:"recvID"`
|
||||||
|
SenderPlatformID int32 `gorm:"column:sender_platform_id" json:"senderPlatformID"`
|
||||||
|
SenderNickname string `gorm:"column:sender_nick_name;type:varchar(255)" json:"senderNickname"`
|
||||||
|
SenderFaceURL string `gorm:"column:sender_face_url;type:varchar(255);" json:"senderFaceURL"`
|
||||||
|
SessionType int32 `gorm:"column:session_type;index:session_type,priority:2;index:session_type_alone" json:"sessionType"`
|
||||||
|
MsgFrom int32 `gorm:"column:msg_from" json:"msgFrom"`
|
||||||
|
ContentType int32 `gorm:"column:content_type;index:content_type,priority:2;index:content_type_alone" json:"contentType"`
|
||||||
|
Content string `gorm:"column:content;type:varchar(3000)" json:"content"`
|
||||||
|
Status int32 `gorm:"column:status" json:"status"`
|
||||||
|
SendTime time.Time `gorm:"column:send_time;index:sendTime;index:content_type,priority:1;index:session_type,priority:1;index:recv_id,priority:1;index:send_id,priority:1" json:"sendTime"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time" json:"createTime"`
|
||||||
|
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
||||||
|
DB *gorm.DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ChatLogModel) TableName() string {
|
||||||
|
return ChatLogModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChatLogModelInterface interface {
|
||||||
|
Create(msg pbMsg.MsgDataToMQ) error
|
||||||
|
GetChatLog(chatLog *ChatLogModel, pageNumber, showNumber int32, contentTypeList []int32) (int64, []ChatLogModel, error)
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
const (
|
||||||
|
conversationModelTableName = "conversations"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConversationModel struct {
|
||||||
|
OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"`
|
||||||
|
ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"`
|
||||||
|
ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"`
|
||||||
|
UserID string `gorm:"column:user_id;type:char(64)" json:"userID"`
|
||||||
|
GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"`
|
||||||
|
RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"`
|
||||||
|
UnreadCount int32 `gorm:"column:unread_count" json:"unreadCount"`
|
||||||
|
DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"`
|
||||||
|
IsPinned bool `gorm:"column:is_pinned" json:"isPinned"`
|
||||||
|
IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"`
|
||||||
|
BurnDuration int32 `gorm:"column:burn_duration;default:30" json:"burnDuration"`
|
||||||
|
GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"`
|
||||||
|
IsNotInGroup bool `gorm:"column:is_not_in_group" json:"isNotInGroup"`
|
||||||
|
UpdateUnreadCountTime int64 `gorm:"column:update_unread_count_time" json:"updateUnreadCountTime"`
|
||||||
|
AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"`
|
||||||
|
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ConversationModel) TableName() string {
|
||||||
|
return conversationModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConversationModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
FriendModelTableName = "friends"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FriendModel struct {
|
||||||
|
OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"`
|
||||||
|
FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"`
|
||||||
|
Remark string `gorm:"column:remark;size:255"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time"`
|
||||||
|
AddSource int32 `gorm:"column:add_source"`
|
||||||
|
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FriendModel) TableName() string {
|
||||||
|
return FriendModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type FriendModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const FriendRequestModelTableName = "friend_requests"
|
||||||
|
|
||||||
|
type FriendRequestModel struct {
|
||||||
|
FromUserID string `gorm:"column:from_user_id;primary_key;size:64"`
|
||||||
|
ToUserID string `gorm:"column:to_user_id;primary_key;size:64"`
|
||||||
|
HandleResult int32 `gorm:"column:handle_result"`
|
||||||
|
ReqMsg string `gorm:"column:req_msg;size:255"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time"`
|
||||||
|
HandlerUserID string `gorm:"column:handler_user_id;size:64"`
|
||||||
|
HandleMsg string `gorm:"column:handle_msg;size:255"`
|
||||||
|
HandleTime time.Time `gorm:"column:handle_time"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (FriendRequestModel) TableName() string {
|
||||||
|
return FriendRequestModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type FriendRequestModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
GroupModelTableName = "groups"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GroupModel struct {
|
||||||
|
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
|
||||||
|
GroupName string `gorm:"column:name;size:255" json:"groupName"`
|
||||||
|
Notification string `gorm:"column:notification;size:255" json:"notification"`
|
||||||
|
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
|
||||||
|
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
||||||
|
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
|
||||||
|
Status int32 `gorm:"column:status"`
|
||||||
|
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
|
||||||
|
GroupType int32 `gorm:"column:group_type"`
|
||||||
|
NeedVerification int32 `gorm:"column:need_verification"`
|
||||||
|
LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"`
|
||||||
|
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
|
||||||
|
NotificationUpdateTime time.Time `gorm:"column:notification_update_time"`
|
||||||
|
NotificationUserID string `gorm:"column:notification_user_id;size:64"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (GroupModel) TableName() string {
|
||||||
|
return GroupModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type GroupModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
GroupMemberModelTableName = "group_members"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GroupMemberModel struct {
|
||||||
|
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
||||||
|
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
||||||
|
Nickname string `gorm:"column:nickname;size:255"`
|
||||||
|
FaceURL string `gorm:"column:user_group_face_url;size:255"`
|
||||||
|
RoleLevel int32 `gorm:"column:role_level"`
|
||||||
|
JoinTime time.Time `gorm:"column:join_time"`
|
||||||
|
JoinSource int32 `gorm:"column:join_source"`
|
||||||
|
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
||||||
|
OperatorUserID string `gorm:"column:operator_user_id;size:64"`
|
||||||
|
MuteEndTime time.Time `gorm:"column:mute_end_time"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (GroupMemberModel) TableName() string {
|
||||||
|
return GroupMemberModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type GroupMemberModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
GroupRequestModelTableName = "group_requests"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GroupRequestModel struct {
|
||||||
|
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
||||||
|
GroupID string `gorm:"column:group_id;primary_key;size:64"`
|
||||||
|
HandleResult int32 `gorm:"column:handle_result"`
|
||||||
|
ReqMsg string `gorm:"column:req_msg;size:1024"`
|
||||||
|
HandledMsg string `gorm:"column:handle_msg;size:1024"`
|
||||||
|
ReqTime time.Time `gorm:"column:req_time"`
|
||||||
|
HandleUserID string `gorm:"column:handle_user_id;size:64"`
|
||||||
|
HandledTime time.Time `gorm:"column:handle_time"`
|
||||||
|
JoinSource int32 `gorm:"column:join_source"`
|
||||||
|
InviterUserID string `gorm:"column:inviter_user_id;size:64"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (GroupRequestModel) TableName() string {
|
||||||
|
return GroupRequestModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type GroupRequestModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package relation
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
const (
|
||||||
|
UserModelTableName = "users"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserModel struct {
|
||||||
|
UserID string `gorm:"column:user_id;primary_key;size:64"`
|
||||||
|
Nickname string `gorm:"column:name;size:255"`
|
||||||
|
FaceURL string `gorm:"column:face_url;size:255"`
|
||||||
|
Gender int32 `gorm:"column:gender"`
|
||||||
|
PhoneNumber string `gorm:"column:phone_number;size:32"`
|
||||||
|
Birth time.Time `gorm:"column:birth"`
|
||||||
|
Email string `gorm:"column:email;size:64"`
|
||||||
|
Ex string `gorm:"column:ex;size:1024"`
|
||||||
|
CreateTime time.Time `gorm:"column:create_time;index:create_time"`
|
||||||
|
AppMangerLevel int32 `gorm:"column:app_manger_level"`
|
||||||
|
GlobalRecvMsgOpt int32 `gorm:"column:global_recv_msg_opt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UserModel) TableName() string {
|
||||||
|
return GroupRequestModelTableName
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserModelInterface interface {
|
||||||
|
}
|
@ -1,133 +0,0 @@
|
|||||||
package table
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
CSuperGroup = "super_group"
|
|
||||||
CUserToSuperGroup = "user_to_super_group"
|
|
||||||
CTag = "tag"
|
|
||||||
CSendLog = "send_log"
|
|
||||||
CWorkMoment = "work_moment"
|
|
||||||
CExtendMsgSet = "extend_msgs"
|
|
||||||
|
|
||||||
ExtendMsgMaxNum = 100
|
|
||||||
)
|
|
||||||
|
|
||||||
type SuperGroupModel struct {
|
|
||||||
GroupID string `bson:"group_id" json:"groupID"`
|
|
||||||
MemberIDList []string `bson:"member_id_list" json:"memberIDList"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (SuperGroupModel) TableName() string {
|
|
||||||
return CSuperGroup
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserToSuperGroupModel struct {
|
|
||||||
UserID string `bson:"user_id" json:"userID"`
|
|
||||||
GroupIDList []string `bson:"group_id_list" json:"groupIDList"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (UserToSuperGroupModel) TableName() string {
|
|
||||||
return CUserToSuperGroup
|
|
||||||
}
|
|
||||||
|
|
||||||
type TagModel struct {
|
|
||||||
UserID string `bson:"user_id"`
|
|
||||||
TagID string `bson:"tag_id"`
|
|
||||||
TagName string `bson:"tag_name"`
|
|
||||||
UserList []string `bson:"user_list"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (TagModel) TableName() string {
|
|
||||||
return CTag
|
|
||||||
}
|
|
||||||
|
|
||||||
type CommonUserModel struct {
|
|
||||||
UserID string `bson:"user_id"`
|
|
||||||
UserName string `bson:"user_name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TagSendLogModel struct {
|
|
||||||
UserList []CommonUserModel `bson:"tag_list"`
|
|
||||||
SendID string `bson:"send_id"`
|
|
||||||
SenderPlatformID int32 `bson:"sender_platform_id"`
|
|
||||||
Content string `bson:"content"`
|
|
||||||
SendTime int64 `bson:"send_time"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (TagSendLogModel) TableName() string {
|
|
||||||
return CSendLog
|
|
||||||
}
|
|
||||||
|
|
||||||
type WorkMoment struct {
|
|
||||||
WorkMomentID string `bson:"work_moment_id"`
|
|
||||||
UserID string `bson:"user_id"`
|
|
||||||
UserName string `bson:"user_name"`
|
|
||||||
FaceURL string `bson:"face_url"`
|
|
||||||
Content string `bson:"content"`
|
|
||||||
LikeUserList []*CommonUserModel `bson:"like_user_list"`
|
|
||||||
AtUserList []*CommonUserModel `bson:"at_user_list"`
|
|
||||||
PermissionUserList []*CommonUserModel `bson:"permission_user_list"`
|
|
||||||
Comments []*CommonUserModel `bson:"comments"`
|
|
||||||
PermissionUserIDList []string `bson:"permission_user_id_list"`
|
|
||||||
Permission int32 `bson:"permission"`
|
|
||||||
CreateTime int32 `bson:"create_time"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (WorkMoment) TableName() string {
|
|
||||||
return CWorkMoment
|
|
||||||
}
|
|
||||||
|
|
||||||
type Comment struct {
|
|
||||||
UserID string `bson:"user_id" json:"user_id"`
|
|
||||||
UserName string `bson:"user_name" json:"user_name"`
|
|
||||||
ReplyUserID string `bson:"reply_user_id" json:"reply_user_id"`
|
|
||||||
ReplyUserName string `bson:"reply_user_name" json:"reply_user_name"`
|
|
||||||
ContentID string `bson:"content_id" json:"content_id"`
|
|
||||||
Content string `bson:"content" json:"content"`
|
|
||||||
CreateTime int32 `bson:"create_time" json:"create_time"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtendMsgSet struct {
|
|
||||||
SourceID string `bson:"source_id" json:"sourceID"`
|
|
||||||
SessionType int32 `bson:"session_type" json:"sessionType"`
|
|
||||||
ExtendMsgs map[string]ExtendMsg `bson:"extend_msgs" json:"extendMsgs"`
|
|
||||||
ExtendMsgNum int32 `bson:"extend_msg_num" json:"extendMsgNum"`
|
|
||||||
CreateTime int64 `bson:"create_time" json:"createTime"` // this block's create time
|
|
||||||
MaxMsgUpdateTime int64 `bson:"max_msg_update_time" json:"maxMsgUpdateTime"` // index find msg
|
|
||||||
}
|
|
||||||
|
|
||||||
type KeyValue struct {
|
|
||||||
TypeKey string `bson:"type_key" json:"typeKey"`
|
|
||||||
Value string `bson:"value" json:"value"`
|
|
||||||
LatestUpdateTime int64 `bson:"latest_update_time" json:"latestUpdateTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtendMsg struct {
|
|
||||||
ReactionExtensionList map[string]KeyValue `bson:"reaction_extension_list" json:"reactionExtensionList"`
|
|
||||||
ClientMsgID string `bson:"client_msg_id" json:"clientMsgID"`
|
|
||||||
MsgFirstModifyTime int64 `bson:"msg_first_modify_time" json:"msgFirstModifyTime"` // this extendMsg create time
|
|
||||||
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
|
||||||
Ex string `bson:"ex" json:"ex"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ExtendMsgSet) TableName() string {
|
|
||||||
return CExtendMsgSet
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ExtendMsgSet) GetExtendMsgMaxNum() int32 {
|
|
||||||
return ExtendMsgMaxNum
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ExtendMsgSet) GetSourceID(ID string, index int32) string {
|
|
||||||
return ID + ":" + strconv.Itoa(int(index))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *ExtendMsgSet) SplitSourceIDAndGetIndex() int32 {
|
|
||||||
l := strings.Split(e.SourceID, ":")
|
|
||||||
index, _ := strconv.Atoi(l[len(l)-1])
|
|
||||||
return int32(index)
|
|
||||||
}
|
|
@ -0,0 +1,6 @@
|
|||||||
|
package unrelation
|
||||||
|
|
||||||
|
type CommonUserModel struct {
|
||||||
|
UserID string `bson:"user_id"`
|
||||||
|
UserName string `bson:"user_name"`
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package unrelation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
CExtendMsgSet = "extend_msgs"
|
||||||
|
|
||||||
|
ExtendMsgMaxNum = 100
|
||||||
|
)
|
||||||
|
|
||||||
|
type ExtendMsgSet struct {
|
||||||
|
SourceID string `bson:"source_id" json:"sourceID"`
|
||||||
|
SessionType int32 `bson:"session_type" json:"sessionType"`
|
||||||
|
ExtendMsgs map[string]ExtendMsg `bson:"extend_msgs" json:"extendMsgs"`
|
||||||
|
ExtendMsgNum int32 `bson:"extend_msg_num" json:"extendMsgNum"`
|
||||||
|
CreateTime int64 `bson:"create_time" json:"createTime"` // this block's create time
|
||||||
|
MaxMsgUpdateTime int64 `bson:"max_msg_update_time" json:"maxMsgUpdateTime"` // index find msg
|
||||||
|
}
|
||||||
|
|
||||||
|
type KeyValue struct {
|
||||||
|
TypeKey string `bson:"type_key" json:"typeKey"`
|
||||||
|
Value string `bson:"value" json:"value"`
|
||||||
|
LatestUpdateTime int64 `bson:"latest_update_time" json:"latestUpdateTime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExtendMsg struct {
|
||||||
|
ReactionExtensionList map[string]KeyValue `bson:"reaction_extension_list" json:"reactionExtensionList"`
|
||||||
|
ClientMsgID string `bson:"client_msg_id" json:"clientMsgID"`
|
||||||
|
MsgFirstModifyTime int64 `bson:"msg_first_modify_time" json:"msgFirstModifyTime"` // this extendMsg create time
|
||||||
|
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||||
|
Ex string `bson:"ex" json:"ex"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ExtendMsgSet) TableName() string {
|
||||||
|
return CExtendMsgSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ExtendMsgSet) GetExtendMsgMaxNum() int32 {
|
||||||
|
return ExtendMsgMaxNum
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ExtendMsgSet) GetSourceID(ID string, index int32) string {
|
||||||
|
return ID + ":" + strconv.Itoa(int(index))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *ExtendMsgSet) SplitSourceIDAndGetIndex() int32 {
|
||||||
|
l := strings.Split(e.SourceID, ":")
|
||||||
|
index, _ := strconv.Atoi(l[len(l)-1])
|
||||||
|
return int32(index)
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package unrelation
|
||||||
|
|
||||||
|
const (
|
||||||
|
CSuperGroup = "super_group"
|
||||||
|
CUserToSuperGroup = "user_to_super_group"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SuperGroupModel struct {
|
||||||
|
GroupID string `bson:"group_id" json:"groupID"`
|
||||||
|
MemberIDs []string `bson:"member_id_list" json:"memberIDList"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (SuperGroupModel) TableName() string {
|
||||||
|
return CSuperGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserToSuperGroupModel struct {
|
||||||
|
UserID string `bson:"user_id" json:"userID"`
|
||||||
|
GroupIDs []string `bson:"group_id_list" json:"groupIDList"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UserToSuperGroupModel) TableName() string {
|
||||||
|
return CUserToSuperGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
type SuperGroupModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package unrelation
|
||||||
|
|
||||||
|
const (
|
||||||
|
CTag = "tag"
|
||||||
|
CSendLog = "send_log"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TagModel struct {
|
||||||
|
UserID string `bson:"user_id"`
|
||||||
|
TagID string `bson:"tag_id"`
|
||||||
|
TagName string `bson:"tag_name"`
|
||||||
|
UserList []string `bson:"user_list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (TagModel) TableName() string {
|
||||||
|
return CTag
|
||||||
|
}
|
||||||
|
|
||||||
|
type TagSendLogModel struct {
|
||||||
|
UserList []CommonUserModel `bson:"tag_list"`
|
||||||
|
SendID string `bson:"send_id"`
|
||||||
|
SenderPlatformID int32 `bson:"sender_platform_id"`
|
||||||
|
Content string `bson:"content"`
|
||||||
|
SendTime int64 `bson:"send_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (TagSendLogModel) TableName() string {
|
||||||
|
return CSendLog
|
||||||
|
}
|
||||||
|
|
||||||
|
type TagModelInterface interface {
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package unrelation
|
||||||
|
|
||||||
|
const (
|
||||||
|
CWorkMoment = "work_moment"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WorkMoment struct {
|
||||||
|
WorkMomentID string `bson:"work_moment_id"`
|
||||||
|
UserID string `bson:"user_id"`
|
||||||
|
UserName string `bson:"user_name"`
|
||||||
|
FaceURL string `bson:"face_url"`
|
||||||
|
Content string `bson:"content"`
|
||||||
|
LikeUserList []*CommonUserModel `bson:"like_user_list"`
|
||||||
|
AtUserList []*CommonUserModel `bson:"at_user_list"`
|
||||||
|
PermissionUserList []*CommonUserModel `bson:"permission_user_list"`
|
||||||
|
Comments []*CommonUserModel `bson:"comments"`
|
||||||
|
PermissionUserIDList []string `bson:"permission_user_id_list"`
|
||||||
|
Permission int32 `bson:"permission"`
|
||||||
|
CreateTime int32 `bson:"create_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Comment struct {
|
||||||
|
UserID string `bson:"user_id" json:"user_id"`
|
||||||
|
UserName string `bson:"user_name" json:"user_name"`
|
||||||
|
ReplyUserID string `bson:"reply_user_id" json:"reply_user_id"`
|
||||||
|
ReplyUserName string `bson:"reply_user_name" json:"reply_user_name"`
|
||||||
|
ContentID string `bson:"content_id" json:"content_id"`
|
||||||
|
Content string `bson:"content" json:"content"`
|
||||||
|
CreateTime int32 `bson:"create_time" json:"create_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (WorkMoment) TableName() string {
|
||||||
|
return CWorkMoment
|
||||||
|
}
|
Loading…
Reference in new issue