tidy code
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
package base_info
|
||||
|
||||
import open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
|
||||
type paramsCommFriend struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
ToUserID string `json:"toUserID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
type AddBlacklistReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type AddBlacklistResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
|
||||
type ImportFriendReq struct {
|
||||
FriendUserIDList []string `json:"friendUserIDList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
}
|
||||
type ImportFriendResp struct {
|
||||
CommResp
|
||||
Data []string `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
type AddFriendReq struct {
|
||||
paramsCommFriend
|
||||
ReqMsg string `json:"reqMsg"`
|
||||
}
|
||||
type AddFriendResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
type AddFriendResponseReq struct {
|
||||
paramsCommFriend
|
||||
Flag int32 `json:"flag" binding:"required"`
|
||||
HandleMsg string `json:"handleMsg"`
|
||||
}
|
||||
type AddFriendResponseResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
|
||||
type DeleteFriendReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type DeleteFriendResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
|
||||
type GetBlackListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type GetBlackListResp struct {
|
||||
CommResp
|
||||
BlackUserInfoList []*blackUserInfo `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
//type PublicUserInfo struct {
|
||||
// UserID string `json:"userID"`
|
||||
// Nickname string `json:"nickname"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// Gender int32 `json:"gender"`
|
||||
//}
|
||||
|
||||
type blackUserInfo struct {
|
||||
open_im_sdk.PublicUserInfo
|
||||
}
|
||||
|
||||
|
||||
type SetFriendCommentReq struct {
|
||||
paramsCommFriend
|
||||
Remark string `json:"remark" binding:"required"`
|
||||
}
|
||||
type SetFriendCommentResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
type RemoveBlackListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type RemoveBlackListResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
type IsFriendReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type IsFriendResp struct {
|
||||
CommResp
|
||||
Response bool `json:"response"`
|
||||
}
|
||||
|
||||
|
||||
type GetFriendsInfoReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type GetFriendsInfoResp struct {
|
||||
CommResp
|
||||
FriendInfoList []*open_im_sdk.FriendInfo `json:"data"`
|
||||
}
|
||||
|
||||
type GetFriendListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type GetFriendListResp struct {
|
||||
CommResp
|
||||
FriendInfoList []*open_im_sdk.FriendInfo `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
type GetFriendApplyListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type GetFriendApplyListResp struct {
|
||||
CommResp
|
||||
FriendRequestList open_im_sdk.FriendRequest `json:"data"`
|
||||
}
|
||||
|
||||
type GetSelfApplyListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
type GetSelfApplyListResp struct {
|
||||
CommResp
|
||||
FriendRequestList open_im_sdk.FriendRequest `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package base_info
|
||||
|
||||
import (
|
||||
pb "Open_IM/pkg/proto/group"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
)
|
||||
|
||||
type CommResp struct {
|
||||
ErrCode int32 `json:"errCode"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
}
|
||||
type Id2Result struct {
|
||||
UserID string `json:"userID"`
|
||||
Result int32 `json:"result"`
|
||||
}
|
||||
|
||||
type KickGroupMemberReq struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
KickedUserIDList []string `json:"kickedUserIDList" binding:"required"`
|
||||
Reason string `json:"reason"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type KickGroupMemberResp struct {
|
||||
CommResp
|
||||
Data []*Id2Result `json:"data"`
|
||||
}
|
||||
|
||||
type GetGroupMembersInfoReq struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
MemberList []string `json:"memberList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type GetGroupMembersInfoResp struct {
|
||||
CommResp
|
||||
Data []*open_im_sdk.GroupMemberFullInfo `json:"data"`
|
||||
}
|
||||
|
||||
type InviteUserToGroupReq struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
InvitedUserIDList []string `json:"uidList" binding:"required"`
|
||||
Reason string `json:"reason"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type InviteUserToGroupResp struct {
|
||||
CommResp
|
||||
Data []Id2Result `json:"data"`
|
||||
}
|
||||
|
||||
type GetJoinedGroupListReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"`
|
||||
}
|
||||
type GetJoinedGroupListResp struct {
|
||||
CommResp
|
||||
Data []*open_im_sdk.GroupInfo `json:"data"`
|
||||
}
|
||||
|
||||
type GetGroupMemberListReq struct {
|
||||
GroupID string `json:"groupID"`
|
||||
Filter int32 `json:"filter"`
|
||||
NextSeq int32 `json:"nextSeq"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
type GetGroupMemberListResp struct {
|
||||
CommResp
|
||||
NextSeq int32 `json:"nextSeq"`
|
||||
Data []*open_im_sdk.GroupMemberFullInfo `json:"data"`
|
||||
}
|
||||
|
||||
type GetGroupAllMemberReq struct {
|
||||
GroupID string `json:"groupID"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
type GetGroupAllMemberResp struct {
|
||||
CommResp
|
||||
Data []*open_im_sdk.GroupMemberFullInfo `json:"data"`
|
||||
}
|
||||
|
||||
type CreateGroupReq struct {
|
||||
MemberList []*pb.GroupAddMemberInfo `json:"memberList"`
|
||||
GroupName string `json:"groupName"`
|
||||
Introduction string `json:"introduction"`
|
||||
Notification string `json:"notification"`
|
||||
FaceUrl string `json:"faceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
GroupType int32 `json:"groupType"`
|
||||
Ex string `json:"ex"`
|
||||
}
|
||||
type CreateGroupResp struct {
|
||||
CommResp
|
||||
Data open_im_sdk.GroupInfo `json:"data"`
|
||||
}
|
||||
|
||||
type GetGroupApplicationListReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
FromUserID string `json:"fromUserID" binding:"required"` //my application
|
||||
}
|
||||
type GetGroupApplicationListResp struct {
|
||||
CommResp
|
||||
Data []*open_im_sdk.GroupRequest `json:"data"`
|
||||
}
|
||||
|
||||
type GetGroupInfoReq struct {
|
||||
GroupIDList []string `json:"groupIDList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type GetGroupInfoResp struct {
|
||||
CommResp
|
||||
Data []open_im_sdk.GroupInfo `json:"data"`
|
||||
}
|
||||
|
||||
type ApplicationGroupResponseReq struct {
|
||||
OperationID string `json:"groupIDList" binding:"required"`
|
||||
GroupID string `json:"groupIDList" binding:"required"`
|
||||
FromUserID string `json:"groupIDList" binding:"required"`
|
||||
HandledMsg string `json:"groupIDList" binding:"required"`
|
||||
HandleResult int32 `json:"groupIDList" binding:"required"`
|
||||
}
|
||||
type ApplicationGroupResponseResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
type JoinGroupReq struct {
|
||||
GroupID string `json:"groupID"`
|
||||
ReqMessage string `json:"reqMessage"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
type JoinGroupResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
type QuitGroupReq struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type QuitGroupResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
type SetGroupInfoReq struct {
|
||||
open_im_sdk.GroupInfo
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
type SetGroupInfoResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
type TransferGroupOwnerReq struct {
|
||||
GroupID string `json:"groupID" binding:"required"`
|
||||
OldOwnerUserID string `json:"oldOwnerUserID" binding:"required"`
|
||||
NewOwnerUserID string `json:"newOwnerUserID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
//package base_info
|
||||
//
|
||||
//type GroupInfo struct {
|
||||
// GroupID string `json:"groupID"`
|
||||
// GroupName string `json:"groupName"`
|
||||
// Notification string `json:"notification"`
|
||||
// Introduction string `json:"introduction"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// OperationID string `json:"operationID"`
|
||||
// OwnerUserID string `json:"ownerUserID"`
|
||||
// CreateTime int64 `json:"createTime"`
|
||||
// MemberCount uint32 `json:"memberCount"`
|
||||
// Ex string `json:"ex"`
|
||||
// Status int32 `json:"status"`
|
||||
// CreatorUserID string `json:"creatorUserID"`
|
||||
// GroupType int32 `json:"groupType"`
|
||||
//}
|
||||
//
|
||||
//type GroupMemberFullInfo struct {
|
||||
// GroupID string `json:"groupID"`
|
||||
// UserID string `json:"userID"`
|
||||
// RoleLevel int32 `json:"roleLevel"`
|
||||
// JoinTime uint64 `json:"joinTime"`
|
||||
// Nickname string `json:"nickname"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// FriendRemark string `json:"friendRemark"`
|
||||
// AppMangerLevel int32 `json:"appMangerLevel"`
|
||||
// JoinSource int32 `json:"joinSource"`
|
||||
// OperatorUserID string `json:"operatorUserID"`
|
||||
// Ex string `json:"ex"`
|
||||
//}
|
||||
//
|
||||
//type PublicUserInfo struct {
|
||||
// UserID string `json:"userID"`
|
||||
// Nickname string `json:"nickname"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// Gender int32 `json:"gender"`
|
||||
//}
|
||||
//
|
||||
//type UserInfo struct {
|
||||
// UserID string `json:"userID"`
|
||||
// Nickname string `json:"nickname"`
|
||||
// FaceUrl string `json:"faceUrl"`
|
||||
// Gender int32 `json:"gender"`
|
||||
// Mobile string `json:"mobile"`
|
||||
// Birth string `json:"birth"`
|
||||
// Email string `json:"email"`
|
||||
// Ex string `json:"ex"`
|
||||
//}
|
||||
//
|
||||
//type FriendInfo struct {
|
||||
// OwnerUserID string `json:"ownerUserID"`
|
||||
// Remark string `json:"remark"`
|
||||
// CreateTime int64 `json:"createTime"`
|
||||
// FriendUser UserInfo `json:"friendUser"`
|
||||
// AddSource int32 `json:"addSource"`
|
||||
// OperatorUserID string `json:"operatorUserID"`
|
||||
// Ex string `json:"ex"`
|
||||
//}
|
||||
//
|
||||
//type BlackInfo struct {
|
||||
// OwnerUserID string `json:"ownerUserID"`
|
||||
// CreateTime int64 `json:"createTime"`
|
||||
// BlackUser PublicUserInfo `json:"friendUser"`
|
||||
// AddSource int32 `json:"addSource"`
|
||||
// OperatorUserID string `json:"operatorUserID"`
|
||||
// Ex string `json:"ex"`
|
||||
//}
|
||||
//
|
||||
//type GroupRequest struct {
|
||||
// UserID string `json:"userID"`
|
||||
// GroupID string `json:"groupID"`
|
||||
// HandleResult string `json:"handleResult"`
|
||||
// ReqMsg string `json:"reqMsg"`
|
||||
// HandleMsg string `json:"handleMsg"`
|
||||
// ReqTime int64 `json:"reqTime"`
|
||||
// HandleUserID string `json:"handleUserID"`
|
||||
// HandleTime int64 `json:"handleTime"`
|
||||
// Ex string `json:"ex"`
|
||||
//}
|
||||
//
|
||||
//type FriendRequest struct {
|
||||
// FromUserID string `json:"fromUserID"`
|
||||
// ToUserID string `json:"toUserID"`
|
||||
// HandleResult int32 `json:"handleResult"`
|
||||
// ReqMessage string `json:"reqMessage"`
|
||||
// CreateTime int64 `json:"createTime"`
|
||||
// HandlerUserID string `json:"handlerUserID"`
|
||||
// HandleMsg string `json:"handleMsg"`
|
||||
// HandleTime int64 `json:"handleTime"`
|
||||
// Ex string `json:"ex"`
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -11,53 +11,60 @@ type ErrInfo struct {
|
||||
var (
|
||||
OK = ErrInfo{0, ""}
|
||||
|
||||
ErrMysql = ErrInfo{100, ""}
|
||||
ErrMongo = ErrInfo{110, ""}
|
||||
ErrRedis = ErrInfo{120, ""}
|
||||
ErrParseToken = ErrInfo{200, "Parse token failed"}
|
||||
ErrCreateToken = ErrInfo{201, "Create token failed"}
|
||||
ErrAppServerKey = ErrInfo{300, "key error"}
|
||||
ErrTencentCredential = ErrInfo{400, ""}
|
||||
// ErrMysql = ErrInfo{100, ""}
|
||||
// ErrMongo = ErrInfo{110, ""}
|
||||
// ErrRedis = ErrInfo{120, ""}
|
||||
ErrParseToken = ErrInfo{200, ParseTokenMsg.Error()}
|
||||
// ErrCreateToken = ErrInfo{201, "Create token failed"}
|
||||
// ErrAppServerKey = ErrInfo{300, "key error"}
|
||||
ErrTencentCredential = ErrInfo{400, ThirdPartyMsg.Error()}
|
||||
|
||||
ErrorUserRegister = ErrInfo{600, "User registration failed"}
|
||||
ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"}
|
||||
ErrUserPassword = ErrInfo{602, "User password error"}
|
||||
ErrRefreshToken = ErrInfo{605, "Failed to refresh token"}
|
||||
ErrAddFriend = ErrInfo{606, "Failed to add friends"}
|
||||
ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"}
|
||||
ErrAddFriendToBlack = ErrInfo{608, "Failed to add friends to the blacklist"}
|
||||
ErrGetBlackList = ErrInfo{609, "Failed to get blacklist"}
|
||||
ErrDeleteFriend = ErrInfo{610, "Failed to delete friend"}
|
||||
ErrGetFriendApplyList = ErrInfo{611, "Failed to get friend application list"}
|
||||
ErrGetFriendList = ErrInfo{612, "Failed to get friend list"}
|
||||
ErrRemoveBlackList = ErrInfo{613, "Failed to remove blacklist"}
|
||||
ErrSearchUserInfo = ErrInfo{614, "Can't find the user information"}
|
||||
ErrDelAppleDeviceToken = ErrInfo{615, ""}
|
||||
ErrModifyUserInfo = ErrInfo{616, "update user some attribute failed"}
|
||||
ErrSetFriendComment = ErrInfo{617, "set friend comment failed"}
|
||||
ErrSearchUserInfoFromTheGroup = ErrInfo{618, "There is no such group or the user not in the group"}
|
||||
ErrCreateGroup = ErrInfo{619, "create group chat failed"}
|
||||
ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"}
|
||||
ErrQuitGroup = ErrInfo{621, "Failed to quit the group"}
|
||||
ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"}
|
||||
ErrParam = ErrInfo{700, "param failed"}
|
||||
ErrTokenExpired = ErrInfo{701, TokenExpired.Error()}
|
||||
ErrTokenInvalid = ErrInfo{702, TokenInvalid.Error()}
|
||||
ErrTokenMalformed = ErrInfo{703, TokenMalformed.Error()}
|
||||
ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYet.Error()}
|
||||
ErrTokenUnknown = ErrInfo{705, TokenUnknown.Error()}
|
||||
// ErrorUserRegister = ErrInfo{600, "User registration failed"}
|
||||
// ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"}
|
||||
// ErrUserPassword = ErrInfo{602, "User password error"}
|
||||
// ErrRefreshToken = ErrInfo{605, "Failed to refresh token"}
|
||||
// ErrAddFriend = ErrInfo{606, "Failed to add friends"}
|
||||
// ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"}
|
||||
// ErrAddFriendToBlack = ErrInfo{608, "Failed to add friends to the blacklist"}
|
||||
// ErrGetBlackList = ErrInfo{609, "Failed to get blacklist"}
|
||||
// ErrDeleteFriend = ErrInfo{610, "Failed to delete friend"}
|
||||
// ErrGetFriendApplyList = ErrInfo{611, "Failed to get friend application list"}
|
||||
// ErrGetFriendList = ErrInfo{612, "Failed to get friend list"}
|
||||
// ErrRemoveBlackList = ErrInfo{613, "Failed to remove blacklist"}
|
||||
// ErrSearchUserInfo = ErrInfo{614, "Can't find the user information"}
|
||||
// ErrDelAppleDeviceToken = ErrInfo{615, ""}
|
||||
// ErrModifyUserInfo = ErrInfo{616, "update user some attribute failed"}
|
||||
// ErrSetFriendComment = ErrInfo{617, "set friend comment failed"}
|
||||
// ErrSearchUserInfoFromTheGroup = ErrInfo{618, "There is no such group or the user not in the group"}
|
||||
// ErrCreateGroup = ErrInfo{619, "create group chat failed"}
|
||||
// ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"}
|
||||
// ErrQuitGroup = ErrInfo{621, "Failed to quit the group"}
|
||||
// ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"}
|
||||
// ErrParam = ErrInfo{700, "param failed"}
|
||||
ErrTokenExpired = ErrInfo{701, TokenExpiredMsg.Error()}
|
||||
ErrTokenInvalid = ErrInfo{702, TokenInvalidMsg.Error()}
|
||||
ErrTokenMalformed = ErrInfo{703, TokenMalformedMsg.Error()}
|
||||
ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYetMsg.Error()}
|
||||
ErrTokenUnknown = ErrInfo{705, TokenUnknownMsg.Error()}
|
||||
|
||||
ErrAccess = ErrInfo{ErrCode: 800, ErrMsg: "no permission"}
|
||||
|
||||
ErrDb = ErrInfo{ErrCode: 900, ErrMsg: "db failed"}
|
||||
ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
|
||||
ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
|
||||
ErrArgs = ErrInfo{ErrCode: 8003, ErrMsg: ArgsMsg.Error()}
|
||||
)
|
||||
|
||||
var (
|
||||
TokenExpired = errors.New("token is timed out, please log in again")
|
||||
TokenInvalid = errors.New("token has been invalidated")
|
||||
TokenNotValidYet = errors.New("token not active yet")
|
||||
TokenMalformed = errors.New("that's not even a token")
|
||||
TokenUnknown = errors.New("couldn't handle this token")
|
||||
ParseTokenMsg = errors.New("parse token failed")
|
||||
TokenExpiredMsg = errors.New("token is timed out, please log in again")
|
||||
TokenInvalidMsg = errors.New("token has been invalidated")
|
||||
TokenNotValidYetMsg = errors.New("token not active yet")
|
||||
TokenMalformedMsg = errors.New("that's not even a token")
|
||||
TokenUnknownMsg = errors.New("couldn't handle this token")
|
||||
|
||||
AccessMsg = errors.New("no permission")
|
||||
DBMsg = errors.New("db failed")
|
||||
ArgsMsg = errors.New("args failed")
|
||||
|
||||
ThirdPartyMsg = errors.New("third party error")
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -67,7 +74,7 @@ const (
|
||||
LogicalError = 10003
|
||||
ServerError = 10004
|
||||
HttpError = 10005
|
||||
IoErrot = 10006
|
||||
IoError = 10006
|
||||
IntentionalError = 10007
|
||||
)
|
||||
|
||||
|
||||
@@ -6,17 +6,13 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func InsertToFriend(ownerId, friendId string, flag int32) error {
|
||||
func InsertToFriend(toInsertFollow *Friend) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toInsertFollow := Friend{
|
||||
OwnerUserID: ownerId,
|
||||
FriendUserID: friendId,
|
||||
FriendFlag: flag,
|
||||
CreateTime: time.Now(),
|
||||
}
|
||||
toInsertFollow.CreateTime = time.Now()
|
||||
|
||||
err = dbConn.Table("friend").Create(toInsertFollow).Error
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -24,46 +20,56 @@ func InsertToFriend(ownerId, friendId string, flag int32) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindFriendRelationshipFromFriend(ownerId, friendId string) (*Friend, error) {
|
||||
func FindFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*Friend, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var friend Friend
|
||||
err = dbConn.Table("friend").Where("owner_id=? and friend_id=?", ownerId, friendId).Find(&friend).Error
|
||||
err = dbConn.Table("friend").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Find(&friend).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &friend, err
|
||||
}
|
||||
|
||||
func FindUserInfoFromFriend(ownerId string) ([]Friend, error) {
|
||||
func FindUserInfoFromFriend(OwnerUserID string) ([]Friend, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var friends []Friend
|
||||
err = dbConn.Table("friend").Where("owner_id=?", ownerId).Find(&friends).Error
|
||||
err = dbConn.Table("friend").Where("owner_user_id=?", OwnerUserID).Find(&friends).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return friends, nil
|
||||
}
|
||||
|
||||
func UpdateFriendComment(ownerId, friendId, comment string) error {
|
||||
func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("update friend set comment=? where owner_id=? and friend_id=?", comment, ownerId, friendId).Error
|
||||
err = dbConn.Exec("update friend set remark=? where owner_user_id=? and friend_user_id=?", Remark, OwnerUserID, FriendUserID).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteSingleFriendInfo(ownerId, friendId string) error {
|
||||
func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Table("friend").Where("owner_id=? and friend_id=?", ownerId, friendId).Delete(Friend{}).Error
|
||||
err = dbConn.Table("friend").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(Friend{}).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//type Friend struct {
|
||||
// OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"`
|
||||
// FriendUserID string `gorm:"column:friend_user_id;primaryKey;"`
|
||||
// Remark string `gorm:"column:remark"`
|
||||
// CreateTime time.Time `gorm:"column:create_time"`
|
||||
// AddSource int32 `gorm:"column:add_source"`
|
||||
// OperatorUserID string `gorm:"column:operator_user_id"`
|
||||
// Ex string `gorm:"column:ex"`
|
||||
//}
|
||||
|
||||
@@ -2,43 +2,42 @@ package im_mysql_model
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/db"
|
||||
"time"
|
||||
)
|
||||
|
||||
// reqId add userId
|
||||
func ReplaceIntoFriendReq(reqId, userId string, flag int32, reqMessage string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("replace into friend_request(req_id,user_id,flag,req_message,create_time) values(?,?,?,?,?)", reqId, userId, flag, reqMessage, time.Now()).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
//type FriendRequest struct {
|
||||
// FromUserID string `gorm:"column:from_user_id;primaryKey;"`
|
||||
// ToUserID string `gorm:"column:to_user_id;primaryKey;"`
|
||||
// HandleResult int32 `gorm:"column:handle_result"`
|
||||
// ReqMessage string `gorm:"column:req_message"`
|
||||
// CreateTime time.Time `gorm:"column:create_time"`
|
||||
// HandlerUserID string `gorm:"column:handler_user_id"`
|
||||
// HandleMsg string `gorm:"column:handle_msg"`
|
||||
// HandleTime time.Time `gorm:"column:handle_time"`
|
||||
// Ex string `gorm:"column:ex"`
|
||||
//}
|
||||
|
||||
func FindFriendsApplyFromFriendReq(userId string) ([]FriendRequest, error) {
|
||||
// who apply to add me
|
||||
func GetReceivedFriendsApplicationListByUserID(ToUserID string) ([]FriendRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var usersInfo []FriendRequest
|
||||
//dbConn.LogMode(true)
|
||||
err = dbConn.Table("friend_request").Where("user_id=?", userId).Find(&usersInfo).Error
|
||||
err = dbConn.Table("friend_request").Where("to_user_id=?", ToUserID).Find(&usersInfo).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return usersInfo, nil
|
||||
}
|
||||
|
||||
func FindSelfApplyFromFriendReq(userId string) ([]FriendRequest, error) {
|
||||
//I apply to add somebody
|
||||
func GetSendFriendApplicationListByUserID(FromUserID string) ([]FriendRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var usersInfo []FriendRequest
|
||||
err = dbConn.Table("friend_request").Where("req_id=?", userId).Find(&usersInfo).Error
|
||||
err = dbConn.Table("friend_request").Where("from_user_id=?", FromUserID).Find(&usersInfo).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -46,26 +45,25 @@ func FindSelfApplyFromFriendReq(userId string) ([]FriendRequest, error) {
|
||||
}
|
||||
|
||||
//reqId apply to add userId already
|
||||
func FindFriendApplyFromFriendReqByUid(reqId, userId string) (*FriendRequest, error) {
|
||||
func FindFriendApplicationByBothUserID(FromUserId, ToUserID string) (*FriendRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var friendRequest FriendRequest
|
||||
err = dbConn.Table("friend_request").Where("req_id=? and user_id=?", reqId, userId).Find(&friendRequest).Error
|
||||
err = dbConn.Table("friend_request").Where("from_user_id=? and to_user_id=?", FromUserId, ToUserID).Find(&friendRequest).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &friendRequest, nil
|
||||
}
|
||||
|
||||
//userId process reqId
|
||||
func UpdateFriendRelationshipToFriendReq(reqId, userId string, flag int32) error {
|
||||
func UpdateFriendApplication(friendRequest FriendRequest) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("update friend_request set flag=? where req_id=? and user_id=?", flag, reqId, userId).Error
|
||||
err = dbConn.Table("friend_request").Where("from_user_id=? and to_user_id=?", friendRequest.FromUserID, friendRequest.ToUserID).Update(&friendRequest).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,15 +2,25 @@ package im_mysql_model
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/db"
|
||||
"time"
|
||||
)
|
||||
|
||||
func InsertIntoGroupMember(groupId, uid, nickName, userGroupFaceUrl string, administratorLevel int32) error {
|
||||
//type GroupMember struct {
|
||||
// GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
// UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
// NickName string `gorm:"column:nickname"`
|
||||
// FaceUrl string `gorm:"user_group_face_url"`
|
||||
// RoleLevel int32 `gorm:"column:role_level"`
|
||||
// JoinTime time.Time `gorm:"column:join_time"`
|
||||
// JoinSource int32 `gorm:"column:join_source"`
|
||||
// OperatorUserID string `gorm:"column:operator_user_id"`
|
||||
// Ex string `gorm:"column:ex"`
|
||||
//}
|
||||
|
||||
func InsertIntoGroupMember(toInsertInfo GroupMember) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toInsertInfo := GroupMember{GroupID: groupId, UserID: uid, NickName: nickName, AdministratorLevel: administratorLevel, JoinTime: time.Now(), FaceUrl: userGroupFaceUrl}
|
||||
err = dbConn.Table("group_member").Create(toInsertInfo).Error
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -18,154 +28,154 @@ func InsertIntoGroupMember(groupId, uid, nickName, userGroupFaceUrl string, admi
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindGroupMemberListByUserId(uid string) ([]GroupMember, error) {
|
||||
func GetGroupMemberListByUserID(userID string) ([]GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMemberList []GroupMember
|
||||
err = dbConn.Raw("select * from `group_member` where uid=?", uid).Find(&groupMemberList).Error
|
||||
err = dbConn.Table("group_member").Where("user_id=?", userID).Find(&groupMemberList).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return groupMemberList, nil
|
||||
}
|
||||
|
||||
func FindGroupMemberListByGroupId(groupId string) ([]GroupMember, error) {
|
||||
func GetGroupMemberListByGroupID(groupID string) ([]GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMemberList []GroupMember
|
||||
err = dbConn.Raw("select * from `group_member` where group_id=?", groupId).Find(&groupMemberList).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=?", groupID).Find(&groupMemberList).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return groupMemberList, nil
|
||||
}
|
||||
|
||||
func FindGroupMemberListByGroupIdAndFilterInfo(groupId string, filter int32) ([]GroupMember, error) {
|
||||
func GetGroupMemberListByGroupIDAndFilter(groupID string, filter int32) ([]GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
dbConn.LogMode(true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMemberList []GroupMember
|
||||
err = dbConn.Raw("select * from `group_member` where group_id=? and administrator_level=?", groupId, filter).Find(&groupMemberList).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=? and role_level=?", groupID, filter).Find(&groupMemberList).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return groupMemberList, nil
|
||||
}
|
||||
func FindGroupMemberInfoByGroupIdAndUserId(groupId, uid string) (*GroupMember, error) {
|
||||
|
||||
func GetGroupMemberInfoByGroupIDAndUserID(groupID, userID string) (*GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMember GroupMember
|
||||
err = dbConn.Raw("select * from `group_member` where group_id=? and uid=? limit 1", groupId, uid).Find(&groupMember).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=? and user_id=? limit 1", groupID, userID).Find(&groupMember).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &groupMember, nil
|
||||
}
|
||||
|
||||
func DeleteGroupMemberByGroupIdAndUserId(groupId, uid string) error {
|
||||
func DeleteGroupMemberByGroupIDAndUserID(groupID, userID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("delete from `group_member` where group_id=? and uid=?", groupId, uid).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=? and user_id=? limit 1", groupID, userID).Delete(&GroupMember{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func UpdateOwnerGroupNickName(groupId, userId, groupNickName string) error {
|
||||
func UpdateGroupMemberInfo(groupMemberInfo GroupMember) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("update `group_member` set nickname=? where group_id=? and uid=?", groupNickName, groupId, userId).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=? and user_id=?", groupMemberInfo.GroupID, groupMemberInfo.UserID).Update(&groupMemberInfo).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SelectGroupList(groupID string) ([]string, error) {
|
||||
var groupUserID string
|
||||
var groupList []string
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return groupList, err
|
||||
}
|
||||
|
||||
rows, err := dbConn.Model(&GroupMember{}).Where("group_id = ?", groupID).Select("user_id").Rows()
|
||||
if err != nil {
|
||||
return groupList, err
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
rows.Scan(&groupUserID)
|
||||
groupList = append(groupList, groupUserID)
|
||||
}
|
||||
return groupList, nil
|
||||
}
|
||||
|
||||
func UpdateTheUserAdministratorLevel(groupId, uid string, administratorLevel int64) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("update `group_member` set administrator_level=? where group_id=? and uid=?", administratorLevel, groupId, uid).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetOwnerManagerByGroupId(groupId string) ([]GroupMember, error) {
|
||||
func GetOwnerManagerByGroupID(groupID string) ([]GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMemberList []GroupMember
|
||||
err = dbConn.Raw("select * from `group_member` where group_id=? and administrator_level > 0", groupId).Find(&groupMemberList).Error
|
||||
err = dbConn.Table("group_member").Where("group_id=? and role_level>0", groupID).Find(&groupMemberList).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return groupMemberList, nil
|
||||
}
|
||||
|
||||
func IsExistGroupMember(groupId, uid string) bool {
|
||||
func GetGroupMemberNumByGroupID(groupID string) int32 {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
var number int32
|
||||
err = dbConn.Table("group_member").Where("group_id=?", groupID).Count(&number).Error
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return number
|
||||
}
|
||||
|
||||
func GetGroupOwnerInfoByGroupID(groupID string) (*GroupMember, error) {
|
||||
omList, err := GetOwnerManagerByGroupID(groupID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range omList {
|
||||
if v.RoleLevel == 1 {
|
||||
return &v, nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func IsExistGroupMember(groupID, userID string) bool {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
var number int32
|
||||
err = dbConn.Raw("select count(*) from `group_member` where group_id = ? and uid = ?", groupId, uid).Count(&number).Error
|
||||
err = dbConn.Table("group_member").Where("group_id = ? and user_id = ?", groupID, userID).Count(&number).Error
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if number != 1 {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func RemoveGroupMember(groupId string, memberId string) error {
|
||||
return DeleteGroupMemberByGroupIdAndUserId(groupId, memberId)
|
||||
func RemoveGroupMember(groupID string, UserID string) error {
|
||||
return DeleteGroupMemberByGroupIDAndUserID(groupID, UserID)
|
||||
}
|
||||
|
||||
func GetMemberInfoById(groupId string, memberId string) (*GroupMember, error) {
|
||||
return FindGroupMemberInfoByGroupIdAndUserId(groupId, memberId)
|
||||
func GetMemberInfoByID(groupID string, userID string) (*GroupMember, error) {
|
||||
return GetGroupMemberInfoByGroupIDAndUserID(groupID, userID)
|
||||
}
|
||||
|
||||
func GetGroupMemberByGroupId(groupId string, filter int32, begin int32, maxNumber int32) ([]GroupMember, error) {
|
||||
memberList, err := FindGroupMemberListByGroupId(groupId) //sorted by join time
|
||||
func GetGroupMemberByGroupID(groupID string, filter int32, begin int32, maxNumber int32) ([]GroupMember, error) {
|
||||
var memberList []GroupMember
|
||||
var err error
|
||||
if filter >= 0 {
|
||||
memberList, err = GetGroupMemberListByGroupIDAndFilter(groupID, filter) //sorted by join time
|
||||
} else {
|
||||
memberList, err = GetGroupMemberListByGroupID(groupID)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -182,49 +192,35 @@ func GetGroupMemberByGroupId(groupId string, filter int32, begin int32, maxNumbe
|
||||
return memberList[begin:end], nil
|
||||
}
|
||||
|
||||
func GetJoinedGroupIdListByMemberId(memberId string) ([]GroupMember, error) {
|
||||
return FindGroupMemberListByUserId(memberId)
|
||||
}
|
||||
|
||||
func GetGroupMemberNumByGroupId(groupId string) int32 {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
var number int32
|
||||
err = dbConn.Raw("select count(*) from `group_member` where group_id=? ", groupId).Count(&number).Error
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return number
|
||||
}
|
||||
|
||||
func GetGroupOwnerByGroupId(groupId string) string {
|
||||
omList, err := GetOwnerManagerByGroupId(groupId)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
for _, v := range omList {
|
||||
if v.AdministratorLevel == 1 {
|
||||
return v.UserID
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func GetGroupOwnerInfoByGroupId(groupId string) (*GroupMember, error) {
|
||||
omList, err := GetOwnerManagerByGroupId(groupId)
|
||||
func GetJoinedGroupIDListByUserID(userID string) ([]string, error) {
|
||||
memberList, err := GetGroupMemberListByUserID(userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range omList {
|
||||
if v.AdministratorLevel == 1 {
|
||||
return v, nil
|
||||
}
|
||||
var groupIDList []string = make([]string, len(memberList))
|
||||
for _, v := range memberList {
|
||||
groupIDList = append(groupIDList, v.GroupID)
|
||||
}
|
||||
return nil, nil
|
||||
return groupIDList, nil
|
||||
}
|
||||
|
||||
func InsertGroupMember(groupId, userId, nickName, userFaceUrl string, role int32) error {
|
||||
return InsertIntoGroupMember(groupId, userId, nickName, userFaceUrl, role)
|
||||
}
|
||||
//
|
||||
//func SelectGroupList(groupID string) ([]string, error) {
|
||||
// var groupUserID string
|
||||
// var groupList []string
|
||||
// dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
// if err != nil {
|
||||
// return groupList, err
|
||||
// }
|
||||
//
|
||||
// rows, err := dbConn.Model(&GroupMember{}).Where("group_id = ?", groupID).Select("user_id").Rows()
|
||||
// if err != nil {
|
||||
// return groupList, err
|
||||
// }
|
||||
// defer rows.Close()
|
||||
// for rows.Next() {
|
||||
// rows.Scan(&groupUserID)
|
||||
// groupList = append(groupList, groupUserID)
|
||||
// }
|
||||
// return groupList, nil
|
||||
//}
|
||||
|
||||
@@ -8,17 +8,16 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func InsertIntoGroup(groupId, name, introduction, notification, faceUrl, ex string) error {
|
||||
func InsertIntoGroup(groupInfo Group) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//Default group name
|
||||
if name == "" {
|
||||
name = "Group Chat"
|
||||
if groupInfo.GroupName == "" {
|
||||
groupInfo.GroupName = "Group Chat"
|
||||
}
|
||||
toInsertInfo := Group{GroupID: groupId, GroupName: name, Introduction: introduction, Notification: notification, FaceUrl: faceUrl, CreateTime: time.Now(), Ex: ex}
|
||||
err = dbConn.Table("group").Create(toInsertInfo).Error
|
||||
groupInfo.CreateTime = time.Now()
|
||||
err = dbConn.Table("group").Create(groupInfo).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -164,7 +163,7 @@ func GetGroupApplicationList(uid string) (*group.GetGroupApplicationListResp, er
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.CommonResp, error) {
|
||||
func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.TransferGroupOwnerResp, error) {
|
||||
oldOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OldOwnerUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -187,7 +186,7 @@ func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.CommonResp, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.CommonResp{}, nil
|
||||
return &group.TransferGroupOwnerResp{CommonResp: &group.CommonResp{ErrCode: 0}}, nil
|
||||
}
|
||||
|
||||
func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.CommonResp, error) {
|
||||
|
||||
@@ -2,69 +2,82 @@ package im_mysql_model
|
||||
|
||||
import "time"
|
||||
|
||||
type User struct {
|
||||
UserID string `gorm:"column:uid;primaryKey;"`
|
||||
Nickname string `gorm:"column:name"`
|
||||
FaceUrl string `gorm:"column:icon"`
|
||||
Gender int32 `gorm:"column:gender"`
|
||||
Mobile string `gorm:"column:mobile"`
|
||||
Birth string `gorm:"column:birth"`
|
||||
Email string `gorm:"column:email"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
type Friend struct {
|
||||
OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"`
|
||||
FriendUserID string `gorm:"column:friend_user_id;primaryKey;"`
|
||||
Remark string `gorm:"column:remark"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
AddSource int32 `gorm:"column:add_source"`
|
||||
OperatorUserID string `gorm:"column:operator_user_id"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
type Friend struct {
|
||||
OwnerUserID string `gorm:"column:owner_id"`
|
||||
FriendUserID string `gorm:"column:friend_id"`
|
||||
Remark string `gorm:"column:comment"`
|
||||
FriendFlag int32 `gorm:"column:friend_flag"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
type FriendRequest struct {
|
||||
ReqID string `gorm:"column:req_id"`
|
||||
UserID string `gorm:"column:user_id"`
|
||||
Flag int32 `gorm:"column:flag"`
|
||||
ReqMessage string `gorm:"column:req_message"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
type BlackList struct {
|
||||
OwnerUserID string `gorm:"column:owner_id"`
|
||||
BlockUserID string `gorm:"column:block_id"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
FromUserID string `gorm:"column:from_user_id;primaryKey;"`
|
||||
ToUserID string `gorm:"column:to_user_id;primaryKey;"`
|
||||
HandleResult int32 `gorm:"column:handle_result"`
|
||||
ReqMessage string `gorm:"column:req_message"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
HandlerUserID string `gorm:"column:handler_user_id"`
|
||||
HandleMsg string `gorm:"column:handle_msg"`
|
||||
HandleTime time.Time `gorm:"column:handle_time"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
GroupID string `gorm:"column:group_id"`
|
||||
GroupName string `gorm:"column:name"`
|
||||
Introduction string `gorm:"column:introduction"`
|
||||
Notification string `gorm:"column:notification"`
|
||||
FaceUrl string `gorm:"column:face_url"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
Ext string `gorm:"column:ex"`
|
||||
GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
GroupName string `gorm:"column:name"`
|
||||
Introduction string `gorm:"column:introduction"`
|
||||
Notification string `gorm:"column:notification"`
|
||||
FaceUrl string `gorm:"column:face_url"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
Status int32 `gorm:"column:status"`
|
||||
CreatorUserID string `gorm:"column:creator_user_id"`
|
||||
GroupType int32 `gorm:"column:group_type"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
type GroupMember struct {
|
||||
GroupID string `gorm:"column:group_id"`
|
||||
UserID string `gorm:"column:uid"`
|
||||
NickName string `gorm:"column:nickname"`
|
||||
AdministratorLevel int32 `gorm:"column:administrator_level"`
|
||||
JoinTime time.Time `gorm:"column:join_time"`
|
||||
FaceUrl string `gorm:"user_group_face_url"`
|
||||
GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
NickName string `gorm:"column:nickname"`
|
||||
FaceUrl string `gorm:"user_group_face_url"`
|
||||
RoleLevel int32 `gorm:"column:role_level"`
|
||||
JoinTime time.Time `gorm:"column:join_time"`
|
||||
JoinSource int32 `gorm:"column:join_source"`
|
||||
OperatorUserID string `gorm:"column:operator_user_id"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
type GroupRequest struct {
|
||||
ID string `gorm:"column:id"`
|
||||
GroupID string `gorm:"column:group_id"`
|
||||
FromUserID string `gorm:"column:from_user_id"`
|
||||
ToUserID string `gorm:"column:to_user_id"`
|
||||
Flag int32 `gorm:"column:flag"`
|
||||
ReqMsg string `gorm:"column:req_msg"`
|
||||
HandledMsg string `gorm:"column:handled_msg"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
FromUserNickname string `gorm:"from_user_nickname"`
|
||||
ToUserNickname string `gorm:"to_user_nickname"`
|
||||
FromUserFaceUrl string `gorm:"from_user_face_url"`
|
||||
ToUserFaceUrl string `gorm:"to_user_face_url"`
|
||||
HandledUser string `gorm:"handled_user"`
|
||||
UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
HandleResult string `gorm:"column:handle_result"`
|
||||
ReqMsg string `gorm:"column:req_msg"`
|
||||
HandledMsg string `gorm:"column:handled_msg"`
|
||||
ReqTime time.Time `gorm:"column:req_time"`
|
||||
HandleUserID string `gorm:"column:handle_user_id"`
|
||||
HandledTime time.Time `gorm:"column:handle_time"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
Nickname string `gorm:"column:name"`
|
||||
FaceUrl string `gorm:"column:icon"`
|
||||
Gender int32 `gorm:"column:gender"`
|
||||
PhoneNumber string `gorm:"column:phone_number"`
|
||||
Birth string `gorm:"column:birth"`
|
||||
Email string `gorm:"column:email"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
type BlackList struct {
|
||||
OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"`
|
||||
BlockUserID string `gorm:"column:block_user_id;primaryKey;"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
AddSource int32 `gorm:"column:add_source"`
|
||||
OperatorUserID int32 `gorm:"column:operator_user_id"`
|
||||
Ex string `gorm:"column:ex"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
syntax = "proto3";
|
||||
package base;
|
||||
|
||||
|
||||
|
||||
+540
-370
File diff suppressed because it is too large
Load Diff
@@ -15,29 +15,26 @@ message CommID{
|
||||
string FromUserID = 5;
|
||||
}
|
||||
|
||||
|
||||
message GetFriendsInfoReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message GetFriendInfoResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
FriendInfo Data = 3;
|
||||
}
|
||||
|
||||
message FriendInfo{
|
||||
string OwnerUserID = 1;
|
||||
string Remark = 2;
|
||||
uint64 CreateTime = 3;
|
||||
open_im_sdk.UserInfo FriendUser = 4;
|
||||
int32 IsBlack = 5;
|
||||
repeated open_im_sdk.FriendInfo FriendInfoList = 3;
|
||||
// int32 IsBlack = 4;
|
||||
}
|
||||
|
||||
|
||||
message AddFriendReq{
|
||||
CommID CommID = 1;
|
||||
string ReqMessage = 2;
|
||||
string ReqMsg = 2;
|
||||
}
|
||||
message AddFriendResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
message ImportFriendReq{
|
||||
repeated string FriendUserIDList = 1;
|
||||
@@ -45,108 +42,124 @@ message ImportFriendReq{
|
||||
string FromUserID = 3;
|
||||
string OpUserID = 4;
|
||||
}
|
||||
|
||||
message ImportFriendResp{
|
||||
CommonResp commonResp = 1;
|
||||
repeated string failedUidList = 2;
|
||||
CommonResp CommonResp = 1;
|
||||
repeated string FailedFriendUserIDList = 2;
|
||||
}
|
||||
|
||||
message GetFriendApplyReq{
|
||||
|
||||
message GetFriendApplyListReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
message GetFriendApplyResp{
|
||||
message GetFriendApplyListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated ApplyUserInfo data = 4;
|
||||
}
|
||||
|
||||
message ApplyUserInfo{
|
||||
open_im_sdk.PublicUserInfo UserInfo = 1;
|
||||
int64 applyTime = 2;
|
||||
string reqMessage = 3;
|
||||
int32 Flag = 4;
|
||||
repeated open_im_sdk.FriendRequest FriendRequestList = 3;
|
||||
}
|
||||
|
||||
|
||||
message getFriendListReq{
|
||||
message GetFriendListReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message getFriendListResp{
|
||||
message GetFriendListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated FriendInfo Data = 3;
|
||||
repeated open_im_sdk.FriendInfo FriendInfoList = 3;
|
||||
}
|
||||
|
||||
|
||||
message AddBlacklistReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
message AddBlacklistResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
message RemoveBlacklistReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message RemoveBlacklistResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
message GetBlacklistReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message GetBlacklistResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated open_im_sdk.PublicUserInfo data = 3;
|
||||
repeated open_im_sdk.PublicUserInfo BlackUserInfoList = 3;
|
||||
}
|
||||
|
||||
|
||||
message IsFriendReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message IsFriendResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
int32 ShipType = 3;
|
||||
bool Response = 3;
|
||||
}
|
||||
|
||||
|
||||
message IsInBlackListReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
|
||||
message IsInBlackListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
bool Response = 3;
|
||||
}
|
||||
|
||||
|
||||
message DeleteFriendReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
message DeleteFriendResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
//process
|
||||
message AddFriendResponseReq{
|
||||
CommID CommID = 1;
|
||||
int32 flag = 2;
|
||||
string handleMsg = 3;
|
||||
}
|
||||
message AddFriendResponseResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
message SetFriendCommentReq{
|
||||
CommID CommID = 1;
|
||||
string Remark = 2;
|
||||
}
|
||||
message SetFriendCommentResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
message GetSelfApplyListReq{
|
||||
CommID CommID = 1;
|
||||
}
|
||||
message GetSelfApplyListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
repeated open_im_sdk.FriendRequest FriendRequestList = 3;
|
||||
}
|
||||
|
||||
service friend{
|
||||
rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp);
|
||||
rpc addFriend(AddFriendReq) returns(CommonResp);
|
||||
rpc getFriendApplyList(GetFriendApplyReq) returns(GetFriendApplyResp);
|
||||
rpc getSelfApplyList(GetFriendApplyReq) returns(GetFriendApplyResp);
|
||||
rpc getFriendList(getFriendListReq) returns(getFriendListResp);
|
||||
rpc addBlacklist(AddBlacklistReq) returns(CommonResp);
|
||||
rpc removeBlacklist(RemoveBlacklistReq) returns(CommonResp);
|
||||
// rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp);
|
||||
rpc addFriend(AddFriendReq) returns(AddFriendResp);
|
||||
rpc getFriendApplyList(GetFriendApplyListReq) returns(GetFriendApplyListResp);
|
||||
rpc getSelfApplyList(GetSelfApplyListReq) returns(GetSelfApplyListResp);
|
||||
rpc getFriendList(GetFriendListReq) returns(GetFriendListResp);
|
||||
rpc addBlacklist(AddBlacklistReq) returns(AddBlacklistResp);
|
||||
rpc removeBlacklist(RemoveBlacklistReq) returns(RemoveBlacklistResp);
|
||||
rpc isFriend(IsFriendReq) returns(IsFriendResp);
|
||||
rpc isInBlackList(IsInBlackListReq) returns(IsInBlackListResp);
|
||||
rpc getBlacklist(GetBlacklistReq) returns(GetBlacklistResp);
|
||||
rpc deleteFriend(DeleteFriendReq) returns(CommonResp);
|
||||
rpc addFriendResponse(AddFriendResponseReq) returns(CommonResp);
|
||||
rpc setFriendComment(SetFriendCommentReq) returns(CommonResp);
|
||||
rpc ImportFriend(ImportFriendReq) returns(ImportFriendResp);
|
||||
rpc deleteFriend(DeleteFriendReq) returns(DeleteFriendResp);
|
||||
rpc addFriendResponse(AddFriendResponseReq) returns(AddFriendResponseResp);
|
||||
rpc setFriendComment(SetFriendCommentReq) returns(SetFriendCommentResp);
|
||||
rpc importFriend(ImportFriendReq) returns(ImportFriendResp);
|
||||
}
|
||||
+330
-476
File diff suppressed because it is too large
Load Diff
+35
-67
@@ -10,33 +10,29 @@ message CommonResp{
|
||||
|
||||
message GroupAddMemberInfo{
|
||||
string UserID = 1;
|
||||
int32 Role = 2;
|
||||
int32 RoleLevel = 2;
|
||||
}
|
||||
|
||||
|
||||
message CreateGroupReq{
|
||||
repeated GroupAddMemberInfo InitMemberList = 1; //
|
||||
string GroupName = 2;
|
||||
string Introduction = 3;
|
||||
string Notification = 4;
|
||||
string FaceUrl = 5;
|
||||
string Ext = 6;
|
||||
string OperationID = 7;
|
||||
string OpUserID = 8; //app manager or group owner
|
||||
string FromUserID = 9;
|
||||
repeated GroupAddMemberInfo InitMemberList = 1;
|
||||
open_im_sdk.GroupInfo GroupInfo = 2;
|
||||
string OperationID = 3;
|
||||
string OpUserID = 4; //app manager or group owner
|
||||
string OwnerUserID = 5; //owner
|
||||
}
|
||||
|
||||
message CreateGroupResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
open_im_sdk.GroupInfo GroupInfo = 3;
|
||||
}
|
||||
|
||||
|
||||
message GetGroupsInfoReq{
|
||||
repeated string GroupIDList = 1;
|
||||
string OperationID = 2;
|
||||
string OpUserID = 3; //No verification permission
|
||||
}
|
||||
|
||||
message GetGroupsInfoResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
@@ -49,44 +45,23 @@ message SetGroupInfoReq{
|
||||
string OpUserID = 2; //app manager or group owner
|
||||
string OperationID = 3;
|
||||
}
|
||||
message SetGroupInfoResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
message GetGroupApplicationListReq {
|
||||
string OpUserID = 1; //app manager or group owner(manager)
|
||||
string OperationID = 2;
|
||||
string FromUserID = 3; //owner or manager (Received)
|
||||
string FromUserID = 3; //owner or manager
|
||||
}
|
||||
|
||||
message GetGroupApplicationList_Data_User {
|
||||
string ID = 1;
|
||||
string GroupID = 2;
|
||||
string FromUserID = 3;
|
||||
string ToUserID = 4;
|
||||
int32 Flag = 5;
|
||||
string RequestMsg = 6;
|
||||
string HandledMsg = 7;
|
||||
int64 AddTime = 8;
|
||||
string FromUserNickname = 9;
|
||||
string ToUserNickname = 10;
|
||||
string FromUserFaceUrl = 11;
|
||||
string ToUserFaceUrl = 12;
|
||||
string HandledUser = 13;
|
||||
int32 Type = 14;
|
||||
int32 HandleStatus = 15;
|
||||
int32 HandleResult = 16;
|
||||
}
|
||||
|
||||
message GetGroupApplicationListData {
|
||||
int32 Count = 1;
|
||||
repeated GetGroupApplicationList_Data_User User = 2;
|
||||
}
|
||||
|
||||
message GetGroupApplicationListResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
GetGroupApplicationListData Data = 3;
|
||||
repeated open_im_sdk.GroupRequest GroupRequestList = 3;
|
||||
}
|
||||
|
||||
|
||||
message TransferGroupOwnerReq {
|
||||
string GroupID = 1;
|
||||
string OldOwnerUserID = 2;
|
||||
@@ -94,7 +69,9 @@ message TransferGroupOwnerReq {
|
||||
string OperationID = 4;
|
||||
string OpUserID = 5; //app manager or group owner
|
||||
}
|
||||
|
||||
message TransferGroupOwnerResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
message JoinGroupReq{
|
||||
string GroupID = 1;
|
||||
@@ -102,35 +79,33 @@ message JoinGroupReq{
|
||||
string OpUserID = 3;
|
||||
string OperationID = 4;
|
||||
}
|
||||
message JoinGroupResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
message GroupApplicationResponseReq{
|
||||
string OperationID = 1;
|
||||
string OpUserID = 2;
|
||||
string GroupID = 3;
|
||||
string FromUserID = 4; //请求加群:请求者,邀请加群:邀请人
|
||||
string ToUserID = 5; //请求加群:0,邀请加群:被邀请人
|
||||
int64 AddTime = 6;
|
||||
string HandledMsg = 7;
|
||||
int32 HandleResult = 8;
|
||||
string FromUserID = 4; //
|
||||
string HandledMsg = 5;
|
||||
int32 HandleResult = 6;
|
||||
}
|
||||
message GroupApplicationResponseResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
message SetOwnerGroupNickNameReq{
|
||||
string GroupID = 1;
|
||||
string Nickname = 2;
|
||||
string OperationID = 3;
|
||||
string FromUserID = 4;
|
||||
string OpUserID = 5; //app manger or FromUserID
|
||||
}
|
||||
|
||||
|
||||
message QuitGroupReq{
|
||||
string GroupID = 1;
|
||||
string OperationID = 2;
|
||||
string OpUserID = 3;
|
||||
}
|
||||
message QuitGroupResp{
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -150,7 +125,6 @@ message GetGroupMemberListResp {
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetGroupMembersInfoReq {
|
||||
string GroupID = 1;
|
||||
repeated string memberList = 2;
|
||||
@@ -189,8 +163,6 @@ message GetJoinedGroupListReq {
|
||||
string operationID = 2;
|
||||
string OpUserID = 3; //app manager or FromUserID
|
||||
}
|
||||
|
||||
|
||||
message GetJoinedGroupListResp{
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
@@ -205,7 +177,6 @@ message InviteUserToGroupReq {
|
||||
repeated string InvitedUserIDList = 5;
|
||||
string OpUserID = 6; //group member or app manager
|
||||
}
|
||||
|
||||
message InviteUserToGroupResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
@@ -218,7 +189,6 @@ message GetGroupAllMemberReq {
|
||||
string OpUserID = 2; //No verification permission
|
||||
string OperationID = 3;
|
||||
}
|
||||
|
||||
message GetGroupAllMemberResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
@@ -229,20 +199,18 @@ message GetGroupAllMemberResp {
|
||||
|
||||
service group{
|
||||
rpc createGroup(CreateGroupReq) returns(CreateGroupResp);
|
||||
rpc joinGroup(JoinGroupReq) returns(CommonResp);
|
||||
rpc quitGroup(QuitGroupReq) returns(CommonResp);
|
||||
rpc joinGroup(JoinGroupReq) returns(JoinGroupResp);
|
||||
rpc quitGroup(QuitGroupReq) returns(QuitGroupResp);
|
||||
rpc getGroupsInfo(GetGroupsInfoReq) returns(GetGroupsInfoResp);
|
||||
rpc setGroupInfo(SetGroupInfoReq) returns(CommonResp);
|
||||
rpc setGroupInfo(SetGroupInfoReq) returns(SetGroupInfoResp);
|
||||
rpc getGroupApplicationList(GetGroupApplicationListReq) returns(GetGroupApplicationListResp);
|
||||
rpc transferGroupOwner(TransferGroupOwnerReq) returns(CommonResp);
|
||||
rpc groupApplicationResponse(GroupApplicationResponseReq) returns(CommonResp);
|
||||
// rpc setOwnerGroupNickName(SetOwnerGroupNickNameReq) returns(CommonResp);
|
||||
rpc transferGroupOwner(TransferGroupOwnerReq) returns(TransferGroupOwnerResp);
|
||||
rpc groupApplicationResponse(GroupApplicationResponseReq) returns(GroupApplicationResponseResp);
|
||||
rpc getGroupMemberList(GetGroupMemberListReq) returns(GetGroupMemberListResp);
|
||||
rpc getGroupMembersInfo(GetGroupMembersInfoReq) returns(GetGroupMembersInfoResp);
|
||||
rpc kickGroupMember(KickGroupMemberReq) returns (KickGroupMemberResp);
|
||||
rpc getJoinedGroupList(GetJoinedGroupListReq) returns (GetJoinedGroupListResp);
|
||||
rpc inviteUserToGroup(InviteUserToGroupReq) returns (InviteUserToGroupResp);
|
||||
|
||||
rpc getGroupAllMember(GetGroupAllMemberReq) returns(GetGroupAllMemberResp);
|
||||
}
|
||||
|
||||
|
||||
+959
-586
File diff suppressed because it is too large
Load Diff
+134
-80
@@ -2,6 +2,102 @@ syntax = "proto3";
|
||||
package open_im_sdk;//The package name to which the proto file belongs
|
||||
//option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk
|
||||
|
||||
////////////////////////////////base///////////////////////////////
|
||||
|
||||
|
||||
message GroupInfo{
|
||||
string GroupID = 1;
|
||||
string GroupName = 2;
|
||||
string Notification = 3;
|
||||
string Introduction = 4;
|
||||
string FaceUrl = 5;
|
||||
string OwnerUserID = 6;
|
||||
int64 CreateTime = 7;
|
||||
uint32 MemberCount = 8;
|
||||
string Ex = 9;
|
||||
int32 Status = 10;
|
||||
string CreatorUserID = 11;
|
||||
int32 GroupType = 12;
|
||||
}
|
||||
|
||||
message GroupMemberFullInfo {
|
||||
string GroupID = 1 ;
|
||||
string UserID = 2 ;
|
||||
int32 roleLevel = 3;
|
||||
int64 JoinTime = 4;
|
||||
string NickName = 5;
|
||||
string FaceUrl = 6;
|
||||
string FriendRemark = 7;
|
||||
int32 AppMangerLevel = 8; //if >0
|
||||
int32 JoinSource = 9;
|
||||
string OperatorUserID = 10;
|
||||
string Ex = 11;
|
||||
}
|
||||
|
||||
message PublicUserInfo{
|
||||
string UserID = 1;
|
||||
string Nickname = 2;
|
||||
string FaceUrl = 3;
|
||||
int32 Gender = 4;
|
||||
int32 AppMangerLevel = 5; //if >0
|
||||
}
|
||||
|
||||
message UserInfo{
|
||||
string UserID = 1;
|
||||
string Nickname = 2;
|
||||
string FaceUrl = 3;
|
||||
int32 Gender = 4;
|
||||
string PhoneNumber = 5;
|
||||
string Birth = 6;
|
||||
string Email = 7;
|
||||
string Ex = 8;
|
||||
}
|
||||
|
||||
message FriendInfo{
|
||||
string OwnerUserID = 1;
|
||||
string Remark = 2;
|
||||
int64 CreateTime = 3;
|
||||
UserInfo FriendUser = 4;
|
||||
int32 AddSource = 5;
|
||||
string OperatorUserID = 6;
|
||||
string Ex = 7;
|
||||
}
|
||||
|
||||
message BlackInfo{
|
||||
string OwnerUserID = 1;
|
||||
int64 CreateTime = 2;
|
||||
PublicUserInfo BlackUserInfo = 4;
|
||||
int32 AddSource = 5;
|
||||
string OperatorUserID = 6;
|
||||
string Ex = 7;
|
||||
}
|
||||
|
||||
message GroupRequest{
|
||||
string UserID = 1;
|
||||
string GroupID = 2;
|
||||
string HandleResult = 3;
|
||||
string ReqMsg = 4;
|
||||
string HandleMsg = 5;
|
||||
int64 ReqTime = 6;
|
||||
string HandleUserID = 7;
|
||||
int64 HandleTime = 8;
|
||||
string Ex = 9;
|
||||
}
|
||||
|
||||
message FriendRequest{
|
||||
string FromUserID = 1;
|
||||
string ToUserID = 2;
|
||||
int32 HandleResult = 3;
|
||||
string ReqMsg = 4;
|
||||
int64 CreateTime = 5;
|
||||
string HandlerUserID = 6;
|
||||
string HandleMsg = 7;
|
||||
int64 HandleTime = 8;
|
||||
string Ex = 9;
|
||||
}
|
||||
|
||||
///////////////////////////////////base end/////////////////////////////////////
|
||||
|
||||
|
||||
message PullMessageBySeqListResp {
|
||||
int32 errCode = 1;
|
||||
@@ -14,7 +110,7 @@ message PullMessageBySeqListResp {
|
||||
message PullMessageBySeqListReq{
|
||||
string userID = 1;
|
||||
string operationID = 2;
|
||||
repeated int64 seqList =3;
|
||||
repeated int64 seqList = 3;
|
||||
}
|
||||
message PullMessageReq {
|
||||
string userID = 1;
|
||||
@@ -80,76 +176,38 @@ message MsgData {
|
||||
string sendID = 1;
|
||||
string recvID = 2;
|
||||
string groupID = 3;
|
||||
string clientMsgID =4;
|
||||
string serverMsgID =5;
|
||||
int32 senderPlatformID =6;
|
||||
string senderNickName =7;
|
||||
string senderFaceURL =8;
|
||||
string clientMsgID = 4;
|
||||
string serverMsgID = 5;
|
||||
int32 senderPlatformID = 6;
|
||||
string senderNickname = 7;
|
||||
string senderFaceURL = 8;
|
||||
int32 sessionType = 9;
|
||||
int32 msgFrom = 10;
|
||||
int32 contentType = 11;
|
||||
bytes content =12;
|
||||
bytes content = 12;
|
||||
repeated string forceList = 13;
|
||||
int64 seq =14;
|
||||
int64 seq = 14;
|
||||
int64 sendTime = 15;
|
||||
int64 createTime = 16;
|
||||
map<string,bool> Options= 17;
|
||||
OfflinePushInfo offlinePushInfo =18;
|
||||
map<string, bool> Options = 17;
|
||||
OfflinePushInfo offlinePushInfo = 18;
|
||||
}
|
||||
|
||||
message OfflinePushInfo{
|
||||
string Title = 1;
|
||||
string Desc = 2;
|
||||
string Ext = 3;
|
||||
string iOSPushSound = 4;
|
||||
bool iOSBadgeCount = 5;
|
||||
}
|
||||
|
||||
//public
|
||||
message GroupInfo{
|
||||
string GroupID = 1;
|
||||
string GroupName = 2;
|
||||
string Notification = 3;
|
||||
string Introduction = 4;
|
||||
string FaceUrl = 5;
|
||||
PublicUserInfo Owner = 6;
|
||||
uint64 CreateTime = 7;
|
||||
uint32 MemberCount = 8;
|
||||
string Ext = 9;
|
||||
string Title = 1;
|
||||
string Desc = 2;
|
||||
string Ex = 3;
|
||||
string iOSPushSound = 4;
|
||||
bool iOSBadgeCount = 5;
|
||||
}
|
||||
|
||||
|
||||
//private, Group members have permission to view
|
||||
message GroupMemberFullInfo {
|
||||
string GroupID = 1 ;
|
||||
string UserID = 2 ;
|
||||
int32 AdministratorLevel = 3;
|
||||
uint64 JoinTime = 4;
|
||||
string NickName = 5;
|
||||
string FaceUrl = 6;
|
||||
string FriendRemark = 7;
|
||||
int32 AppMangerLevel = 8; // >0
|
||||
}
|
||||
|
||||
//private, Friends have permission to view
|
||||
message UserInfo{
|
||||
string UserID = 1;
|
||||
string Nickname = 2;
|
||||
string FaceUrl = 3;
|
||||
int32 Gender = 4;
|
||||
string Mobile = 5;
|
||||
string Birth = 6;
|
||||
string Email = 7;
|
||||
string Ext = 8;
|
||||
}
|
||||
|
||||
//No permissions required
|
||||
message PublicUserInfo{
|
||||
string UserID = 1;
|
||||
string Nickname = 2;
|
||||
string FaceUrl = 3;
|
||||
int32 Gender = 4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
message TipsComm{
|
||||
bytes Detail = 1;
|
||||
@@ -161,35 +219,35 @@ message TipsComm{
|
||||
message MemberEnterTips{
|
||||
GroupInfo Group = 1;
|
||||
GroupMemberFullInfo EntrantUser = 2;
|
||||
uint64 OperationTime = 3;
|
||||
int64 OperationTime = 3;
|
||||
}
|
||||
|
||||
//Actively leave the group
|
||||
message MemberLeaveTips{
|
||||
GroupInfo Group = 1;
|
||||
GroupMemberFullInfo LeaverUser = 2;
|
||||
uint64 OperationTime = 3;
|
||||
int64 OperationTime = 3;
|
||||
}
|
||||
|
||||
message MemberInvitedTips{
|
||||
GroupInfo Group = 1;
|
||||
GroupMemberFullInfo OpUser = 2;
|
||||
repeated GroupMemberFullInfo InvitedUserList = 3;
|
||||
uint64 OperationTime = 4;
|
||||
int64 OperationTime = 4;
|
||||
}
|
||||
|
||||
message MemberKickedTips{
|
||||
GroupInfo Group = 1;
|
||||
GroupMemberFullInfo OpUser = 2;
|
||||
repeated GroupMemberFullInfo KickedUserList = 3;
|
||||
uint64 OperationTime = 4;
|
||||
int64 OperationTime = 4;
|
||||
}
|
||||
|
||||
message MemberInfoChangedTips{
|
||||
int32 ChangeType = 1; ///bitwise operators 0001:member info changed; 0010:mute ;
|
||||
GroupMemberFullInfo OpUser = 2; //who do this
|
||||
GroupMemberFullInfo FinalInfo = 3; //
|
||||
uint64 MuteTime = 4;
|
||||
int64 MuteTime = 4;
|
||||
GroupInfo Group = 5;
|
||||
}
|
||||
|
||||
@@ -197,7 +255,7 @@ message GroupCreatedTips{
|
||||
GroupInfo Group = 1;
|
||||
GroupMemberFullInfo Creator = 2;
|
||||
repeated GroupMemberFullInfo MemberList = 3;
|
||||
uint64 OperationTime = 4;
|
||||
int64 OperationTime = 4;
|
||||
}
|
||||
|
||||
message GroupInfoChangedTips{
|
||||
@@ -208,27 +266,27 @@ message GroupInfoChangedTips{
|
||||
|
||||
message JoinGroupApplicationTips{
|
||||
GroupInfo Group = 1;
|
||||
PublicUserInfo Applicant = 2;
|
||||
string Reason = 3;
|
||||
PublicUserInfo Applicant = 2;
|
||||
string Reason = 3;
|
||||
}
|
||||
|
||||
message ApplicationProcessedTips{
|
||||
GroupInfo Group = 1;
|
||||
GroupMemberFullInfo OpUser = 2;
|
||||
int32 Result = 3;
|
||||
string Reason = 4;
|
||||
string Reason = 4;
|
||||
}
|
||||
|
||||
//////////////////////friend/////////////////////
|
||||
message FriendInfo{
|
||||
UserInfo OwnerUser = 1;
|
||||
string Remark = 2;
|
||||
uint64 CreateTime = 3;
|
||||
UserInfo FriendUser = 4;
|
||||
}
|
||||
//message FriendInfo{
|
||||
// UserInfo OwnerUser = 1;
|
||||
// string Remark = 2;
|
||||
// uint64 CreateTime = 3;
|
||||
// UserInfo FriendUser = 4;
|
||||
//}
|
||||
|
||||
message FriendApplication{
|
||||
uint64 AddTime = 1;
|
||||
int64 AddTime = 1;
|
||||
string AddSource = 2;
|
||||
string AddWording = 3;
|
||||
}
|
||||
@@ -240,7 +298,7 @@ message FromToUserID{
|
||||
|
||||
//FromUserID apply to add ToUserID
|
||||
message FriendApplicationAddedTips{
|
||||
FromToUserID FromToUserID = 1;
|
||||
FromToUserID FromToUserID = 1;
|
||||
}
|
||||
|
||||
//FromUserID accept or reject ToUserID
|
||||
@@ -251,7 +309,7 @@ message FriendApplicationProcessedTips{
|
||||
// FromUserID Added a friend ToUserID
|
||||
message FriendAddedTips{
|
||||
FriendInfo Friend = 1;
|
||||
uint64 OperationTime = 2;
|
||||
int64 OperationTime = 2;
|
||||
PublicUserInfo OpUser = 3; //who do this
|
||||
|
||||
}
|
||||
@@ -261,11 +319,7 @@ message FriendDeletedTips{
|
||||
FromToUserID FromToUserID = 1;
|
||||
}
|
||||
|
||||
//message BlackInfo{
|
||||
// PublicUserInfo OwnerUser = 1;
|
||||
// uint64 CreateTime = 3;
|
||||
// PublicUserInfo BlackUser = 4;
|
||||
//}
|
||||
|
||||
|
||||
message BlackAddedTips{
|
||||
FromToUserID FromToUserID = 1;
|
||||
|
||||
Reference in New Issue
Block a user