Merge remote-tracking branch 'origin/tuoyun' into tuoyun

# Conflicts:
#	pkg/proto/sdk_ws/ws.proto
This commit is contained in:
Gordon 2021-12-22 10:10:51 +08:00
commit 05c15a104f
25 changed files with 2235 additions and 953 deletions

View File

@ -173,13 +173,13 @@ messagecallback:
iOSPush: iOSPush:
pushSound: "xxx" pushSound: "xxx"
badgeCount: 1 badgeCount: true
notification: notification:
groupCreated: groupCreated:
conversation: conversation:
conversationChanged: 1 conversationChanged: true
unreadCount: 1 unreadCount: true
offlinePush: offlinePush:
switch: true switch: true
title: "create group title" title: "create group title"
@ -190,8 +190,8 @@ notification:
groupInfoChanged: groupInfoChanged:
conversation: conversation:
conversationChanged: 1 conversationChanged: true
unreadCount: 1 unreadCount: true
offlinePush: offlinePush:
switch: true switch: true
title: "group info changed title" title: "group info changed title"

View File

@ -27,6 +27,8 @@ type paramsGroupApplicationResponse struct {
Type int32 `json:"type"` Type int32 `json:"type"`
HandleStatus int32 `json:"handleStatus"` HandleStatus int32 `json:"handleStatus"`
HandleResult int32 `json:"handleResult"` HandleResult int32 `json:"handleResult"`
UserID string `json:"userID"`
} }
func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group.GroupApplicationResponseReq { func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group.GroupApplicationResponseReq {

View File

@ -10,9 +10,6 @@ import (
func (rpc *rpcAuth) UserRegister(_ context.Context, pb *pbAuth.UserRegisterReq) (*pbAuth.UserRegisterResp, error) { func (rpc *rpcAuth) UserRegister(_ context.Context, pb *pbAuth.UserRegisterReq) (*pbAuth.UserRegisterResp, error) {
log.Info("", "", "rpc user_register start, [data: %s]", pb.String()) log.Info("", "", "rpc user_register start, [data: %s]", pb.String())
//if len(pb.UID) == 0 {
// pb.UID = utils.GenID()
//}
if err := im_mysql_model.UserRegister(pb); err != nil { if err := im_mysql_model.UserRegister(pb); err != nil {
log.Error("", "", "rpc user_register error, [data: %s] [err: %s]", pb.String(), err.Error()) log.Error("", "", "rpc user_register error, [data: %s] [err: %s]", pb.String(), err.Error())
return &pbAuth.UserRegisterResp{Success: false}, err return &pbAuth.UserRegisterResp{Success: false}, err

View File

@ -6,7 +6,7 @@ import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db" "Open_IM/pkg/common/db"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model" immysql "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
http2 "Open_IM/pkg/common/http" http2 "Open_IM/pkg/common/http"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
@ -189,49 +189,7 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime) return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime)
default: default:
return returnMsg(&replay, pb, 203, "unkonwn sessionType", "", 0) return returnMsg(&replay, pb, 203, "unkonwn sessionType", "", 0)
} }
}
type WSToMsgSvrChatMsg struct {
SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"`
RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"`
Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"`
MsgFrom int32 `protobuf:"varint,5,opt,name=MsgFrom" json:"MsgFrom,omitempty"`
ContentType int32 `protobuf:"varint,8,opt,name=ContentType" json:"ContentType,omitempty"`
SessionType int32 `protobuf:"varint,9,opt,name=SessionType" json:"SessionType,omitempty"`
OperationID string `protobuf:"bytes,10,opt,name=OperationID" json:"OperationID,omitempty"`
}
func CreateGroupNotification(sendID string, creator im_mysql_model.User, group im_mysql_model.Group, memberList []im_mysql_model.GroupMember) {
var msg WSToMsgSvrChatMsg
msg.OperationID = utils.OperationIDGenerator()
msg.SendID = sendID
msg.RecvID = group.GroupId
msg.ContentType = constant.CreateGroupTip
msg.SessionType = constant.GroupChatType
msg.MsgFrom = constant.SysMsgType
var groupCreated open_im_sdk.GroupCreatedTips
groupCreated.Group = &open_im_sdk.GroupInfo{}
utils.CopyStructFields(groupCreated.Group, group)
groupCreated.Creator = &open_im_sdk.GroupMemberFullInfo{}
utils.CopyStructFields(groupCreated.Creator, creator)
for _, v := range memberList {
var groupMemberInfo open_im_sdk.GroupMemberFullInfo
utils.CopyStructFields(&groupMemberInfo, v)
groupCreated.MemberList = append(groupCreated.MemberList, &groupMemberInfo)
}
var tips open_im_sdk.TipsComm
tips.Detail = utils.StructToJsonString(groupCreated)
tips.DefaultTips = creator.Name + " " + config.Config.DefaultTips.GroupCreatedTips
msg.Content = utils.StructToJsonString(tips)
Notification(&msg, false)
}
func Notification(m *WSToMsgSvrChatMsg, onlineUserOnly bool) {
} }
func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error { func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error {
@ -245,6 +203,7 @@ func GetMsgID(sendID string) string {
t := time.Now().Format("2006-01-02 15:04:05") t := time.Now().Format("2006-01-02 15:04:05")
return t + "-" + sendID + "-" + strconv.Itoa(rand.Int()) return t + "-" + sendID + "-" + strconv.Itoa(rand.Int())
} }
func returnMsg(replay *pbChat.UserSendMsgResp, pb *pbChat.UserSendMsgReq, errCode int32, errMsg, serverMsgID string, sendTime int64) (*pbChat.UserSendMsgResp, error) { func returnMsg(replay *pbChat.UserSendMsgResp, pb *pbChat.UserSendMsgReq, errCode int32, errMsg, serverMsgID string, sendTime int64) (*pbChat.UserSendMsgResp, error) {
replay.ErrCode = errCode replay.ErrCode = errCode
replay.ErrMsg = errMsg replay.ErrMsg = errMsg
@ -254,6 +213,7 @@ func returnMsg(replay *pbChat.UserSendMsgResp, pb *pbChat.UserSendMsgReq, errCod
replay.SendTime = sendTime replay.SendTime = sendTime
return replay, nil return replay, nil
} }
func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, msg *pbChat.WSToMsgSvrChatMsg) bool { func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, msg *pbChat.WSToMsgSvrChatMsg) bool {
conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType)
opt, err := db.DB.GetSingleConversationMsgOpt(userID, conversationID) opt, err := db.DB.GetSingleConversationMsgOpt(userID, conversationID)
@ -278,3 +238,240 @@ func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType i
return true return true
} }
type NotificationMsg struct {
SendID string
RecvID string
Content []byte
MsgFrom int32
ContentType int32
SessionType int32
OperationID string
}
func Notification(n *NotificationMsg, onlineUserOnly bool) {
}
//message GroupCreatedTips{
// GroupInfo Group = 1;
// GroupMemberFullInfo Creator = 2;
// repeated GroupMemberFullInfo MemberList = 3;
// uint64 OperationTime = 4;
//}
func GroupCreatedNotification(operationID string, creator *immysql.User, group *immysql.Group, memberList []immysql.GroupMember) {
var n NotificationMsg
n.SendID = creator.UserID
n.RecvID = group.GroupID
n.ContentType = constant.CreateGroupTip
n.SessionType = constant.GroupChatType
n.MsgFrom = constant.SysMsgType
n.OperationID = operationID
var groupCreated open_im_sdk.GroupCreatedTips
groupCreated.Group = &open_im_sdk.GroupInfo{}
utils.CopyStructFields(groupCreated.Group, group)
groupCreated.Creator = &open_im_sdk.GroupMemberFullInfo{}
utils.CopyStructFields(groupCreated.Creator, creator)
for _, v := range memberList {
var groupMemberInfo open_im_sdk.GroupMemberFullInfo
utils.CopyStructFields(&groupMemberInfo, v)
groupCreated.MemberList = append(groupCreated.MemberList, &groupMemberInfo)
}
var tips open_im_sdk.TipsComm
tips.Detail, _ = json.Marshal(groupCreated)
tips.DefaultTips = config.Config.Notification.GroupCreated.DefaultTips.Tips
n.Content, _ = json.Marshal(tips)
Notification(&n, false)
}
//message ReceiveJoinApplicationTips{
// GroupInfo Group = 1;
// PublicUserInfo Applicant = 2;
// string Reason = 3;
//}
func ReceiveJoinApplicationNotification(operationID, RecvID string, applicant *immysql.User, group *immysql.Group) {
var n NotificationMsg
n.SendID = applicant.UserID
n.RecvID = RecvID
n.ContentType = constant.ApplyJoinGroupTip
n.SessionType = constant.SingleChatType
n.MsgFrom = constant.SysMsgType
n.OperationID = operationID
var joniGroup open_im_sdk.ReceiveJoinApplicationTips
joniGroup.Group = &open_im_sdk.GroupInfo{}
utils.CopyStructFields(joniGroup.Group, group)
joniGroup.Applicant = &open_im_sdk.PublicUserInfo{}
utils.CopyStructFields(joniGroup.Applicant, applicant)
var tips open_im_sdk.TipsComm
tips.Detail, _ = json.Marshal(joniGroup)
tips.DefaultTips = config.Config.Notification.ApplyJoinGroup.DefaultTips.Tips
n.Content, _ = json.Marshal(tips)
Notification(&n, false)
}
//message ApplicationProcessedTips{
// GroupInfo Group = 1;
// GroupMemberFullInfo OpUser = 2;
// int32 Result = 3;
// string Reason = 4;
//}
func ApplicationProcessedNotification(operationID, RecvID string, group immysql.Group, opUser immysql.GroupMember, result int32, Reason string) {
}
//message MemberInvitedTips{
// GroupInfo Group = 1;
// GroupMemberFullInfo OpUser = 2;
// GroupMemberFullInfo InvitedUser = 3;
// uint64 OperationTime = 4;
//}
func MemberInvitedNotification(operationID string, group immysql.Group, opUser immysql.GroupMember, invitedUser immysql.GroupMember) {
}
//message MemberKickedTips{
// GroupInfo Group = 1;
// GroupMemberFullInfo OpUser = 2;
// GroupMemberFullInfo KickedUser = 3;
// uint64 OperationTime = 4;
//}
func MemberKickedNotification(operationID string, group immysql.Group, opUser immysql.GroupMember, KickedUser immysql.GroupMember) {
}
//message GroupInfoChangedTips{
// int32 ChangedType = 1; //bitwise operators: 1:groupName; 10:Notification 100:Introduction; 1000:FaceUrl
// GroupInfo Group = 2;
// GroupMemberFullInfo OpUser = 3;
//}
func GroupInfoChangedNotification(operationID string, changedType int32, group *immysql.Group, opUser *immysql.GroupMember) {
var n NotificationMsg
n.SendID = opUser.UserID
n.RecvID = group.GroupID
n.ContentType = constant.ChangeGroupInfoTip
n.SessionType = constant.GroupChatType
n.MsgFrom = constant.SysMsgType
n.OperationID = operationID
var groupInfoChanged open_im_sdk.GroupInfoChangedTips
groupInfoChanged.Group = &open_im_sdk.GroupInfo{}
utils.CopyStructFields(groupInfoChanged.Group, group)
groupInfoChanged.OpUser = &open_im_sdk.GroupMemberFullInfo{}
utils.CopyStructFields(groupInfoChanged.OpUser, opUser)
groupInfoChanged.ChangedType = changedType
var tips open_im_sdk.TipsComm
tips.Detail, _ = json.Marshal(groupInfoChanged)
tips.DefaultTips = config.Config.Notification.GroupInfoChanged.DefaultTips.Tips
n.Content, _ = json.Marshal(tips)
Notification(&n, false)
}
//message MemberLeaveTips{
// GroupInfo Group = 1;
// GroupMemberFullInfo LeaverUser = 2;
// uint64 OperationTime = 3;
//}
func MemberLeaveNotification(operationID string, group *immysql.Group, leaverUser *immysql.GroupMember) {
}
//message MemberEnterTips{
// GroupInfo Group = 1;
// GroupMemberFullInfo EntrantUser = 2;
// uint64 OperationTime = 3;
//}
func MemberEnterNotification(operationID string, group *immysql.Group, entrantUser *immysql.GroupMember) {
}
//message MemberInfoChangedTips{
// int32 ChangeType = 1; //1:info changed; 2:mute
// GroupMemberFullInfo OpUser = 2; //who do this
// GroupMemberFullInfo FinalInfo = 3; //
// uint64 MuteTime = 4;
// GroupInfo Group = 5;
//}
func MemberInfoChangedNotification(operationID string, group *immysql.Group, opUser *immysql.GroupMember, userFinalInfo *immysql.GroupMember) {
}
//message FriendApplicationAddedTips{
// PublicUserInfo OpUser = 1; //user1
// FriendApplication Application = 2;
// PublicUserInfo OpedUser = 3; //user2
//}
func FriendApplicationAddedNotification(operationID string, opUser *immysql.User, opedUser *immysql.User, application *immysql.FriendRequest) {
}
//message FriendApplicationProcessedTips{
// PublicUserInfo OpUser = 1; //user2
// PublicUserInfo OpedUser = 2; //user1
// int32 result = 3; //1: accept; -1: reject
//}
func FriendApplicationProcessedNotification(operationID string, opUser *immysql.User, OpedUser *immysql.User, result int32) {
}
//message FriendAddedTips{
// FriendInfo Friend = 1;
//}
//message FriendInfo{
// UserInfo OwnerUser = 1;
// string Remark = 2;
// uint64 CreateTime = 3;
// UserInfo FriendUser = 4;
//}
func FriendAddedNotification(operationID string, opUser *immysql.User, friendUser *immysql.Friend) {
}
//message FriendDeletedTips{
// FriendInfo Friend = 1;
//}
func FriendDeletedNotification(operationID string, opUser *immysql.User, friendUser *immysql.Friend) {
}
//message FriendInfoChangedTips{
// FriendInfo Friend = 1;
// PublicUserInfo OpUser = 2;
// uint64 OperationTime = 3;
//}
func FriendInfoChangedNotification(operationID string, opUser *immysql.User, friendUser *immysql.Friend) {
}
//message BlackAddedTips{
// BlackInfo Black = 1;
//}
//message BlackInfo{
// PublicUserInfo OwnerUser = 1;
// string Remark = 2;
// uint64 CreateTime = 3;
// PublicUserInfo BlackUser = 4;
//}
func BlackAddedNotification(operationID string, opUser *immysql.User, blackUser *immysql.User) {
}
//message BlackDeletedTips{
// BlackInfo Black = 1;
//}
func BlackDeletedNotification(operationID string, opUser *immysql.User, blackUser *immysql.User) {
}
//message SelfInfoUpdatedTips{
// UserInfo SelfUserInfo = 1;
// PublicUserInfo OpUser = 2;
// uint64 OperationTime = 3;
//}
func SelfInfoUpdatedNotification(operationID string, opUser *immysql.User, selfUser *immysql.User) {
}

View File

@ -1,8 +1,7 @@
package group package group
import ( import (
"Open_IM/internal/push/content_struct" "Open_IM/internal/rpc/chat"
"Open_IM/internal/push/logic"
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db" "Open_IM/pkg/common/db"
@ -10,7 +9,6 @@ import (
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify" "Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbChat "Open_IM/pkg/proto/chat"
pbGroup "Open_IM/pkg/proto/group" pbGroup "Open_IM/pkg/proto/group"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
@ -69,39 +67,40 @@ func (s *groupServer) Run() {
} }
func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) { func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) {
log.InfoByArgs("rpc create group is server,args=%s", req.String()) log.NewInfo(req.OperationID, "CreateGroup, args=%s", req.String())
var ( var (
groupId string groupId string
) )
//Parse token, to find current user information //Parse token, to find current user information
claims, err := token_verify.ParseToken(req.Token) claims, err := token_verify.ParseToken(req.Token)
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) log.NewError(req.OperationID, "ParseToken failed, ", err.Error(), req.String())
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
} }
//Time stamp + MD5 to generate group chat id //Time stamp + MD5 to generate group chat id
groupId = utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10)) groupId = utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10))
err = im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ex) err = im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ex)
if err != nil { if err != nil {
log.ErrorByKv("create group chat failed", req.OperationID, "err=%s", err.Error()) log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), req.String())
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
} }
isMagagerFlag := 0 isManagerFlag := 0
tokenUid := claims.UID tokenUid := claims.UID
if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) { if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) {
isMagagerFlag = 1 isManagerFlag = 1
} }
if isMagagerFlag == 0 {
//Add the group owner to the group first, otherwise the group creation will fail
us, err := im_mysql_model.FindUserByUID(claims.UID) us, err := im_mysql_model.FindUserByUID(claims.UID)
if err != nil { if err != nil {
log.Error("", req.OperationID, "find userInfo failed", err.Error()) log.Error("", req.OperationID, "find userInfo failed", err.Error())
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
} }
err = im_mysql_model.InsertIntoGroupMember(groupId, claims.UID, us.Name, us.Icon, constant.GroupOwner)
if isManagerFlag == 0 {
//Add the group owner to the group first, otherwise the group creation will fail
err = im_mysql_model.InsertIntoGroupMember(groupId, claims.UID, us.Nickname, us.FaceUrl, constant.GroupOwner)
if err != nil { if err != nil {
log.Error("", req.OperationID, "create group chat failed,err=%s", err.Error()) log.Error("", req.OperationID, "create group chat failed,err=%s", err.Error())
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
@ -109,7 +108,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
err = db.DB.AddGroupMember(groupId, claims.UID) err = db.DB.AddGroupMember(groupId, claims.UID)
if err != nil { if err != nil {
log.Error("", "", "create mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error()) log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), groupId, claims.UID)
return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil
} }
} }
@ -118,12 +117,12 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
for _, user := range req.MemberList { for _, user := range req.MemberList {
us, err := im_mysql_model.FindUserByUID(user.Uid) us, err := im_mysql_model.FindUserByUID(user.Uid)
if err != nil { if err != nil {
log.Error("", req.OperationID, "find userInfo failed,uid=%s", user.Uid, err.Error()) log.NewError(req.OperationID, "FindUserByUID failed ", err.Error(), user.Uid)
continue continue
} }
err = im_mysql_model.InsertIntoGroupMember(groupId, user.Uid, us.Name, us.Icon, user.SetRole) err = im_mysql_model.InsertIntoGroupMember(groupId, user.Uid, us.Nickname, us.FaceUrl, user.SetRole)
if err != nil { if err != nil {
log.ErrorByArgs("pull %s to group %s failed,err=%s", user.Uid, groupId, err.Error()) log.ErrorByArgs("InsertIntoGroupMember failed", user.Uid, groupId, err.Error())
} }
err = db.DB.AddGroupMember(groupId, user.Uid) err = db.DB.AddGroupMember(groupId, user.Uid)
if err != nil { if err != nil {
@ -131,32 +130,21 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
} }
} }
if isMagagerFlag == 1 { if isManagerFlag == 1 {
//type NotificationContent struct {
// IsDisplay int32 `json:"isDisplay"`
// DefaultTips string `json:"defaultTips"`
// Detail string `json:"detail"`
//} n := NotificationContent{
// IsDisplay: 1,
// DefaultTips: "You have joined the group chat:" + createGroupResp.Data.GroupName,
// Detail: createGroupResp.Data.GroupId,
// }
////Push message when create group chat
n := content_struct.NotificationContent{1, req.GroupName, groupId}
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: groupId,
Content: n.ContentToString(),
SendTime: utils.GetCurrentTimestampByNano(),
MsgFrom: constant.SysMsgType, //Notification message identification
ContentType: constant.CreateGroupTip, //Add friend flag
SessionType: constant.GroupChatType,
OperationID: req.OperationID,
})
} }
group, err := im_mysql_model.FindGroupInfoByGroupId(groupId)
if err != nil {
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", err.Error(), groupId)
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
}
memberList, err := im_mysql_model.FindGroupMemberListByGroupId(groupId)
if err != nil {
log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed ", err.Error(), groupId)
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
}
chat.GroupCreatedNotification(req.OperationID, us, group, memberList)
log.NewInfo(req.OperationID, "GroupCreatedNotification, rpc CreateGroup success return ", groupId)
log.Info(req.Token, req.OperationID, "rpc create group success return")
return &pbGroup.CreateGroupResp{GroupID: groupId}, nil return &pbGroup.CreateGroupResp{GroupID: groupId}, nil
} }

View File

@ -384,9 +384,9 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG
} }
user, err := imdb.FindUserByUID(v) user, err := imdb.FindUserByUID(v)
if err == nil && user != nil { if err == nil && user != nil {
memberNode.FaceUrl = user.Icon memberNode.FaceUrl = user.FaceUrl
memberNode.JoinTime = uint64(memberInfo.JoinTime.Unix()) memberNode.JoinTime = uint64(memberInfo.JoinTime.Unix())
memberNode.UserId = user.UID memberNode.UserId = user.UserID
memberNode.NickName = memberInfo.NickName memberNode.NickName = memberInfo.NickName
memberNode.Role = memberInfo.AdministratorLevel memberNode.Role = memberInfo.AdministratorLevel
} }

View File

@ -1,6 +1,7 @@
package group package group
import ( import (
"Open_IM/internal/rpc/chat"
"Open_IM/pkg/common/db" "Open_IM/pkg/common/db"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
@ -9,12 +10,11 @@ import (
) )
func (s *groupServer) GroupApplicationResponse(_ context.Context, pb *group.GroupApplicationResponseReq) (*group.GroupApplicationResponseResp, error) { func (s *groupServer) GroupApplicationResponse(_ context.Context, pb *group.GroupApplicationResponseReq) (*group.GroupApplicationResponseResp, error) {
log.Info("", "", "rpc GroupApplicationResponse call start..., [pb: %s]", pb.String()) log.NewInfo(pb.OperationID, "GroupApplicationResponse args: ", pb.String())
reply, err := im_mysql_model.GroupApplicationResponse(pb) reply, err := im_mysql_model.GroupApplicationResponse(pb)
if err != nil { if err != nil {
log.Error("", "", "rpc GroupApplicationResponse call..., im_mysql_model.GroupApplicationResponse fail [pb: %s] [err: %s]", pb.String(), err.Error()) log.NewError(pb.OperationID, "GroupApplicationResponse failed ", err.Error(), pb)
return &group.GroupApplicationResponseResp{ErrCode: 702, ErrMsg: "rpc GroupApplicationResponse failed"}, nil return &group.GroupApplicationResponseResp{ErrCode: 702, ErrMsg: err.Error()}, nil
} }
if pb.HandleResult == 1 { if pb.HandleResult == 1 {
@ -32,8 +32,15 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, pb *group.Grou
} }
} }
} }
if pb.ToUserID == "0" {
chat.ApplicationProcessedNotification(pb.OperationID, pb.FromUserID)
}
log.Info("", "", "rpc GroupApplicationResponse call..., im_mysql_model.GroupApplicationResponse") if pb.HandleResult == 1 {
}
log.NewInfo(pb.OperationID, "rpc GroupApplicationResponse ok ", reply)
return reply, nil return reply, nil
} }

View File

@ -1,6 +1,7 @@
package group package group
import ( import (
"Open_IM/internal/rpc/chat"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
@ -10,16 +11,16 @@ import (
) )
func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.CommonResp, error) { func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.CommonResp, error) {
log.Info(req.Token, req.OperationID, "rpc join group is server,args=%s", req.String()) log.NewInfo(req.Token, req.OperationID, "JoinGroup args ", req.String())
//Parse token, to find current user information //Parse token, to find current user information
claims, err := token_verify.ParseToken(req.Token) claims, err := token_verify.ParseToken(req.Token)
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) log.NewError(req.OperationID, "ParseToken failed", err.Error(), req.String())
return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
} }
applicationUserInfo, err := im_mysql_model.FindUserByUID(claims.UID) applicationUserInfo, err := im_mysql_model.FindUserByUID(claims.UID)
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "No this user,err=%s", err.Error()) log.NewError(req.OperationID, "FindUserByUID failed", err.Error(), claims.UID)
return &pbGroup.CommonResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil return &pbGroup.CommonResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil
} }
@ -28,30 +29,23 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq)
err = im_mysql_model.DelGroupRequest(req.GroupID, claims.UID, "0") err = im_mysql_model.DelGroupRequest(req.GroupID, claims.UID, "0")
} }
log.Info(req.Token, req.OperationID, "args: ", req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Name, applicationUserInfo.Icon) if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Nickname, applicationUserInfo.FaceUrl); err != nil {
if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Name, applicationUserInfo.Icon); err != nil {
log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error()) log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error())
return &pbGroup.CommonResp{ErrorCode: constant.ErrJoinGroupApplication.ErrCode, ErrorMsg: constant.ErrJoinGroupApplication.ErrMsg}, nil return &pbGroup.CommonResp{ErrorCode: constant.ErrJoinGroupApplication.ErrCode, ErrorMsg: constant.ErrJoinGroupApplication.ErrMsg}, nil
} }
////Find the the group owner
//groupCreatorInfo, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupCreator)
//if err != nil {
// log.Error(req.Token, req.OperationID, "find group creator failed", err.Error())
//} else {
// //Push message when join group chat
// logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
// SendID: claims.UID,
// RecvID: groupCreatorInfo[0].Uid,
// Content: content_struct.NewContentStructString(0, "", req.String()),
// SendTime: utils.GetCurrentTimestampBySecond(),
// MsgFrom: constant.SysMsgType,
// ContentType: constant.JoinGroupTip,
// SessionType: constant.SingleChatType,
// OperationID: req.OperationID,
// })
//}
log.Info(req.Token, req.OperationID, "rpc join group success return") memberList, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupOwner)
return &pbGroup.CommonResp{}, nil if len(memberList) == 0 {
log.NewError(req.OperationID, "FindGroupMemberListByGroupIdAndFilterInfo failed ", req.GroupID, constant.GroupOwner, err)
return &pbGroup.CommonResp{ErrorCode: 0, ErrorMsg: ""}, nil
}
group, err := im_mysql_model.FindGroupInfoByGroupId(req.GroupID)
if err != nil {
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", req.GroupID)
return &pbGroup.CommonResp{ErrorCode: 0, ErrorMsg: ""}, nil
}
chat.ReceiveJoinApplicationNotification(req.OperationID, memberList[0].UserID, applicationUserInfo, group)
log.NewInfo(req.OperationID, "ReceiveJoinApplicationNotification rpc JoinGroup success return")
return &pbGroup.CommonResp{ErrorCode: 0, ErrorMsg: ""}, nil
} }

View File

@ -1,6 +1,7 @@
package group package group
import ( import (
"Open_IM/internal/rpc/chat"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
@ -18,6 +19,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil
} }
groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID) groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID)
if err != nil { if err != nil {
log.Error("", req.OperationID, "your are not in the group,can not change this group info,err=%s", err.Error()) log.Error("", req.OperationID, "your are not in the group,can not change this group info,err=%s", err.Error())
@ -26,21 +28,33 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
if groupUserInfo.AdministratorLevel == constant.OrdinaryMember { if groupUserInfo.AdministratorLevel == constant.OrdinaryMember {
return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil
} }
group, err := im_mysql_model.FindGroupInfoByGroupId(req.GroupID)
if err != nil {
log.NewError(req.OperationID, "FindGroupInfoByGroupId failed, ", err.Error(), req.GroupID)
return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil
}
////bitwise operators: 1:groupName; 10:Notification 100:Introduction; 1000:FaceUrl
var changedType int32
if group.GroupName != req.GroupName && req.GroupName != "" {
changedType = 1
}
if group.Notification != req.Notification && req.Notification != "" {
changedType = changedType | (1 << 1)
}
if group.Introduction != req.Introduction && req.Introduction != "" {
changedType = changedType | (1 << 2)
}
if group.FaceUrl != req.FaceUrl && req.FaceUrl != "" {
changedType = changedType | (1 << 3)
}
//only administrators can set group information //only administrators can set group information
if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil { if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil {
return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrSetGroupInfo.ErrMsg}, nil return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrSetGroupInfo.ErrMsg}, nil
} }
////Push message when set group info
//jsonInfo, _ := json.Marshal(req) if changedType != 0 {
//logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ chat.GroupInfoChangedNotification(req.OperationID, claims.UID, changedType, group, groupUserInfo)
// SendID: claims.UID, }
// RecvID: req.GroupID,
// Content: string(jsonInfo),
// SendTime: utils.GetCurrentTimestampBySecond(),
// MsgFrom: constant.SysMsgType,
// ContentType: constant.SetGroupInfoTip,
// SessionType: constant.GroupChatType,
// OperationID: req.OperationID,
//})
return &pbGroup.CommonResp{}, nil return &pbGroup.CommonResp{}, nil
} }

View File

@ -1,6 +1,7 @@
package config package config
import ( import (
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
@ -158,6 +159,59 @@ type config struct {
CallbackUrl string `yaml:"callbackUrl"` CallbackUrl string `yaml:"callbackUrl"`
CallBackTimeOut int `yaml:"callbackTimeOut"` CallBackTimeOut int `yaml:"callbackTimeOut"`
} }
IOSPush struct {
PushSound string `yaml:"pushSound"`
BadgeCount bool `yaml:"badgeCount"`
}
Notification struct {
GroupCreated struct {
Conversation struct {
ConversationChanged bool `yaml:"conversationChanged"`
UnreadCount bool `yaml:"unreadCount"`
}
OfflinePush struct {
PushSwitch bool `yaml:"switch"`
Title string `yaml:"title"`
Desc string `yaml:"desc"`
Ext string `yaml:"ext"`
}
DefaultTips struct {
Tips string `yaml:"tips"`
}
}
GroupInfoChanged struct {
Conversation struct {
ConversationChanged bool `yaml:"conversationChanged"`
UnreadCount bool `yaml:"unreadCount"`
}
OfflinePush struct {
PushSwitch bool `yaml:"switch"`
Title string `yaml:"title"`
Desc string `yaml:"desc"`
Ext string `yaml:"ext"`
}
DefaultTips struct {
Tips string `yaml:"tips"`
}
}
ApplyJoinGroup struct {
Conversation struct {
ConversationChanged bool `yaml:"conversationChanged"`
UnreadCount bool `yaml:"unreadCount"`
}
OfflinePush struct {
PushSwitch bool `yaml:"switch"`
Title string `yaml:"title"`
Desc string `yaml:"desc"`
Ext string `yaml:"ext"`
}
DefaultTips struct {
Tips string `yaml:"tips"`
}
}
}
Demo struct { Demo struct {
Port []int `yaml:"openImDemoPort"` Port []int `yaml:"openImDemoPort"`
AliSMSVerify struct { AliSMSVerify struct {
@ -200,5 +254,5 @@ func init() {
if err = yaml.Unmarshal(bytes, &Config); err != nil { if err = yaml.Unmarshal(bytes, &Config); err != nil {
panic(err.Error()) panic(err.Error())
} }
fmt.Println("load config: ", Config)
} }

View File

@ -54,13 +54,14 @@ const (
TransferGroupOwnerTip = 501 TransferGroupOwnerTip = 501
CreateGroupTip = 502 CreateGroupTip = 502
GroupApplicationResponseTip = 503 GroupApplicationResponseTip = 503
JoinGroupTip = 504 ApplyJoinGroupTip = 504
QuitGroupTip = 505 QuitGroupTip = 505
SetGroupInfoTip = 506 SetGroupInfoTip = 506
AcceptGroupApplicationTip = 507 AcceptGroupApplicationTip = 507
RefuseGroupApplicationTip = 508 RefuseGroupApplicationTip = 508
KickGroupMemberTip = 509 KickGroupMemberTip = 509
InviteUserToGroupTip = 510 InviteUserToGroupTip = 510
ChangeGroupInfoTip = 511
//MsgFrom //MsgFrom
UserMsgType = 100 UserMsgType = 100

View File

@ -12,8 +12,8 @@ func InsertToFriend(ownerId, friendId string, flag int32) error {
return err return err
} }
toInsertFollow := Friend{ toInsertFollow := Friend{
OwnerId: ownerId, OwnerUserID: ownerId,
FriendId: friendId, FriendUserID: friendId,
FriendFlag: flag, FriendFlag: flag,
CreateTime: time.Now(), CreateTime: time.Now(),
} }

View File

@ -10,7 +10,7 @@ func InsertIntoGroupMember(groupId, uid, nickName, userGroupFaceUrl string, admi
if err != nil { if err != nil {
return err return err
} }
toInsertInfo := GroupMember{GroupId: groupId, Uid: uid, NickName: nickName, AdministratorLevel: administratorLevel, JoinTime: time.Now(), UserGroupFaceUrl: userGroupFaceUrl} toInsertInfo := GroupMember{GroupID: groupId, UserID: uid, NickName: nickName, AdministratorLevel: administratorLevel, JoinTime: time.Now(), FaceUrl: userGroupFaceUrl}
err = dbConn.Table("group_member").Create(toInsertInfo).Error err = dbConn.Table("group_member").Create(toInsertInfo).Error
if err != nil { if err != nil {
return err return err
@ -206,7 +206,7 @@ func GetGroupOwnerByGroupId(groupId string) string {
} }
for _, v := range omList { for _, v := range omList {
if v.AdministratorLevel == 1 { if v.AdministratorLevel == 1 {
return v.Uid return v.UserID
} }
} }
return "" return ""

View File

@ -17,7 +17,7 @@ func InsertIntoGroup(groupId, name, introduction, notification, faceUrl, ex stri
if name == "" { if name == "" {
name = "groupChat" name = "groupChat"
} }
toInsertInfo := Group{GroupId: groupId, Name: name, Introduction: introduction, Notification: notification, FaceUrl: faceUrl, CreateTime: time.Now(), Ex: ex} toInsertInfo := Group{GroupID: groupId, GroupName: name, Introduction: introduction, Notification: notification, FaceUrl: faceUrl, CreateTime: time.Now(), Ex: ex}
err = dbConn.Table("group").Create(toInsertInfo).Error err = dbConn.Table("group").Create(toInsertInfo).Error
if err != nil { if err != nil {
return err return err
@ -174,7 +174,7 @@ func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.TransferGroupOw
return nil, err return nil, err
} }
if oldOwner.Uid == newOwner.Uid { if oldOwner.UserID == newOwner.UserID {
return nil, errors.New("the self") return nil, errors.New("the self")
} }
@ -248,55 +248,5 @@ func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.Gro
} }
} }
//if err != nil {
// err = dbConn.Raw("select * from `group_request` where handled_user = ? and group_id = ? and to_user_id = ? and from_user_id = ?", "", pb.GroupID, "0", pb.UID).Scan(&groupRequest).Error
// if err != nil {
// return nil, err
// }
// if pb.Flag == 1 {
// err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ? and from_user_id = ?",
// pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, "0", pb.UID).Error
// if err != nil {
// return nil, err
// }
//
// // add to group member
// err = InsertIntoGroupMember(pb.GroupID, pb.UID, groupRequest.FromUserNickname, groupRequest.FromUserFaceUrl, 0)
// if err != nil {
// return nil, err
// }
// } else if pb.Flag == -1 {
// err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ? and from_user_id = ?",
// pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, "0", pb.UID).Error
// if err != nil {
// return nil, err
// }
// } else {
// return nil, errors.New("flag error")
// }
//} else {
// if pb.Flag == 1 {
// err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ?",
// pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, pb.UID).Error
// if err != nil {
// return nil, err
// }
//
// // add to group member
// err = InsertIntoGroupMember(pb.GroupID, pb.UID, groupRequest.ToUserNickname, groupRequest.ToUserFaceUrl, 0)
// if err != nil {
// return nil, err
// }
// } else if pb.Flag == -1 {
// err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ?",
// pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, pb.UID).Error
// if err != nil {
// return nil, err
// }
// } else {
// return nil, errors.New("flag error")
// }
//}
return &group.GroupApplicationResponseResp{}, nil return &group.GroupApplicationResponseResp{}, nil
} }

View File

@ -3,9 +3,9 @@ package im_mysql_model
import "time" import "time"
type User struct { type User struct {
UID string `gorm:"column:uid;primaryKey;"` UserID string `gorm:"column:uid;primaryKey;"`
Name string `gorm:"column:name"` Nickname string `gorm:"column:name"`
Icon string `gorm:"column:icon"` FaceUrl string `gorm:"column:icon"`
Gender int32 `gorm:"column:gender"` Gender int32 `gorm:"column:gender"`
Mobile string `gorm:"column:mobile"` Mobile string `gorm:"column:mobile"`
Birth string `gorm:"column:birth"` Birth string `gorm:"column:birth"`
@ -15,28 +15,28 @@ type User struct {
} }
type Friend struct { type Friend struct {
OwnerId string `gorm:"column:owner_id"` OwnerUserID string `gorm:"column:owner_id"`
FriendId string `gorm:"column:friend_id"` FriendUserID string `gorm:"column:friend_id"`
Comment string `gorm:"column:comment"` Remark string `gorm:"column:comment"`
FriendFlag int32 `gorm:"column:friend_flag"` FriendFlag int32 `gorm:"column:friend_flag"`
CreateTime time.Time `gorm:"column:create_time"` CreateTime time.Time `gorm:"column:create_time"`
} }
type FriendRequest struct { type FriendRequest struct {
ReqId string `gorm:"column:req_id"` ReqID string `gorm:"column:req_id"`
Uid string `gorm:"column:user_id"` UserID string `gorm:"column:user_id"`
Flag int32 `gorm:"column:flag"` Flag int32 `gorm:"column:flag"`
ReqMessage string `gorm:"column:req_message"` ReqMessage string `gorm:"column:req_message"`
CreateTime time.Time `gorm:"column:create_time"` CreateTime time.Time `gorm:"column:create_time"`
} }
type BlackList struct { type BlackList struct {
OwnerId string `gorm:"column:owner_id"` OwnerUserID string `gorm:"column:owner_id"`
BlockId string `gorm:"column:block_id"` BlockUserID string `gorm:"column:block_id"`
CreateTime time.Time `gorm:"column:create_time"` CreateTime time.Time `gorm:"column:create_time"`
} }
type Group struct { type Group struct {
GroupId string `gorm:"column:group_id"` GroupID string `gorm:"column:group_id"`
Name string `gorm:"column:name"` GroupName string `gorm:"column:name"`
Introduction string `gorm:"column:introduction"` Introduction string `gorm:"column:introduction"`
Notification string `gorm:"column:notification"` Notification string `gorm:"column:notification"`
FaceUrl string `gorm:"column:face_url"` FaceUrl string `gorm:"column:face_url"`
@ -45,12 +45,12 @@ type Group struct {
} }
type GroupMember struct { type GroupMember struct {
GroupId string `gorm:"column:group_id"` GroupID string `gorm:"column:group_id"`
Uid string `gorm:"column:uid"` UserID string `gorm:"column:uid"`
NickName string `gorm:"column:nickname"` NickName string `gorm:"column:nickname"`
AdministratorLevel int32 `gorm:"column:administrator_level"` AdministratorLevel int32 `gorm:"column:administrator_level"`
JoinTime time.Time `gorm:"column:join_time"` JoinTime time.Time `gorm:"column:join_time"`
UserGroupFaceUrl string `gorm:"user_group_face_url"` FaceUrl string `gorm:"user_group_face_url"`
} }
type GroupRequest struct { type GroupRequest struct {

View File

@ -10,7 +10,7 @@ func InsertInToUserBlackList(ownerID, blockID string) error {
if err != nil { if err != nil {
return err return err
} }
toInsertInfo := BlackList{OwnerId: ownerID, BlockId: blockID, CreateTime: time.Now()} toInsertInfo := BlackList{OwnerUserID: ownerID, BlockUserID: blockID, CreateTime: time.Now()}
err = dbConn.Table("user_black_list").Create(toInsertInfo).Error err = dbConn.Table("user_black_list").Create(toInsertInfo).Error
return err return err
} }

View File

@ -30,9 +30,9 @@ func UserRegister(pb *pbAuth.UserRegisterReq) error {
return err return err
} }
addUser := User{ addUser := User{
UID: pb.UID, UserID: pb.UID,
Name: pb.Name, Nickname: pb.Name,
Icon: pb.Icon, FaceUrl: pb.Icon,
Gender: pb.Gender, Gender: pb.Gender,
Mobile: pb.Mobile, Mobile: pb.Mobile,
Birth: pb.Birth, Birth: pb.Birth,

View File

@ -17,20 +17,3 @@ type Receive struct {
MsgId string MsgId string
CreateTime *time.Time CreateTime *time.Time
} }
//func InsertMessageToReceive(seq int64, userid, msgid string) error {
// conn := db.NewDbConnection()
// receive := Receive{
// UID: userid,
// Seq: seq,
// MsgId: msgid,
// }
// err := conn.Table("receive").Create(&receive).Error
// return err
//}
//func GetBiggestSeqFromReceive(userid string) (seq int64, err error) {
// //得到数据库的连接并非真连接调用时才连接由gorm自动维护数据库连接池
// conn := db.NewDbConnection()
// err = conn.Raw("select max(seq) from receive where user_id = ?", userid).Row().Scan(&seq)
// return seq, err
//}

View File

@ -1,16 +1,12 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: chat/chat.proto // source: chat.proto
package pbChat // import "./chat" package pbChat
import proto "github.com/golang/protobuf/proto" import proto "github.com/golang/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import sdk_ws "Open_IM/pkg/proto/sdk_ws"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal var _ = proto.Marshal
@ -50,7 +46,7 @@ func (m *WSToMsgSvrChatMsg) Reset() { *m = WSToMsgSvrChatMsg{} }
func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) } func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) }
func (*WSToMsgSvrChatMsg) ProtoMessage() {} func (*WSToMsgSvrChatMsg) ProtoMessage() {}
func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) { func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{0} return fileDescriptor_chat_955d1f0dcca586dd, []int{0}
} }
func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error { func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b) return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b)
@ -215,7 +211,7 @@ func (m *MsgSvrToPushSvrChatMsg) Reset() { *m = MsgSvrToPushSvrChatMsg{}
func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) } func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) }
func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {} func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {}
func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) { func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{1} return fileDescriptor_chat_955d1f0dcca586dd, []int{1}
} }
func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error { func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b) return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b)
@ -361,7 +357,7 @@ func (m *PullMessageReq) Reset() { *m = PullMessageReq{} }
func (m *PullMessageReq) String() string { return proto.CompactTextString(m) } func (m *PullMessageReq) String() string { return proto.CompactTextString(m) }
func (*PullMessageReq) ProtoMessage() {} func (*PullMessageReq) ProtoMessage() {}
func (*PullMessageReq) Descriptor() ([]byte, []int) { func (*PullMessageReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{2} return fileDescriptor_chat_955d1f0dcca586dd, []int{2}
} }
func (m *PullMessageReq) XXX_Unmarshal(b []byte) error { func (m *PullMessageReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageReq.Unmarshal(m, b) return xxx_messageInfo_PullMessageReq.Unmarshal(m, b)
@ -425,7 +421,7 @@ func (m *PullMessageResp) Reset() { *m = PullMessageResp{} }
func (m *PullMessageResp) String() string { return proto.CompactTextString(m) } func (m *PullMessageResp) String() string { return proto.CompactTextString(m) }
func (*PullMessageResp) ProtoMessage() {} func (*PullMessageResp) ProtoMessage() {}
func (*PullMessageResp) Descriptor() ([]byte, []int) { func (*PullMessageResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{3} return fileDescriptor_chat_955d1f0dcca586dd, []int{3}
} }
func (m *PullMessageResp) XXX_Unmarshal(b []byte) error { func (m *PullMessageResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageResp.Unmarshal(m, b) return xxx_messageInfo_PullMessageResp.Unmarshal(m, b)
@ -500,7 +496,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq
func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) }
func (*PullMessageBySeqListReq) ProtoMessage() {} func (*PullMessageBySeqListReq) ProtoMessage() {}
func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{4} return fileDescriptor_chat_955d1f0dcca586dd, []int{4}
} }
func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b)
@ -553,7 +549,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) ProtoMessage() {}
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{5} return fileDescriptor_chat_955d1f0dcca586dd, []int{5}
} }
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
@ -601,7 +597,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) ProtoMessage() {}
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{6} return fileDescriptor_chat_955d1f0dcca586dd, []int{6}
} }
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
@ -651,9 +647,9 @@ func (m *GetMaxAndMinSeqResp) GetMinSeq() int64 {
type GatherFormat struct { type GatherFormat struct {
// @inject_tag: json:"id" // @inject_tag: json:"id"
ID string `protobuf:"bytes,1,opt,name=ID" json:"id"` ID string `protobuf:"bytes,1,opt,name=ID" json:"ID,omitempty"`
// @inject_tag: json:"list" // @inject_tag: json:"list"
List []*MsgFormat `protobuf:"bytes,2,rep,name=List" json:"list"` List []*MsgFormat `protobuf:"bytes,2,rep,name=List" json:"List,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -663,7 +659,7 @@ func (m *GatherFormat) Reset() { *m = GatherFormat{} }
func (m *GatherFormat) String() string { return proto.CompactTextString(m) } func (m *GatherFormat) String() string { return proto.CompactTextString(m) }
func (*GatherFormat) ProtoMessage() {} func (*GatherFormat) ProtoMessage() {}
func (*GatherFormat) Descriptor() ([]byte, []int) { func (*GatherFormat) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{7} return fileDescriptor_chat_955d1f0dcca586dd, []int{7}
} }
func (m *GatherFormat) XXX_Unmarshal(b []byte) error { func (m *GatherFormat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GatherFormat.Unmarshal(m, b) return xxx_messageInfo_GatherFormat.Unmarshal(m, b)
@ -699,29 +695,29 @@ func (m *GatherFormat) GetList() []*MsgFormat {
type MsgFormat struct { type MsgFormat struct {
// @inject_tag: json:"sendID" // @inject_tag: json:"sendID"
SendID string `protobuf:"bytes,1,opt,name=SendID" json:"sendID"` SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"`
// @inject_tag: json:"recvID" // @inject_tag: json:"recvID"
RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"recvID"` RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"`
// @inject_tag: json:"msgFrom" // @inject_tag: json:"msgFrom"
MsgFrom int32 `protobuf:"varint,3,opt,name=MsgFrom" json:"msgFrom"` MsgFrom int32 `protobuf:"varint,3,opt,name=MsgFrom" json:"MsgFrom,omitempty"`
// @inject_tag: json:"contentType" // @inject_tag: json:"contentType"
ContentType int32 `protobuf:"varint,4,opt,name=ContentType" json:"contentType"` ContentType int32 `protobuf:"varint,4,opt,name=ContentType" json:"ContentType,omitempty"`
// @inject_tag: json:"serverMsgID" // @inject_tag: json:"serverMsgID"
ServerMsgID string `protobuf:"bytes,5,opt,name=ServerMsgID" json:"serverMsgID"` ServerMsgID string `protobuf:"bytes,5,opt,name=ServerMsgID" json:"ServerMsgID,omitempty"`
// @inject_tag: json:"content" // @inject_tag: json:"content"
Content string `protobuf:"bytes,6,opt,name=Content" json:"content"` Content string `protobuf:"bytes,6,opt,name=Content" json:"Content,omitempty"`
// @inject_tag: json:"seq" // @inject_tag: json:"seq"
Seq int64 `protobuf:"varint,7,opt,name=Seq" json:"seq"` Seq int64 `protobuf:"varint,7,opt,name=Seq" json:"Seq,omitempty"`
// @inject_tag: json:"sendTime" // @inject_tag: json:"sendTime"
SendTime int64 `protobuf:"varint,8,opt,name=SendTime" json:"sendTime"` SendTime int64 `protobuf:"varint,8,opt,name=SendTime" json:"SendTime,omitempty"`
// @inject_tag: json:"senderPlatformID" // @inject_tag: json:"senderPlatformID"
SenderPlatformID int32 `protobuf:"varint,9,opt,name=SenderPlatformID" json:"senderPlatformID"` SenderPlatformID int32 `protobuf:"varint,9,opt,name=SenderPlatformID" json:"SenderPlatformID,omitempty"`
// @inject_tag: json:"senderNickName" // @inject_tag: json:"senderNickName"
SenderNickName string `protobuf:"bytes,10,opt,name=SenderNickName" json:"senderNickName"` SenderNickName string `protobuf:"bytes,10,opt,name=SenderNickName" json:"SenderNickName,omitempty"`
// @inject_tag: json:"senderFaceUrl" // @inject_tag: json:"senderFaceUrl"
SenderFaceURL string `protobuf:"bytes,11,opt,name=SenderFaceURL" json:"senderFaceUrl"` SenderFaceURL string `protobuf:"bytes,11,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"`
// @inject_tag: json:"clientMsgID" // @inject_tag: json:"clientMsgID"
ClientMsgID string `protobuf:"bytes,12,opt,name=ClientMsgID" json:"clientMsgID"` ClientMsgID string `protobuf:"bytes,12,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -731,7 +727,7 @@ func (m *MsgFormat) Reset() { *m = MsgFormat{} }
func (m *MsgFormat) String() string { return proto.CompactTextString(m) } func (m *MsgFormat) String() string { return proto.CompactTextString(m) }
func (*MsgFormat) ProtoMessage() {} func (*MsgFormat) ProtoMessage() {}
func (*MsgFormat) Descriptor() ([]byte, []int) { func (*MsgFormat) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{8} return fileDescriptor_chat_955d1f0dcca586dd, []int{8}
} }
func (m *MsgFormat) XXX_Unmarshal(b []byte) error { func (m *MsgFormat) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgFormat.Unmarshal(m, b) return xxx_messageInfo_MsgFormat.Unmarshal(m, b)
@ -835,181 +831,61 @@ func (m *MsgFormat) GetClientMsgID() string {
return "" return ""
} }
type UserSendMsgReq struct { type SendMsgReq struct {
ReqIdentifier int32 `protobuf:"varint,1,opt,name=ReqIdentifier" json:"ReqIdentifier,omitempty"` Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"`
Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
SendID string `protobuf:"bytes,3,opt,name=SendID" json:"SendID,omitempty"` MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"`
OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"`
SenderNickName string `protobuf:"bytes,5,opt,name=SenderNickName" json:"SenderNickName,omitempty"`
SenderFaceURL string `protobuf:"bytes,6,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"`
PlatformID int32 `protobuf:"varint,7,opt,name=PlatformID" json:"PlatformID,omitempty"`
SessionType int32 `protobuf:"varint,8,opt,name=SessionType" json:"SessionType,omitempty"`
MsgFrom int32 `protobuf:"varint,9,opt,name=MsgFrom" json:"MsgFrom,omitempty"`
ContentType int32 `protobuf:"varint,10,opt,name=ContentType" json:"ContentType,omitempty"`
RecvID string `protobuf:"bytes,11,opt,name=RecvID" json:"RecvID,omitempty"`
ForceList []string `protobuf:"bytes,12,rep,name=ForceList" json:"ForceList,omitempty"`
Content string `protobuf:"bytes,13,opt,name=Content" json:"Content,omitempty"`
Options string `protobuf:"bytes,14,opt,name=Options" json:"Options,omitempty"`
ClientMsgID string `protobuf:"bytes,15,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"`
OffLineInfo string `protobuf:"bytes,16,opt,name=OffLineInfo" json:"OffLineInfo,omitempty"`
Ex string `protobuf:"bytes,17,opt,name=Ex" json:"Ex,omitempty"`
SendTime int64 `protobuf:"varint,18,opt,name=sendTime" json:"sendTime,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} } func (m *SendMsgReq) Reset() { *m = SendMsgReq{} }
func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) } func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
func (*UserSendMsgReq) ProtoMessage() {} func (*SendMsgReq) ProtoMessage() {}
func (*UserSendMsgReq) Descriptor() ([]byte, []int) { func (*SendMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{9} return fileDescriptor_chat_955d1f0dcca586dd, []int{9}
} }
func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error { func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b) return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
} }
func (m *UserSendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UserSendMsgReq.Marshal(b, m, deterministic) return xxx_messageInfo_SendMsgReq.Marshal(b, m, deterministic)
} }
func (dst *UserSendMsgReq) XXX_Merge(src proto.Message) { func (dst *SendMsgReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_UserSendMsgReq.Merge(dst, src) xxx_messageInfo_SendMsgReq.Merge(dst, src)
} }
func (m *UserSendMsgReq) XXX_Size() int { func (m *SendMsgReq) XXX_Size() int {
return xxx_messageInfo_UserSendMsgReq.Size(m) return xxx_messageInfo_SendMsgReq.Size(m)
} }
func (m *UserSendMsgReq) XXX_DiscardUnknown() { func (m *SendMsgReq) XXX_DiscardUnknown() {
xxx_messageInfo_UserSendMsgReq.DiscardUnknown(m) xxx_messageInfo_SendMsgReq.DiscardUnknown(m)
} }
var xxx_messageInfo_UserSendMsgReq proto.InternalMessageInfo var xxx_messageInfo_SendMsgReq proto.InternalMessageInfo
func (m *UserSendMsgReq) GetReqIdentifier() int32 { func (m *SendMsgReq) GetToken() string {
if m != nil {
return m.ReqIdentifier
}
return 0
}
func (m *UserSendMsgReq) GetToken() string {
if m != nil { if m != nil {
return m.Token return m.Token
} }
return "" return ""
} }
func (m *UserSendMsgReq) GetSendID() string { func (m *SendMsgReq) GetOperationID() string {
if m != nil {
return m.SendID
}
return ""
}
func (m *UserSendMsgReq) GetOperationID() string {
if m != nil { if m != nil {
return m.OperationID return m.OperationID
} }
return "" return ""
} }
func (m *UserSendMsgReq) GetSenderNickName() string { func (m *SendMsgReq) GetMsgData() *sdk_ws.MsgData {
if m != nil { if m != nil {
return m.SenderNickName return m.MsgData
}
return ""
}
func (m *UserSendMsgReq) GetSenderFaceURL() string {
if m != nil {
return m.SenderFaceURL
}
return ""
}
func (m *UserSendMsgReq) GetPlatformID() int32 {
if m != nil {
return m.PlatformID
}
return 0
}
func (m *UserSendMsgReq) GetSessionType() int32 {
if m != nil {
return m.SessionType
}
return 0
}
func (m *UserSendMsgReq) GetMsgFrom() int32 {
if m != nil {
return m.MsgFrom
}
return 0
}
func (m *UserSendMsgReq) GetContentType() int32 {
if m != nil {
return m.ContentType
}
return 0
}
func (m *UserSendMsgReq) GetRecvID() string {
if m != nil {
return m.RecvID
}
return ""
}
func (m *UserSendMsgReq) GetForceList() []string {
if m != nil {
return m.ForceList
} }
return nil return nil
} }
func (m *UserSendMsgReq) GetContent() string { type SendMsgResp struct {
if m != nil {
return m.Content
}
return ""
}
func (m *UserSendMsgReq) GetOptions() string {
if m != nil {
return m.Options
}
return ""
}
func (m *UserSendMsgReq) GetClientMsgID() string {
if m != nil {
return m.ClientMsgID
}
return ""
}
func (m *UserSendMsgReq) GetOffLineInfo() string {
if m != nil {
return m.OffLineInfo
}
return ""
}
func (m *UserSendMsgReq) GetEx() string {
if m != nil {
return m.Ex
}
return ""
}
func (m *UserSendMsgReq) GetSendTime() int64 {
if m != nil {
return m.SendTime
}
return 0
}
type UserSendMsgResp struct {
ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"`
ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"`
ReqIdentifier int32 `protobuf:"varint,3,opt,name=ReqIdentifier" json:"ReqIdentifier,omitempty"` ReqIdentifier int32 `protobuf:"varint,3,opt,name=ReqIdentifier" json:"ReqIdentifier,omitempty"`
@ -1021,66 +897,66 @@ type UserSendMsgResp struct {
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} } func (m *SendMsgResp) Reset() { *m = SendMsgResp{} }
func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
func (*UserSendMsgResp) ProtoMessage() {} func (*SendMsgResp) ProtoMessage() {}
func (*UserSendMsgResp) Descriptor() ([]byte, []int) { func (*SendMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_chat_163a8d226aa6edb5, []int{10} return fileDescriptor_chat_955d1f0dcca586dd, []int{10}
} }
func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
} }
func (m *UserSendMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SendMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UserSendMsgResp.Marshal(b, m, deterministic) return xxx_messageInfo_SendMsgResp.Marshal(b, m, deterministic)
} }
func (dst *UserSendMsgResp) XXX_Merge(src proto.Message) { func (dst *SendMsgResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_UserSendMsgResp.Merge(dst, src) xxx_messageInfo_SendMsgResp.Merge(dst, src)
} }
func (m *UserSendMsgResp) XXX_Size() int { func (m *SendMsgResp) XXX_Size() int {
return xxx_messageInfo_UserSendMsgResp.Size(m) return xxx_messageInfo_SendMsgResp.Size(m)
} }
func (m *UserSendMsgResp) XXX_DiscardUnknown() { func (m *SendMsgResp) XXX_DiscardUnknown() {
xxx_messageInfo_UserSendMsgResp.DiscardUnknown(m) xxx_messageInfo_SendMsgResp.DiscardUnknown(m)
} }
var xxx_messageInfo_UserSendMsgResp proto.InternalMessageInfo var xxx_messageInfo_SendMsgResp proto.InternalMessageInfo
func (m *UserSendMsgResp) GetErrCode() int32 { func (m *SendMsgResp) GetErrCode() int32 {
if m != nil { if m != nil {
return m.ErrCode return m.ErrCode
} }
return 0 return 0
} }
func (m *UserSendMsgResp) GetErrMsg() string { func (m *SendMsgResp) GetErrMsg() string {
if m != nil { if m != nil {
return m.ErrMsg return m.ErrMsg
} }
return "" return ""
} }
func (m *UserSendMsgResp) GetReqIdentifier() int32 { func (m *SendMsgResp) GetReqIdentifier() int32 {
if m != nil { if m != nil {
return m.ReqIdentifier return m.ReqIdentifier
} }
return 0 return 0
} }
func (m *UserSendMsgResp) GetServerMsgID() string { func (m *SendMsgResp) GetServerMsgID() string {
if m != nil { if m != nil {
return m.ServerMsgID return m.ServerMsgID
} }
return "" return ""
} }
func (m *UserSendMsgResp) GetClientMsgID() string { func (m *SendMsgResp) GetClientMsgID() string {
if m != nil { if m != nil {
return m.ClientMsgID return m.ClientMsgID
} }
return "" return ""
} }
func (m *UserSendMsgResp) GetSendTime() int64 { func (m *SendMsgResp) GetSendTime() int64 {
if m != nil { if m != nil {
return m.SendTime return m.SendTime
} }
@ -1097,245 +973,70 @@ func init() {
proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "pbChat.GetMaxAndMinSeqResp") proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "pbChat.GetMaxAndMinSeqResp")
proto.RegisterType((*GatherFormat)(nil), "pbChat.GatherFormat") proto.RegisterType((*GatherFormat)(nil), "pbChat.GatherFormat")
proto.RegisterType((*MsgFormat)(nil), "pbChat.MsgFormat") proto.RegisterType((*MsgFormat)(nil), "pbChat.MsgFormat")
proto.RegisterType((*UserSendMsgReq)(nil), "pbChat.UserSendMsgReq") proto.RegisterType((*SendMsgReq)(nil), "pbChat.SendMsgReq")
proto.RegisterType((*UserSendMsgResp)(nil), "pbChat.UserSendMsgResp") proto.RegisterType((*SendMsgResp)(nil), "pbChat.SendMsgResp")
} }
// Reference imports to suppress errors if they are not otherwise used. func init() { proto.RegisterFile("chat.proto", fileDescriptor_chat_955d1f0dcca586dd) }
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file var fileDescriptor_chat_955d1f0dcca586dd = []byte{
// is compatible with the grpc package it is being compiled against. // 927 bytes of a gzipped FileDescriptorProto
const _ = grpc.SupportPackageIsVersion4 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcb, 0x6e, 0xe3, 0x36,
0x14, 0x85, 0x2d, 0x3f, 0xe2, 0x6b, 0xe7, 0xc5, 0x09, 0x32, 0x84, 0x5b, 0xb4, 0xae, 0x30, 0x2d,
// Client API for Chat service 0x8c, 0x2e, 0x12, 0x20, 0xdd, 0x14, 0x5d, 0x14, 0xe8, 0xc4, 0x49, 0xa0, 0x62, 0x94, 0x04, 0xb2,
0x07, 0x5d, 0x06, 0x1a, 0x9b, 0x56, 0x04, 0xdb, 0xa2, 0x4c, 0x32, 0xc9, 0xcc, 0xa6, 0xbf, 0xd0,
type ChatClient interface { 0x6d, 0x7f, 0xa8, 0x1f, 0xd3, 0x5f, 0x28, 0x50, 0xa0, 0xb8, 0xa4, 0x14, 0xeb, 0x11, 0x27, 0xc1,
GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*GetMaxAndMinSeqResp, error) 0x14, 0x33, 0xcb, 0x73, 0x78, 0x79, 0x49, 0xdd, 0x73, 0x78, 0x6c, 0x80, 0xf1, 0xb5, 0xaf, 0x0e,
PullMessage(ctx context.Context, in *PullMessageReq, opts ...grpc.CallOption) (*PullMessageResp, error) 0x62, 0xc1, 0x15, 0x27, 0x8d, 0xf8, 0xdd, 0xf1, 0xb5, 0xaf, 0xba, 0xdf, 0x5c, 0xc4, 0x2c, 0xba,
PullMessageBySeqList(ctx context.Context, in *PullMessageBySeqListReq, opts ...grpc.CallOption) (*PullMessageResp, error) 0x72, 0xdc, 0xc3, 0x78, 0x16, 0x1c, 0xea, 0xa5, 0x43, 0x39, 0x99, 0x5d, 0xdd, 0xc9, 0xc3, 0x3b,
UserSendMsg(ctx context.Context, in *UserSendMsgReq, opts ...grpc.CallOption) (*UserSendMsgResp, error) 0x69, 0x4a, 0xed, 0x3f, 0x6a, 0xb0, 0xfb, 0xdb, 0x70, 0xc4, 0x5d, 0x19, 0x0c, 0x6f, 0x05, 0xee,
} 0x72, 0x65, 0x40, 0xf6, 0xa1, 0x31, 0x64, 0xd1, 0xc4, 0x19, 0xd0, 0x4a, 0xaf, 0xd2, 0x6f, 0x79,
0x09, 0x42, 0xde, 0x63, 0xe3, 0x5b, 0x67, 0x40, 0xab, 0x86, 0x37, 0x88, 0x50, 0x68, 0x1e, 0xf3,
type chatClient struct { 0x48, 0xb1, 0x48, 0x51, 0x4b, 0x2f, 0xa4, 0x90, 0x74, 0x61, 0x03, 0xf7, 0x8e, 0xc2, 0x05, 0xa3,
cc *grpc.ClientConn 0xb5, 0x5e, 0xa5, 0x6f, 0x79, 0xf7, 0x18, 0x77, 0xb9, 0x32, 0x38, 0x15, 0x7c, 0x41, 0xeb, 0xbd,
} 0x4a, 0xbf, 0xee, 0xa5, 0x90, 0x7c, 0x07, 0x5b, 0x58, 0xc5, 0xc4, 0x79, 0x38, 0x9e, 0x9d, 0xfb,
0x0b, 0x46, 0x1b, 0xba, 0x6d, 0x81, 0x25, 0xaf, 0x60, 0xd3, 0x30, 0xa7, 0xfe, 0x98, 0xbd, 0xf5,
func NewChatClient(cc *grpc.ClientConn) ChatClient { 0xde, 0xd0, 0xa6, 0x2e, 0xcb, 0x93, 0xa4, 0x07, 0xed, 0xe4, 0x3a, 0xa3, 0x0f, 0x31, 0xa3, 0x1b,
return &chatClient{cc} 0xfa, 0xac, 0x2c, 0x85, 0x15, 0x43, 0x26, 0x65, 0xc8, 0x23, 0x5d, 0xd1, 0x32, 0x15, 0x19, 0x0a,
} 0x2b, 0x2e, 0x62, 0x26, 0x7c, 0x15, 0xf2, 0xc8, 0x19, 0x50, 0xd0, 0xe7, 0x64, 0x29, 0xb2, 0x07,
0x75, 0x57, 0x06, 0xce, 0x80, 0xb6, 0xf5, 0x9a, 0x01, 0xc8, 0x8e, 0xf8, 0x8c, 0x45, 0xb4, 0x63,
func (c *chatClient) GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*GetMaxAndMinSeqResp, error) { 0x58, 0x0d, 0x74, 0xb7, 0xe9, 0x74, 0x1e, 0x46, 0xcc, 0x89, 0xa6, 0x9c, 0x6e, 0x26, 0xdd, 0x56,
out := new(GetMaxAndMinSeqResp) 0x14, 0xce, 0xe6, 0x22, 0xc6, 0xce, 0x92, 0x6e, 0x99, 0x89, 0x26, 0x90, 0x7c, 0x05, 0x70, 0x39,
err := grpc.Invoke(ctx, "/pbChat.Chat/GetMaxAndMinSeq", in, out, c.cc, opts...) 0xf7, 0xd5, 0x94, 0x8b, 0x85, 0x33, 0xa0, 0xdb, 0xfa, 0xaa, 0x19, 0x86, 0x7c, 0x09, 0xad, 0x53,
if err != nil { 0x2e, 0xc6, 0xec, 0x4d, 0x28, 0x15, 0xdd, 0xe9, 0x59, 0xfd, 0x96, 0xb7, 0x22, 0xf4, 0x2c, 0xe6,
return nil, err 0x21, 0x8b, 0x94, 0xb9, 0xeb, 0xae, 0x39, 0x39, 0x43, 0xd9, 0xff, 0x58, 0xb0, 0x6f, 0xdc, 0x30,
} 0xe2, 0x97, 0x37, 0xf2, 0xfa, 0x93, 0xd8, 0x82, 0x42, 0x13, 0x6b, 0x86, 0x6c, 0x99, 0xb8, 0x22,
return out, nil 0x85, 0x39, 0xc3, 0xd4, 0xd7, 0x1b, 0xa6, 0xf1, 0x94, 0x61, 0x9a, 0xcf, 0x33, 0xcc, 0xc6, 0x33,
} 0x0c, 0xd3, 0x7a, 0xd2, 0x30, 0xf0, 0xa4, 0x61, 0xda, 0x8f, 0x18, 0xa6, 0x93, 0x35, 0xcc, 0xa7,
0xb4, 0x46, 0x41, 0xfc, 0x9d, 0xb2, 0xf8, 0xbf, 0xc3, 0xd6, 0xe5, 0xcd, 0x7c, 0xee, 0x32, 0x29,
func (c *chatClient) PullMessage(ctx context.Context, in *PullMessageReq, opts ...grpc.CallOption) (*PullMessageResp, error) { 0xfd, 0x80, 0x79, 0x6c, 0x89, 0xda, 0xbe, 0x95, 0x4c, 0xac, 0x34, 0x37, 0xc8, 0xe8, 0xb4, 0x7c,
out := new(PullMessageResp) 0xcd, 0x82, 0x30, 0xd2, 0xaa, 0x6b, 0x9d, 0x0c, 0x36, 0x3e, 0x59, 0x9e, 0x44, 0x13, 0x2d, 0xbb,
err := grpc.Invoke(ctx, "/pbChat.Chat/PullMessage", in, out, c.cc, opts...) 0xe5, 0x25, 0xa8, 0x38, 0x93, 0x5a, 0x69, 0x26, 0xf6, 0xdf, 0x15, 0xd8, 0xce, 0x5d, 0x40, 0xc6,
if err != nil { 0xf8, 0xbd, 0x27, 0x42, 0x1c, 0xf3, 0x09, 0xd3, 0x57, 0xa8, 0x7b, 0x29, 0xc4, 0x73, 0x4e, 0x84,
return nil, err 0x70, 0x65, 0x90, 0xfa, 0xce, 0x20, 0xe4, 0x5d, 0xff, 0x3d, 0x9a, 0x2b, 0x39, 0xdf, 0x20, 0xcd,
} 0x87, 0xd1, 0xca, 0x74, 0x09, 0x22, 0x3f, 0xc1, 0xe6, 0x30, 0x8c, 0x82, 0x39, 0xc3, 0x6f, 0xc3,
return out, nil 0x76, 0xf5, 0x9e, 0xd5, 0x6f, 0x1f, 0xed, 0x1d, 0x98, 0x1c, 0x3d, 0x38, 0xf3, 0xd5, 0x35, 0x13,
} 0xa7, 0x5c, 0x2c, 0x7c, 0xe5, 0xe5, 0x4b, 0xc9, 0x8f, 0xd0, 0x39, 0x13, 0xfc, 0x26, 0x4e, 0xb7,
0x36, 0x1e, 0xd9, 0x9a, 0xab, 0xb4, 0x17, 0xf0, 0x32, 0xf3, 0xa9, 0xaf, 0x3f, 0x0c, 0xd9, 0x12,
func (c *chatClient) PullMessageBySeqList(ctx context.Context, in *PullMessageBySeqListReq, opts ...grpc.CallOption) (*PullMessageResp, error) { 0x9f, 0xe8, 0x63, 0x43, 0x2f, 0x0c, 0xb0, 0x5a, 0x36, 0x15, 0x85, 0xa6, 0x34, 0x7d, 0xa8, 0xd5,
out := new(PullMessageResp) 0xb3, 0xf0, 0x61, 0x25, 0xd0, 0x3e, 0x07, 0x72, 0xc6, 0x94, 0xeb, 0xbf, 0xff, 0x25, 0x9a, 0x98,
err := grpc.Invoke(ctx, "/pbChat.Chat/PullMessageBySeqList", in, out, c.cc, opts...) 0xef, 0xfe, 0x5f, 0x27, 0xd9, 0x77, 0xf0, 0xa2, 0xd4, 0xef, 0x73, 0xa8, 0x65, 0x9f, 0x40, 0x27,
if err != nil { 0x3b, 0x55, 0xb2, 0x05, 0xd5, 0xfb, 0xeb, 0x57, 0x9d, 0x01, 0xf9, 0x16, 0x6a, 0xfa, 0xfb, 0xab,
return nil, err 0x5a, 0x89, 0xdd, 0x54, 0x09, 0x8c, 0x0a, 0x23, 0x83, 0x5e, 0xb6, 0xff, 0xad, 0x42, 0xeb, 0x9e,
} 0xfb, 0x98, 0x68, 0x4b, 0xa3, 0xc8, 0xca, 0x47, 0x51, 0x21, 0x3c, 0x6a, 0x6b, 0xc2, 0x43, 0xdc,
return out, nil 0x6a, 0x17, 0x38, 0x03, 0x9d, 0x72, 0x2d, 0x2f, 0x4b, 0x65, 0x83, 0xb3, 0x91, 0x0f, 0xce, 0x1d,
} 0xb0, 0x70, 0x22, 0x4d, 0x3d, 0x11, 0xab, 0x18, 0x98, 0x1b, 0x85, 0xc0, 0xfc, 0x1e, 0x76, 0x4c,
0xb2, 0x65, 0x62, 0xc1, 0xa4, 0x59, 0x89, 0x7f, 0x20, 0x42, 0xe1, 0x79, 0x11, 0xda, 0x5e, 0x17,
func (c *chatClient) UserSendMsg(ctx context.Context, in *UserSendMsgReq, opts ...grpc.CallOption) (*UserSendMsgResp, error) { 0xa1, 0x99, 0xa8, 0xe9, 0x94, 0xa3, 0x46, 0x01, 0xe0, 0x16, 0x57, 0x06, 0xe8, 0xc3, 0x3d, 0xa8,
out := new(UserSendMsgResp) 0x2b, 0xfd, 0x3b, 0x69, 0xc6, 0x6f, 0x00, 0x76, 0xe1, 0x65, 0x17, 0x66, 0x28, 0x72, 0x00, 0xcd,
err := grpc.Invoke(ctx, "/pbChat.Chat/UserSendMsg", in, out, c.cc, opts...) 0x85, 0x0c, 0x06, 0xbe, 0xf2, 0xb5, 0x0e, 0xf8, 0xf2, 0x38, 0xfe, 0xe9, 0x09, 0x17, 0x57, 0x72,
if err != nil { 0x32, 0x43, 0xd1, 0x71, 0xcd, 0x4b, 0x8b, 0xec, 0xbf, 0x2a, 0x38, 0xfc, 0xe4, 0xd8, 0x8f, 0xb2,
return nil, err 0xeb, 0x2b, 0xd8, 0xf4, 0xd8, 0xd2, 0x99, 0xb0, 0x48, 0x85, 0xd3, 0x90, 0x89, 0x44, 0xff, 0x3c,
} 0x59, 0xd4, 0xb8, 0x56, 0xd6, 0xb8, 0x30, 0xa1, 0x7a, 0x69, 0x42, 0xa8, 0xac, 0x4c, 0x95, 0x6d,
return out, nil 0x18, 0x65, 0x53, 0x7c, 0xf4, 0x67, 0x15, 0x6a, 0x68, 0x6b, 0xf2, 0x2b, 0x6c, 0x17, 0x9e, 0x21,
} 0xe9, 0xde, 0x87, 0x4f, 0xe9, 0xbd, 0x77, 0xbf, 0x58, 0xbb, 0x26, 0x63, 0xf2, 0x33, 0xb4, 0x33,
0x89, 0x44, 0xf6, 0xd3, 0xda, 0xfc, 0x4f, 0x42, 0xf7, 0xe5, 0x83, 0xbc, 0x8c, 0xc9, 0x25, 0xec,
// Server API for Chat service 0x3d, 0x94, 0x68, 0xe4, 0xeb, 0x07, 0x36, 0x64, 0xf3, 0x6e, 0x7d, 0xc7, 0x23, 0x68, 0x26, 0x6a,
0x11, 0x92, 0xd6, 0xac, 0x5c, 0xd3, 0x7d, 0x51, 0xe2, 0x64, 0xfc, 0xae, 0xa1, 0xff, 0xd9, 0xfe,
type ChatServer interface { 0xf0, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x2f, 0xc4, 0xa9, 0x12, 0x0b, 0x00, 0x00,
GetMaxAndMinSeq(context.Context, *GetMaxAndMinSeqReq) (*GetMaxAndMinSeqResp, error)
PullMessage(context.Context, *PullMessageReq) (*PullMessageResp, error)
PullMessageBySeqList(context.Context, *PullMessageBySeqListReq) (*PullMessageResp, error)
UserSendMsg(context.Context, *UserSendMsgReq) (*UserSendMsgResp, error)
}
func RegisterChatServer(s *grpc.Server, srv ChatServer) {
s.RegisterService(&_Chat_serviceDesc, srv)
}
func _Chat_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMaxAndMinSeqReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServer).GetMaxAndMinSeq(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbChat.Chat/GetMaxAndMinSeq",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).GetMaxAndMinSeq(ctx, req.(*GetMaxAndMinSeqReq))
}
return interceptor(ctx, in, info, handler)
}
func _Chat_PullMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PullMessageReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServer).PullMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbChat.Chat/PullMessage",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).PullMessage(ctx, req.(*PullMessageReq))
}
return interceptor(ctx, in, info, handler)
}
func _Chat_PullMessageBySeqList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PullMessageBySeqListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServer).PullMessageBySeqList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbChat.Chat/PullMessageBySeqList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).PullMessageBySeqList(ctx, req.(*PullMessageBySeqListReq))
}
return interceptor(ctx, in, info, handler)
}
func _Chat_UserSendMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserSendMsgReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ChatServer).UserSendMsg(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pbChat.Chat/UserSendMsg",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ChatServer).UserSendMsg(ctx, req.(*UserSendMsgReq))
}
return interceptor(ctx, in, info, handler)
}
var _Chat_serviceDesc = grpc.ServiceDesc{
ServiceName: "pbChat.Chat",
HandlerType: (*ChatServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetMaxAndMinSeq",
Handler: _Chat_GetMaxAndMinSeq_Handler,
},
{
MethodName: "PullMessage",
Handler: _Chat_PullMessage_Handler,
},
{
MethodName: "PullMessageBySeqList",
Handler: _Chat_PullMessageBySeqList_Handler,
},
{
MethodName: "UserSendMsg",
Handler: _Chat_UserSendMsg_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "chat/chat.proto",
}
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_163a8d226aa6edb5) }
var fileDescriptor_chat_163a8d226aa6edb5 = []byte{
// 981 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6a, 0xe3, 0x46,
0x14, 0xc6, 0x92, 0x2d, 0xdb, 0xc7, 0xbf, 0x99, 0x86, 0xec, 0x90, 0x96, 0xd6, 0x88, 0x6d, 0x31,
0xbd, 0x48, 0x61, 0x7b, 0x53, 0x5a, 0x58, 0x68, 0x62, 0x27, 0xa8, 0x44, 0xd9, 0x20, 0x7b, 0x29,
0xf4, 0x4e, 0x6b, 0x8f, 0x15, 0xb1, 0xb6, 0x24, 0xcf, 0x28, 0x69, 0xf6, 0xa6, 0xaf, 0xd0, 0x97,
0xe8, 0x65, 0x5f, 0xa4, 0x8f, 0xd2, 0x57, 0x28, 0x14, 0xca, 0xcc, 0x48, 0xd6, 0xe8, 0xc7, 0x49,
0xd8, 0xb2, 0x7b, 0x13, 0x38, 0x9f, 0xce, 0xfc, 0x9c, 0xf3, 0x7d, 0xf3, 0x1d, 0x07, 0x06, 0x8b,
0x1b, 0x37, 0xfe, 0x86, 0xff, 0x39, 0x89, 0x68, 0x18, 0x87, 0xc8, 0x88, 0xde, 0x9c, 0xdd, 0xb8,
0xb1, 0xf9, 0x7b, 0x1d, 0x0e, 0x7e, 0x9e, 0xcd, 0x43, 0x9b, 0x79, 0xb3, 0x3b, 0xca, 0x21, 0x9b,
0x79, 0xe8, 0x08, 0x8c, 0x19, 0x09, 0x96, 0xd6, 0x04, 0xd7, 0x46, 0xb5, 0x71, 0xdb, 0x49, 0x22,
0x8e, 0x3b, 0x64, 0x71, 0x67, 0x4d, 0xb0, 0x26, 0x71, 0x19, 0x21, 0x0c, 0xcd, 0xb3, 0x30, 0x88,
0x49, 0x10, 0x63, 0x5d, 0x7c, 0x48, 0x43, 0x74, 0x0c, 0x2d, 0xbe, 0x76, 0xee, 0x6f, 0x08, 0xae,
0x8f, 0x6a, 0x63, 0xdd, 0xd9, 0xc5, 0x7c, 0x95, 0xcd, 0xbc, 0x73, 0x1a, 0x6e, 0x70, 0x63, 0x54,
0x1b, 0x37, 0x9c, 0x34, 0x44, 0x5f, 0x41, 0x9f, 0x67, 0x11, 0x7a, 0xe5, 0x2f, 0xde, 0x5e, 0xb9,
0x1b, 0x82, 0x0d, 0xb1, 0x6d, 0x01, 0x45, 0xcf, 0xa1, 0x27, 0x91, 0x73, 0x77, 0x41, 0x5e, 0x3b,
0x97, 0xb8, 0x29, 0xd2, 0xf2, 0x20, 0x1a, 0x41, 0x27, 0xb9, 0xce, 0xfc, 0x5d, 0x44, 0x70, 0x4b,
0x9c, 0xa5, 0x42, 0x3c, 0x63, 0x46, 0x18, 0xf3, 0xc3, 0x40, 0x64, 0xb4, 0x65, 0x86, 0x02, 0xf1,
0x8c, 0x57, 0x11, 0xa1, 0x6e, 0xec, 0x87, 0x81, 0x35, 0xc1, 0x20, 0xce, 0x51, 0x21, 0x74, 0x08,
0x0d, 0x9b, 0x79, 0xd6, 0x04, 0x77, 0xc4, 0x37, 0x19, 0x70, 0x74, 0x1e, 0xbe, 0x25, 0x01, 0xee,
0x4a, 0x54, 0x04, 0x62, 0xb7, 0xd5, 0x6a, 0xed, 0x07, 0xc4, 0x0a, 0x56, 0x21, 0xee, 0x25, 0xbb,
0x65, 0x10, 0xef, 0xcd, 0xab, 0x88, 0xef, 0xcc, 0x70, 0x5f, 0x76, 0x34, 0x09, 0xd1, 0xe7, 0x00,
0xd7, 0x6b, 0x37, 0x5e, 0x85, 0x74, 0x63, 0x4d, 0xf0, 0x40, 0x5c, 0x55, 0x41, 0xd0, 0x67, 0xd0,
0x3e, 0x0f, 0xe9, 0x82, 0x5c, 0xfa, 0x2c, 0xc6, 0xc3, 0x91, 0x3e, 0x6e, 0x3b, 0x19, 0x20, 0x7a,
0xb1, 0xf6, 0x49, 0x10, 0xcb, 0xbb, 0x1e, 0xc8, 0x93, 0x15, 0xc8, 0xfc, 0x47, 0x87, 0x23, 0xa9,
0x86, 0x79, 0x78, 0x7d, 0xcb, 0x6e, 0x3e, 0x88, 0x2c, 0x30, 0x34, 0x79, 0xce, 0x8c, 0x6c, 0x13,
0x55, 0xa4, 0x61, 0x4e, 0x30, 0x8d, 0xfd, 0x82, 0x31, 0x1e, 0x13, 0x4c, 0xf3, 0x69, 0x82, 0x69,
0x3d, 0x41, 0x30, 0xed, 0x47, 0x05, 0x03, 0x8f, 0x0a, 0xa6, 0xf3, 0x80, 0x60, 0xba, 0xaa, 0x60,
0x3e, 0xa4, 0x34, 0x0a, 0xe4, 0x0f, 0xcb, 0xe4, 0xff, 0x06, 0xfd, 0xeb, 0xdb, 0xf5, 0xda, 0x26,
0x8c, 0xb9, 0x1e, 0x71, 0xc8, 0x96, 0x73, 0xfb, 0x9a, 0x11, 0x9a, 0x71, 0x2e, 0x23, 0xc9, 0xd3,
0xf6, 0x94, 0x78, 0x7e, 0x20, 0x58, 0x17, 0x3c, 0xc9, 0x58, 0xea, 0x64, 0x3b, 0x0d, 0x96, 0x82,
0x76, 0xdd, 0x49, 0xa2, 0x62, 0x4f, 0xea, 0xa5, 0x9e, 0x98, 0x7f, 0xd7, 0x60, 0x90, 0xbb, 0x00,
0x8b, 0x78, 0xbd, 0x53, 0x4a, 0xcf, 0xc2, 0x25, 0x11, 0x57, 0x68, 0x38, 0x69, 0xc8, 0xcf, 0x99,
0x52, 0x6a, 0x33, 0x2f, 0xd5, 0x9d, 0x8c, 0x38, 0x6e, 0xbb, 0xf7, 0x5c, 0x5c, 0xc9, 0xf9, 0x32,
0x12, 0xb8, 0x1f, 0x64, 0xa2, 0x4b, 0x22, 0xf4, 0x3d, 0xf4, 0x66, 0x7e, 0xe0, 0xad, 0x09, 0xaf,
0x8d, 0x6f, 0xd7, 0x18, 0xe9, 0xe3, 0xce, 0x8b, 0xc3, 0x13, 0x69, 0x92, 0x27, 0x17, 0x6e, 0x7c,
0x43, 0xe8, 0x79, 0x48, 0x37, 0x6e, 0xec, 0xe4, 0x53, 0xd1, 0x77, 0xd0, 0xbd, 0xa0, 0xe1, 0x6d,
0x94, 0x2e, 0x35, 0x1e, 0x58, 0x9a, 0xcb, 0x34, 0x37, 0xf0, 0x4c, 0x29, 0xf5, 0xf4, 0xdd, 0x8c,
0x6c, 0xf9, 0x13, 0x7d, 0xa8, 0xe9, 0x85, 0x06, 0x6a, 0x65, 0x51, 0x61, 0x68, 0x32, 0xb9, 0x0f,
0xd6, 0x47, 0x3a, 0x7f, 0x58, 0x49, 0x68, 0x5e, 0x01, 0xba, 0x20, 0xb1, 0xed, 0xde, 0xff, 0x18,
0x2c, 0x65, 0xdd, 0xff, 0xeb, 0x24, 0xf3, 0x57, 0xf8, 0xa4, 0xb4, 0xdf, 0xc7, 0x60, 0xcb, 0x9c,
0x42, 0x57, 0xed, 0x2a, 0xea, 0x83, 0xb6, 0xbb, 0xbe, 0x66, 0x4d, 0xd0, 0x97, 0x50, 0x17, 0xf5,
0x6b, 0x82, 0x89, 0x83, 0x94, 0x09, 0x6e, 0x15, 0x92, 0x06, 0xf1, 0xd9, 0xfc, 0x57, 0x83, 0xf6,
0x0e, 0x7b, 0x1f, 0x6b, 0x4b, 0xad, 0x48, 0xcf, 0x5b, 0x51, 0xc1, 0x3c, 0xea, 0x7b, 0xcc, 0x83,
0xde, 0x09, 0x15, 0x58, 0x13, 0xe1, 0x72, 0x6d, 0x47, 0x85, 0x54, 0xe3, 0x34, 0xf2, 0xc6, 0x39,
0x04, 0x9d, 0x77, 0xa4, 0x29, 0x3a, 0xa2, 0x17, 0x0d, 0xb3, 0x55, 0x30, 0xcc, 0xaf, 0x61, 0x28,
0x9d, 0x4d, 0xb1, 0x05, 0xe9, 0x66, 0x25, 0xbc, 0xc2, 0x42, 0xe1, 0x69, 0x16, 0xda, 0xd9, 0x67,
0xa1, 0x8a, 0xd5, 0x74, 0xcb, 0x56, 0xf3, 0x67, 0x1d, 0xfa, 0x5c, 0x6c, 0x7c, 0x9d, 0xcd, 0x3c,
0x2e, 0xc6, 0xe7, 0xd0, 0x73, 0xc8, 0xd6, 0x5a, 0x92, 0x20, 0xf6, 0x57, 0x3e, 0xa1, 0x89, 0x82,
0xf2, 0x60, 0x36, 0x52, 0x35, 0x75, 0xa4, 0x66, 0x04, 0xea, 0x39, 0x02, 0x1f, 0xf5, 0x9c, 0x8a,
0xc2, 0x1b, 0x4f, 0x2b, 0xdc, 0xa8, 0x2a, 0x3c, 0xef, 0xc1, 0xcd, 0x2a, 0x0f, 0x56, 0x27, 0x47,
0xab, 0x3c, 0x39, 0x14, 0x69, 0xb5, 0x1f, 0x94, 0x16, 0x94, 0xa5, 0x95, 0xc9, 0xb5, 0x93, 0x93,
0x6b, 0xee, 0x47, 0x41, 0xb7, 0xf8, 0xa3, 0x40, 0x91, 0x5b, 0xaf, 0x34, 0xa7, 0xf7, 0xcc, 0x9a,
0x02, 0xc1, 0x83, 0x12, 0xc1, 0xc9, 0x24, 0xbb, 0x4c, 0x27, 0xd9, 0x70, 0x37, 0xc9, 0x52, 0x88,
0xbf, 0xdc, 0xe9, 0x7d, 0xf2, 0x1b, 0x44, 0x9b, 0xde, 0x73, 0x29, 0xb3, 0x54, 0xca, 0x48, 0x4a,
0x39, 0x8d, 0xcd, 0xbf, 0x6a, 0x30, 0xc8, 0xc9, 0xe5, 0xbd, 0xbc, 0xa6, 0xa4, 0x30, 0xbd, 0x4a,
0x61, 0x85, 0x07, 0x5a, 0x2f, 0x3f, 0xd0, 0x42, 0xf5, 0x8d, 0x72, 0xf5, 0x6a, 0x2d, 0x46, 0xbe,
0x96, 0x17, 0x7f, 0x68, 0x50, 0xe7, 0x9e, 0x84, 0x7e, 0x82, 0x41, 0xc1, 0x43, 0xd1, 0xf1, 0x6e,
0x72, 0x94, 0xcc, 0xfa, 0xf8, 0xd3, 0xbd, 0xdf, 0x58, 0x84, 0x5e, 0x42, 0x47, 0x19, 0x27, 0xe8,
0x28, 0xcd, 0xcd, 0xcf, 0xf3, 0xe3, 0x67, 0x95, 0x38, 0x8b, 0xd0, 0x35, 0x1c, 0x56, 0x8d, 0x23,
0xf4, 0x45, 0xc5, 0x02, 0x75, 0x58, 0xed, 0xdf, 0xf1, 0x25, 0x74, 0x14, 0xc6, 0xb2, 0x1b, 0xe5,
0x5f, 0x7d, 0xb6, 0xbe, 0x40, 0xef, 0xe9, 0xe0, 0x97, 0xde, 0x89, 0xf8, 0x9f, 0xe5, 0x07, 0x99,
0xf0, 0xc6, 0x10, 0xff, 0xbb, 0x7c, 0xfb, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x44, 0x4e,
0x52, 0xce, 0x0c, 0x00, 0x00,
} }

View File

@ -1,6 +1,7 @@
syntax = "proto3"; syntax = "proto3";
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
package pbChat;//The package name to which the proto file belongs package pbChat;//The package name to which the proto file belongs
option go_package = "./chat;pbChat";//The generated go pb file is in the current directory, and the package name is pbChat //option go_package = ".;pbChat";//The generated go pb file is in the current directory, and the package name is pbChat
message WSToMsgSvrChatMsg{ message WSToMsgSvrChatMsg{
string SendID = 1; string SendID = 1;
@ -106,31 +107,16 @@ message MsgFormat{
string ClientMsgID = 12; string ClientMsgID = 12;
} }
message UserSendMsgReq { message SendMsgReq {
int32 ReqIdentifier = 1; string token =1;
string Token = 2; string operationID = 2;
string SendID = 3; open_im_sdk.MsgData msgData = 3;
string OperationID = 4;
string SenderNickName = 5;
string SenderFaceURL = 6;
int32 PlatformID = 7;
int32 SessionType = 8;
int32 MsgFrom = 9;
int32 ContentType = 10;
string RecvID = 11;
repeated string ForceList = 12;
string Content = 13;
string Options = 14;
string ClientMsgID = 15;
string OffLineInfo = 16;
string Ex = 17;
int64 sendTime = 18;
} }
message UserSendMsgResp { message SendMsgResp {
int32 ErrCode = 1; int32 ErrCode = 1;
string ErrMsg = 2; string ErrMsg = 2;
int32 ReqIdentifier = 3; int32 ReqIdentifier = 3;
@ -143,5 +129,5 @@ service Chat {
rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp); rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp);
rpc PullMessage(PullMessageReq) returns(PullMessageResp); rpc PullMessage(PullMessageReq) returns(PullMessageResp);
rpc PullMessageBySeqList(PullMessageBySeqListReq) returns(PullMessageResp); rpc PullMessageBySeqList(PullMessageBySeqListReq) returns(PullMessageResp);
rpc UserSendMsg(UserSendMsgReq) returns(UserSendMsgResp); rpc SendMsg(SendMsgReq) returns(SendMsgResp);
} }

View File

@ -15,8 +15,10 @@ message CreateGroupReq{
string faceUrl = 5; string faceUrl = 5;
string token = 6; string token = 6;
string operationID = 7; string operationID = 7;
string ex = 8; string CreatorUserID = 8;
} }
message GroupAddMemberInfo{ message GroupAddMemberInfo{
string uid = 1; string uid = 1;
int32 setRole = 2; int32 setRole = 2;
@ -31,6 +33,7 @@ message GetGroupsInfoReq{
repeated string groupIDList = 1; repeated string groupIDList = 1;
string token = 2; string token = 2;
string operationID = 3; string operationID = 3;
string UserID = 4;
} }
message GetGroupsInfoResp{ message GetGroupsInfoResp{
int32 ErrorCode = 1; int32 ErrorCode = 1;
@ -105,12 +108,12 @@ message JoinGroupReq{
message GroupApplicationResponseReq{ message GroupApplicationResponseReq{
string OperationID = 1; string OperationID = 1;
string OwnerID = 2; string UserID = 2;
string GroupID = 3; string GroupID = 3;
string FromUserID = 4; string FromUserID = 4; //::
string FromUserNickName = 5; string FromUserNickName = 5;
string FromUserFaceUrl = 6; string FromUserFaceUrl = 6;
string ToUserID = 7; string ToUserID = 7; //:0:
string ToUserNickName = 8; string ToUserNickName = 8;
string ToUserFaceUrl = 9; string ToUserFaceUrl = 9;
int64 AddTime = 10; int64 AddTime = 10;

View File

@ -20,8 +20,7 @@ message MsgToUserReq {
} }
message MsgToUserResp{ message MsgToUserResp{
repeated SingleMsgToUser resp = 1; repeated SingleMsgToUser resp = 1;
} }//message SendMsgByWSReq{
//message SendMsgByWSReq{
// string SendID = 1; // string SendID = 1;
// string RecvID = 2; // string RecvID = 2;
// string Content = 3; // string Content = 3;
@ -32,6 +31,7 @@ repeated SingleMsgToUser resp = 1;
// string OperationID = 8; // string OperationID = 8;
// int64 PlatformID = 9; // int64 PlatformID = 9;
//} //}
message SingleMsgToUser{ message SingleMsgToUser{
int64 ResultCode = 1; int64 ResultCode = 1;
string RecvID = 2; string RecvID = 2;

File diff suppressed because it is too large Load Diff

View File

@ -96,43 +96,35 @@ message OfflinePushInfo{
string Title = 1; string Title = 1;
string Desc = 2; string Desc = 2;
string Ext = 3; string Ext = 3;
string PushSound = 4; string iOSPushSound = 4;
bool ISBadgeCount = 5; bool iOSBadgeCount = 5;
} }
//public
message GroupInfo{ message GroupInfo{
string GroupID = 1; string GroupID = 1;
string GroupName = 2; string GroupName = 2;
string Notification = 3; string Notification = 3;
string Introduction = 4; string Introduction = 4;
string FaceUrl = 5; string FaceUrl = 5;
string OwnerID = 6; PublicUserInfo Owner = 6;
int64 CreateTime = 7; uint64 CreateTime = 7;
uint32 MemberCount = 8; uint32 MemberCount = 8;
} }
message GroupMemberFullInfo{ //private, Group members have permission to view
message GroupMemberFullInfo {
string GroupID = 1 ; string GroupID = 1 ;
string UserID = 2 ; string UserID = 2 ;
int32 Role = 3; int32 AdministratorLevel = 3;
int64 JoinTime = 4; uint64 JoinTime = 4;
string NickName = 5; string NickName = 5;
string FaceUrl =6; string FaceUrl = 6;
} string FriendRemark = 7;
message FriendInfo{
string UserID = 1;
string Nickname = 2;
string FaceUrl = 3;
int32 Gender = 4;
string Mobile = 5;
string Birth = 6;
string Email = 7;
string Remark = 8;
} }
//private, Friends have permission to view
message UserInfo{ message UserInfo{
string UserID = 1; string UserID = 1;
string Nickname = 2; string Nickname = 2;
@ -143,19 +135,148 @@ message UserInfo{
string Email = 7; string Email = 7;
} }
message UserPublicInfo{ //No permissions required
message PublicUserInfo{
string UserID = 1; string UserID = 1;
string Nickname = 2; string Nickname = 2;
string FaceUrl = 3; string FaceUrl = 3;
int32 Gender = 4; int32 Gender = 4;
} }
message CreateGroupTip{ message TipsComm{
GroupInfo group = 1; bytes Detail = 1;
UserInfo creator = 2; string DefaultTips = 2;
repeated GroupMemberFullInfo memberList = 3; }
//////////////////////group/////////////////////
//Actively join the group
message MemberEnterTips{
GroupInfo Group = 1;
GroupMemberFullInfo EntrantUser = 2;
uint64 OperationTime = 3;
} }
//Actively leave the group
message MemberLeaveTips{
GroupInfo Group = 1;
GroupMemberFullInfo LeaverUser = 2;
uint64 OperationTime = 3;
}
message MemberInvitedTips{
GroupInfo Group = 1;
GroupMemberFullInfo OpUser = 2;
GroupMemberFullInfo InvitedUser = 3;
uint64 OperationTime = 4;
}
message MemberKickedTips{
GroupInfo Group = 1;
GroupMemberFullInfo OpUser = 2;
GroupMemberFullInfo KickedUser = 3;
uint64 OperationTime = 4;
}
message MemberInfoChangedTips{
int32 ChangeType = 1; //1:info changed; 2:mute
GroupMemberFullInfo OpUser = 2; //who do this
GroupMemberFullInfo FinalInfo = 3; //
uint64 MuteTime = 4;
GroupInfo Group = 5;
}
message GroupCreatedTips{
GroupInfo Group = 1;
GroupMemberFullInfo Creator = 2;
repeated GroupMemberFullInfo MemberList = 3;
uint64 OperationTime = 4;
}
message GroupInfoChangedTips{
int32 ChangedType = 1; //bitwise operators: 1:groupName; 10:Notification 100:Introduction; 1000:FaceUrl
GroupInfo Group = 2;
GroupMemberFullInfo OpUser = 3;
}
message ReceiveJoinApplicationTips{
GroupInfo Group = 1;
PublicUserInfo Applicant = 2;
string Reason = 3;
}
message ApplicationProcessedTips{
GroupInfo Group = 1;
GroupMemberFullInfo OpUser = 2;
int32 Result = 3;
string Reason = 4;
}
//////////////////////friend/////////////////////
message FriendInfo{
UserInfo OwnerUser = 1;
string Remark = 2;
uint64 CreateTime = 3;
UserInfo FriendUser = 4;
}
message FriendApplication{
uint64 AddTime = 1;
string AddSource = 2;
string AddWording = 3;
}
//user1 add user2
message FriendApplicationAddedTips{
PublicUserInfo OpUser = 1; //user1
FriendApplication Application = 2;
PublicUserInfo OpedUser = 3; //user2
uint64 OperationTime = 4;
}
// user2 accept or reject
message FriendApplicationProcessedTips{
PublicUserInfo OpUser = 1; //user2
PublicUserInfo OpedUser = 2; //user1
int32 result = 3; //1: accept; -1: reject
uint64 OperationTime = 4;
}
message FriendAddedTips{
FriendInfo Friend = 1;
uint64 OperationTime = 2;
}
message FriendDeletedTips{
FriendInfo Friend = 1;
uint64 OperationTime = 2;
}
message BlackInfo{
PublicUserInfo OwnerUser = 1;
uint64 CreateTime = 3;
PublicUserInfo BlackUser = 4;
}
message BlackAddedTips{
BlackInfo Black = 1;
uint64 OperationTime = 2;
}
message BlackDeletedTips{
BlackInfo Black = 1;
uint64 OperationTime = 2;
}
message FriendInfoChangedTips{
FriendInfo Friend = 1;
PublicUserInfo OpUser = 2;
uint64 OperationTime = 3;
}
//////////////////////user/////////////////////
message SelfInfoUpdatedTips{
UserInfo SelfUserInfo = 1;
PublicUserInfo OpUser = 2;
uint64 OperationTime = 3;
}

View File

@ -54,6 +54,11 @@ func StructToJsonString(param interface{}) string {
return dataString return dataString
} }
func StructToJsonBytes(param interface{}) []byte {
dataType, _ := json.Marshal(param)
return dataType
}
//The incoming parameter must be a pointer //The incoming parameter must be a pointer
func JsonStringToStruct(s string, args interface{}) error { func JsonStringToStruct(s string, args interface{}) error {
err := json.Unmarshal([]byte(s), args) err := json.Unmarshal([]byte(s), args)