mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-15 14:35:57 +08:00
tidy code
This commit is contained in:
@@ -2,16 +2,12 @@ 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
|
||||
}
|
||||
@@ -19,8 +15,6 @@ type AddBlacklistResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
|
||||
type ImportFriendReq struct {
|
||||
FriendUserIDList []string `json:"friendUserIDList" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
@@ -28,10 +22,9 @@ type ImportFriendReq struct {
|
||||
}
|
||||
type ImportFriendResp struct {
|
||||
CommResp
|
||||
Data []string `json:"data"`
|
||||
Data []string `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
type AddFriendReq struct {
|
||||
paramsCommFriend
|
||||
ReqMsg string `json:"reqMsg"`
|
||||
@@ -40,18 +33,15 @@ type AddFriendResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
type AddFriendResponseReq struct {
|
||||
paramsCommFriend
|
||||
Flag int32 `json:"flag" binding:"required"`
|
||||
Flag int32 `json:"flag" binding:"required"`
|
||||
HandleMsg string `json:"handleMsg"`
|
||||
}
|
||||
type AddFriendResponseResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
|
||||
type DeleteFriendReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
@@ -59,8 +49,6 @@ type DeleteFriendResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
|
||||
type GetBlackListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
@@ -69,7 +57,6 @@ type GetBlackListResp struct {
|
||||
BlackUserInfoList []*blackUserInfo `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
//type PublicUserInfo struct {
|
||||
// UserID string `json:"userID"`
|
||||
// Nickname string `json:"nickname"`
|
||||
@@ -81,7 +68,6 @@ type blackUserInfo struct {
|
||||
open_im_sdk.PublicUserInfo
|
||||
}
|
||||
|
||||
|
||||
type SetFriendCommentReq struct {
|
||||
paramsCommFriend
|
||||
Remark string `json:"remark" binding:"required"`
|
||||
@@ -90,7 +76,6 @@ type SetFriendCommentResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
|
||||
type RemoveBlackListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
@@ -106,7 +91,6 @@ type IsFriendResp struct {
|
||||
Response bool `json:"response"`
|
||||
}
|
||||
|
||||
|
||||
type GetFriendsInfoReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
@@ -123,10 +107,6 @@ type GetFriendListResp struct {
|
||||
FriendInfoList []*open_im_sdk.FriendInfo `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
type GetFriendApplyListReq struct {
|
||||
paramsCommFriend
|
||||
}
|
||||
@@ -142,14 +122,3 @@ type GetSelfApplyListResp struct {
|
||||
CommResp
|
||||
FriendRequestList open_im_sdk.FriendRequest `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package base_info
|
||||
|
||||
import (
|
||||
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
|
||||
)
|
||||
|
||||
type GetUsersOnlineStatusReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UserIDList []string `json:"userIDList" binding:"required,lte=200"`
|
||||
Secret string `json:"secret" binding:"required,max=32"`
|
||||
}
|
||||
type OnlineStatus struct {
|
||||
UserID string `json:"userID"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
type GetUsersOnlineStatusResp struct {
|
||||
CommResp
|
||||
OnlineStatusList []*OnlineStatus `json:"data"`
|
||||
}
|
||||
|
||||
type GetUserInfoReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
UserIDList []string `json:"userIDList" binding:"required"`
|
||||
}
|
||||
|
||||
type GetUserInfoResp struct {
|
||||
CommResp
|
||||
UserInfoList []*open_im_sdk.UserInfo `json:"data"`
|
||||
}
|
||||
@@ -8,6 +8,19 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//type Group struct {
|
||||
// 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"`
|
||||
//}
|
||||
|
||||
func InsertIntoGroup(groupInfo Group) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
@@ -24,228 +37,24 @@ func InsertIntoGroup(groupInfo Group) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindGroupInfoByGroupId(groupId string) (*Group, error) {
|
||||
func GetGroupInfoByGroupID(groupId string) (*Group, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupInfo Group
|
||||
err = dbConn.Raw("select * from `group` where group_id=?", groupId).Scan(&groupInfo).Error
|
||||
err = dbConn.Table("group").Where("group_id=?", groupId).Find(&groupInfo).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &groupInfo, nil
|
||||
}
|
||||
|
||||
func SetGroupInfo(groupId, groupName, introduction, notification, groupFaceUrl, ex string) error {
|
||||
func SetGroupInfo(groupInfo Group) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
dbConn.LogMode(true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if groupName != "" {
|
||||
if err = dbConn.Exec("update `group` set name=? where group_id=?", groupName, groupId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if introduction != "" {
|
||||
if err = dbConn.Exec("update `group` set introduction=? where group_id=?", introduction, groupId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if notification != "" {
|
||||
if err = dbConn.Exec("update `group` set notification=? where group_id=?", notification, groupId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if groupFaceUrl != "" {
|
||||
if err = dbConn.Exec("update `group` set face_url=? where group_id=?", groupFaceUrl, groupId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if ex != "" {
|
||||
if err = dbConn.Exec("update `group` set ex=? where group_id=?", ex, groupId).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetGroupApplicationList(uid string) (*group.GetGroupApplicationListResp, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var gID string
|
||||
var gIDs []string
|
||||
rows, err := dbConn.Raw("select group_id from `group_member` where uid = ? and administrator_level > 0", uid).Rows()
|
||||
defer rows.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for rows.Next() {
|
||||
rows.Scan(&gID)
|
||||
gIDs = append(gIDs, gID)
|
||||
}
|
||||
|
||||
if len(gIDs) == 0 {
|
||||
return &group.GetGroupApplicationListResp{}, nil
|
||||
}
|
||||
|
||||
sql := "select id, group_id, from_user_id, to_user_id, flag, req_msg, handled_msg, create_time, " +
|
||||
"from_user_nickname, to_user_nickname, from_user_face_url, to_user_face_url, handled_user from `group_request` where group_id in ( "
|
||||
for i := 0; i < len(gIDs); i++ {
|
||||
if i == len(gIDs)-1 {
|
||||
sql = sql + "\"" + gIDs[i] + "\"" + " )"
|
||||
} else {
|
||||
sql = sql + "\"" + gIDs[i] + "\"" + ", "
|
||||
}
|
||||
}
|
||||
|
||||
var groupRequest GroupRequest
|
||||
var groupRequests []GroupRequest
|
||||
log.Info("", "", sql)
|
||||
rows, err = dbConn.Raw(sql).Rows()
|
||||
defer rows.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for rows.Next() {
|
||||
rows.Scan(&groupRequest.ID, &groupRequest.GroupID, &groupRequest.FromUserID, &groupRequest.ToUserID, &groupRequest.Flag, &groupRequest.ReqMsg,
|
||||
&groupRequest.HandledMsg, &groupRequest.CreateTime, &groupRequest.FromUserNickname, &groupRequest.ToUserNickname,
|
||||
&groupRequest.FromUserFaceUrl, &groupRequest.ToUserFaceUrl, &groupRequest.HandledUser)
|
||||
groupRequests = append(groupRequests, groupRequest)
|
||||
}
|
||||
|
||||
reply := &group.GetGroupApplicationListResp{}
|
||||
reply.Data = &group.GetGroupApplicationListData{}
|
||||
reply.Data.Count = int32(len(groupRequests))
|
||||
for i := 0; i < int(reply.Data.Count); i++ {
|
||||
addUser := group.GetGroupApplicationList_Data_User{
|
||||
ID: groupRequests[i].ID,
|
||||
GroupID: groupRequests[i].GroupID,
|
||||
FromUserID: groupRequests[i].FromUserID,
|
||||
FromUserNickname: groupRequests[i].FromUserNickname,
|
||||
FromUserFaceUrl: groupRequests[i].FromUserFaceUrl,
|
||||
ToUserID: groupRequests[i].ToUserID,
|
||||
AddTime: groupRequests[i].CreateTime.Unix(),
|
||||
RequestMsg: groupRequests[i].ReqMsg,
|
||||
HandledMsg: groupRequests[i].HandledMsg,
|
||||
Flag: groupRequests[i].Flag,
|
||||
ToUserNickname: groupRequests[i].ToUserNickname,
|
||||
ToUserFaceUrl: groupRequests[i].ToUserFaceUrl,
|
||||
HandledUser: groupRequests[i].HandledUser,
|
||||
Type: 0,
|
||||
HandleStatus: 0,
|
||||
HandleResult: 0,
|
||||
}
|
||||
|
||||
if addUser.ToUserID != "0" {
|
||||
addUser.Type = 1
|
||||
}
|
||||
|
||||
if len(groupRequests[i].HandledUser) > 0 {
|
||||
if groupRequests[i].HandledUser == uid {
|
||||
addUser.HandleStatus = 2
|
||||
} else {
|
||||
addUser.HandleStatus = 1
|
||||
}
|
||||
}
|
||||
|
||||
if groupRequests[i].Flag == 1 {
|
||||
addUser.HandleResult = 1
|
||||
}
|
||||
|
||||
reply.Data.User = append(reply.Data.User, &addUser)
|
||||
}
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.TransferGroupOwnerResp, error) {
|
||||
oldOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OldOwnerUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
newOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.NewOwnerUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if oldOwner.UserID == newOwner.UserID {
|
||||
return nil, errors.New("the self")
|
||||
}
|
||||
|
||||
if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwnerUserID, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.NewOwnerUserID, 1); err != nil {
|
||||
UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwnerUserID, 1)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &group.TransferGroupOwnerResp{CommonResp: &group.CommonResp{ErrCode: 0}}, nil
|
||||
}
|
||||
|
||||
func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.CommonResp, error) {
|
||||
|
||||
ownerUser, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OwnerID)
|
||||
if err != nil {
|
||||
log.ErrorByKv("FindGroupMemberInfoByGroupIdAndUserId failed", pb.OperationID, "groupId", pb.GroupID, "ownerID", pb.OwnerID)
|
||||
return nil, err
|
||||
}
|
||||
if ownerUser.AdministratorLevel <= 0 {
|
||||
return nil, errors.New("insufficient permissions")
|
||||
}
|
||||
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupRequest GroupRequest
|
||||
err = dbConn.Raw("select * from `group_request` where handled_user = ? and group_id = ? and from_user_id = ? and to_user_id = ?",
|
||||
"", pb.GroupID, pb.FromUserID, pb.ToUserID).Scan(&groupRequest).Error
|
||||
if err != nil {
|
||||
log.ErrorByKv("find group_request info failed", pb.OperationID, "groupId", pb.GroupID, "fromUserId", pb.FromUserID, "toUserId", pb.OwnerID)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if groupRequest.Flag != 0 {
|
||||
return nil, errors.New("application has already handle")
|
||||
}
|
||||
|
||||
var saveFlag int
|
||||
if pb.HandleResult == 0 {
|
||||
saveFlag = -1
|
||||
} else if pb.HandleResult == 1 {
|
||||
saveFlag = 1
|
||||
} else {
|
||||
return nil, errors.New("parma HandleResult error")
|
||||
}
|
||||
err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and from_user_id = ? and to_user_id = ?",
|
||||
saveFlag, pb.HandledMsg, pb.OwnerID, groupRequest.GroupID, groupRequest.FromUserID, groupRequest.ToUserID).Error
|
||||
if err != nil {
|
||||
log.ErrorByKv("update group request failed", pb.OperationID, "groupID", pb.GroupID, "flag", saveFlag, "ownerId", pb.OwnerID, "fromUserId", pb.FromUserID, "toUserID", pb.ToUserID)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if saveFlag == 1 {
|
||||
if groupRequest.ToUserID == "0" {
|
||||
err = InsertIntoGroupMember(pb.GroupID, pb.FromUserID, groupRequest.FromUserNickname, groupRequest.FromUserFaceUrl, 0)
|
||||
if err != nil {
|
||||
log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID)
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
err = InsertIntoGroupMember(pb.GroupID, pb.ToUserID, groupRequest.ToUserNickname, groupRequest.ToUserFaceUrl, 0)
|
||||
if err != nil {
|
||||
log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &group.GroupApplicationResponseResp{}, nil
|
||||
err = dbConn.Table("friend_request").Where("group_id=?", groupInfo.GroupID).Update(&groupInfo).Error
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,15 +2,41 @@ package im_mysql_model
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"time"
|
||||
)
|
||||
|
||||
func InsertIntoGroupRequest(groupId, fromUserId, toUserId, reqMsg, fromUserNickName, fromUserFaceUrl string) error {
|
||||
//type GroupRequest struct {
|
||||
// UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
// GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
// HandleResult int32 `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"`
|
||||
//}
|
||||
|
||||
func UpdateGroupRequest(groupRequest GroupRequest) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toInsertInfo := GroupRequest{GroupID: groupId, FromUserID: fromUserId, ToUserID: toUserId, ReqMsg: reqMsg, FromUserNickname: fromUserNickName, FromUserFaceUrl: fromUserFaceUrl, CreateTime: time.Now()}
|
||||
err = dbConn.Table("group_request").Where("group_id=? and user_id=?", groupRequest.GroupID, groupRequest.UserID).Update(&groupRequest).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func InsertIntoGroupRequest(toInsertInfo GroupRequest) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toInsertInfo.HandledTime = time.Now()
|
||||
err = dbConn.Table("group_request").Create(&toInsertInfo).Error
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -18,45 +44,139 @@ func InsertIntoGroupRequest(groupId, fromUserId, toUserId, reqMsg, fromUserNickN
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindGroupRequestUserInfoByGroupIDAndUid(groupId, uid string) (*GroupRequest, error) {
|
||||
func GetGroupRequestByGroupIDAndUserID(groupID, userID string) (*GroupRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var requestUserInfo GroupRequest
|
||||
err = dbConn.Table("group_request").Where("from_user_id=? and group_id=?", uid, groupId).Find(&requestUserInfo).Error
|
||||
var groupRequest GroupRequest
|
||||
err = dbConn.Table("group_request").Where("user_id=? and group_id=?", userID, groupID).Find(&groupRequest).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &requestUserInfo, nil
|
||||
return &groupRequest, nil
|
||||
}
|
||||
|
||||
func DelGroupRequest(groupId, fromUserId, toUserId string) error {
|
||||
func DelGroupRequestByGroupIDAndUserID(groupID, userID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("delete from group_request where group_id=? and from_user_id=? and to_user_id=?", groupId, fromUserId, toUserId).Error
|
||||
err = dbConn.Table("group_request").Where("group_id=? and user_id=?", groupID, userID).Delete(&GroupRequest{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func FindGroupBeInvitedRequestInfoByUidAndGroupID(groupId, uid string) (*GroupRequest, error) {
|
||||
func GetGroupRequestByGroupID(groupID string) ([]GroupRequest, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var beInvitedRequestUserInfo GroupRequest
|
||||
err = dbConn.Table("group_request").Where("to_user_id=? and group_id=?", uid, groupId).Find(&beInvitedRequestUserInfo).Error
|
||||
var groupRequestList []GroupRequest
|
||||
err = dbConn.Table("group_request").Where("group_id=?", groupID).Find(&groupRequestList).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &beInvitedRequestUserInfo, nil
|
||||
|
||||
return groupRequestList, nil
|
||||
}
|
||||
|
||||
func InsertGroupRequest(groupId, fromUser, fromUserNickName, fromUserFaceUrl, toUser, requestMsg, handledMsg string, handleStatus int) error {
|
||||
return nil
|
||||
//received
|
||||
func GetGroupApplicationList(userID string) ([]GroupRequest, error) {
|
||||
var groupRequestList []GroupRequest
|
||||
memberList, err := GetGroupMemberListByUserID(userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range memberList {
|
||||
if v.RoleLevel > 0 {
|
||||
list, err := GetGroupRequestByGroupID(v.GroupID)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
groupRequestList = append(groupRequestList, list...)
|
||||
}
|
||||
}
|
||||
return groupRequestList, nil
|
||||
}
|
||||
|
||||
//
|
||||
//func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.CommonResp, error) {
|
||||
//
|
||||
// ownerUser, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OwnerID)
|
||||
// if err != nil {
|
||||
// log.ErrorByKv("FindGroupMemberInfoByGroupIdAndUserId failed", pb.OperationID, "groupId", pb.GroupID, "ownerID", pb.OwnerID)
|
||||
// return nil, err
|
||||
// }
|
||||
// if ownerUser.AdministratorLevel <= 0 {
|
||||
// return nil, errors.New("insufficient permissions")
|
||||
// }
|
||||
//
|
||||
// dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// var groupRequest GroupRequest
|
||||
// err = dbConn.Raw("select * from `group_request` where handled_user = ? and group_id = ? and from_user_id = ? and to_user_id = ?",
|
||||
// "", pb.GroupID, pb.FromUserID, pb.ToUserID).Scan(&groupRequest).Error
|
||||
// if err != nil {
|
||||
// log.ErrorByKv("find group_request info failed", pb.OperationID, "groupId", pb.GroupID, "fromUserId", pb.FromUserID, "toUserId", pb.OwnerID)
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// if groupRequest.Flag != 0 {
|
||||
// return nil, errors.New("application has already handle")
|
||||
// }
|
||||
//
|
||||
// var saveFlag int
|
||||
// if pb.HandleResult == 0 {
|
||||
// saveFlag = -1
|
||||
// } else if pb.HandleResult == 1 {
|
||||
// saveFlag = 1
|
||||
// } else {
|
||||
// return nil, errors.New("parma HandleResult error")
|
||||
// }
|
||||
// err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and from_user_id = ? and to_user_id = ?",
|
||||
// saveFlag, pb.HandledMsg, pb.OwnerID, groupRequest.GroupID, groupRequest.FromUserID, groupRequest.ToUserID).Error
|
||||
// if err != nil {
|
||||
// log.ErrorByKv("update group request failed", pb.OperationID, "groupID", pb.GroupID, "flag", saveFlag, "ownerId", pb.OwnerID, "fromUserId", pb.FromUserID, "toUserID", pb.ToUserID)
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// if saveFlag == 1 {
|
||||
// if groupRequest.ToUserID == "0" {
|
||||
// err = InsertIntoGroupMember(pb.GroupID, pb.FromUserID, groupRequest.FromUserNickname, groupRequest.FromUserFaceUrl, 0)
|
||||
// if err != nil {
|
||||
// log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID)
|
||||
// return nil, err
|
||||
// }
|
||||
// } else {
|
||||
// err = InsertIntoGroupMember(pb.GroupID, pb.ToUserID, groupRequest.ToUserNickname, groupRequest.ToUserFaceUrl, 0)
|
||||
// if err != nil {
|
||||
// log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID)
|
||||
// return nil, err
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return &group.GroupApplicationResponseResp{}, nil
|
||||
//}
|
||||
|
||||
//func FindGroupBeInvitedRequestInfoByUidAndGroupID(groupId, uid string) (*GroupRequest, error) {
|
||||
// dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// var beInvitedRequestUserInfo GroupRequest
|
||||
// err = dbConn.Table("group_request").Where("to_user_id=? and group_id=?", uid, groupId).Find(&beInvitedRequestUserInfo).Error
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return &beInvitedRequestUserInfo, nil
|
||||
//
|
||||
//}
|
||||
|
||||
//func InsertGroupRequest(groupId, fromUser, fromUserNickName, fromUserFaceUrl, toUser, requestMsg, handledMsg string, handleStatus int) error {
|
||||
// return nil
|
||||
//}
|
||||
|
||||
@@ -40,7 +40,7 @@ type Group struct {
|
||||
type GroupMember struct {
|
||||
GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
NickName string `gorm:"column:nickname"`
|
||||
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"`
|
||||
@@ -52,7 +52,7 @@ type GroupMember struct {
|
||||
type GroupRequest struct {
|
||||
UserID string `gorm:"column:user_id;primaryKey;"`
|
||||
GroupID string `gorm:"column:group_id;primaryKey;"`
|
||||
HandleResult string `gorm:"column:handle_result"`
|
||||
HandleResult int32 `gorm:"column:handle_result"`
|
||||
ReqMsg string `gorm:"column:req_msg"`
|
||||
HandledMsg string `gorm:"column:handled_msg"`
|
||||
ReqTime time.Time `gorm:"column:req_time"`
|
||||
@@ -73,7 +73,7 @@ type User struct {
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
type BlackList struct {
|
||||
type Black struct {
|
||||
OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"`
|
||||
BlockUserID string `gorm:"column:block_user_id;primaryKey;"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
|
||||
@@ -5,42 +5,52 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func InsertInToUserBlackList(ownerID, blockID string) error {
|
||||
func InsertInToUserBlackList(black Black) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
toInsertInfo := BlackList{OwnerUserID: ownerID, BlockUserID: blockID, CreateTime: time.Now()}
|
||||
err = dbConn.Table("user_black_list").Create(toInsertInfo).Error
|
||||
black.CreateTime = time.Now()
|
||||
err = dbConn.Table("user_black_list").Create(black).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func FindRelationshipFromBlackList(ownerID, blockID string) error {
|
||||
//type Black 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"`
|
||||
//}
|
||||
|
||||
func CheckBlack(ownerUserID, blockUserID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var blackList BlackList
|
||||
err = dbConn.Table("user_black_list").Where("owner_id=? and block_id=?", ownerID, blockID).Find(&blackList).Error
|
||||
var black Black
|
||||
err = dbConn.Table("user_black_list").Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Find(&black).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func RemoveBlackList(ownerID, blockID string) error {
|
||||
func RemoveBlackList(ownerUserID, blockUserID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Exec("delete from user_black_list where owner_id=? and block_id=?", ownerID, blockID).Error
|
||||
|
||||
err = dbConn.Table("user_black_list").Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Delete(&Black{}).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func GetBlackListByUID(ownerID string) ([]BlackList, error) {
|
||||
func GetBlackListByUserID(ownerUserID string) ([]Black, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var blackListUsersInfo []BlackList
|
||||
err = dbConn.Table("user_black_list").Where("owner_id=?", ownerID).Find(&blackListUsersInfo).Error
|
||||
var blackListUsersInfo []Black
|
||||
err = dbConn.Table("user_black_list").Where("owner_user_id=?", ownerUserID).Find(&blackListUsersInfo).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package im_mysql_model
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/db"
|
||||
pbAuth "Open_IM/pkg/proto/auth"
|
||||
"Open_IM/pkg/utils"
|
||||
"fmt"
|
||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||
@@ -12,168 +11,101 @@ import (
|
||||
|
||||
func init() {
|
||||
//init managers
|
||||
var pb pbAuth.UserRegisterReq
|
||||
for k, v := range config.Config.Manager.AppManagerUid {
|
||||
if !IsExistUser(v) {
|
||||
pb.UID = v
|
||||
pb.Name = "AppManager" + utils.IntToString(k+1)
|
||||
err := UserRegister(&pb)
|
||||
if err != nil {
|
||||
fmt.Println("AppManager insert error", err.Error())
|
||||
}
|
||||
user, err := GetUserByUserID(v)
|
||||
if err != nil {
|
||||
fmt.Println("GetUserByUserID failed ", err.Error(), v, user)
|
||||
continue
|
||||
}
|
||||
var appMgr User
|
||||
appMgr.Nickname = "AppManager" + utils.IntToString(k+1)
|
||||
err = UserRegister(appMgr)
|
||||
if err != nil {
|
||||
fmt.Println("AppManager insert error", err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
func UserRegister(pb *pbAuth.UserRegisterReq) error {
|
||||
|
||||
func UserRegister(user User) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
addUser := User{
|
||||
UserID: pb.UID,
|
||||
Nickname: pb.Name,
|
||||
FaceUrl: pb.Icon,
|
||||
Gender: pb.Gender,
|
||||
Mobile: pb.Mobile,
|
||||
Birth: pb.Birth,
|
||||
Email: pb.Email,
|
||||
Ex: pb.Ex,
|
||||
CreateTime: time.Now(),
|
||||
}
|
||||
err = dbConn.Table("user").Create(&addUser).Error
|
||||
user.CreateTime = time.Now()
|
||||
|
||||
err = dbConn.Table("user").Create(&user).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func UserDelete(uid string) error {
|
||||
//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"`
|
||||
//}
|
||||
|
||||
func DeleteUser(userID string) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = dbConn.Table("user").Where("uid=?", uid).Delete(User{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
err = dbConn.Table("user").Where("user_id=?", userID).Delete(User{}).Error
|
||||
return err
|
||||
}
|
||||
func FindUserByUID(uid string) (*User, error) {
|
||||
|
||||
func GetUserByUserID(userID string) (*User, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var user User
|
||||
err = dbConn.Table("user").Where("uid=?", uid).First(&user).Error
|
||||
err = dbConn.Table("user").Where("user_id=?", userID).First(&user).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &user, nil
|
||||
}
|
||||
|
||||
func UpDateUserInfo(uid, name, headUrl, mobilePhoneNum, birth, email, extendInfo string, gender int32) error {
|
||||
func UpdateUserInfo(user User) error {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if name != "" {
|
||||
if err = dbConn.Exec("update user set name=? where uid=?", name, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if headUrl != "" {
|
||||
if err = dbConn.Exec("update user set icon=? where uid=?", headUrl, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if mobilePhoneNum != "" {
|
||||
if err = dbConn.Exec("update user set mobile=? where uid=?", mobilePhoneNum, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if birth != "" {
|
||||
if err = dbConn.Exec("update user set birth=? where uid=?", birth, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if email != "" {
|
||||
if err = dbConn.Exec("update user set email=? where uid=?", email, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if extendInfo != "" {
|
||||
if err = dbConn.Exec("update user set ex=? where uid=?", extendInfo, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if gender != 0 {
|
||||
if err = dbConn.Exec("update user set gender=? where uid=?", gender, uid).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
err = dbConn.Table("user").Where("user_id=?", user.UserID).Update(&user).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func SelectAllUID() ([]string, error) {
|
||||
var uid []string
|
||||
|
||||
func SelectAllUserID() ([]string, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return uid, err
|
||||
return nil, err
|
||||
}
|
||||
rows, err := dbConn.Raw("select uid from user").Rows()
|
||||
var resultArr []string
|
||||
err = dbConn.Table("user").Select([]string{"user_id"}).Scan(&resultArr).Error
|
||||
if err != nil {
|
||||
return uid, err
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var strUID string
|
||||
for rows.Next() {
|
||||
rows.Scan(&strUID)
|
||||
uid = append(uid, strUID)
|
||||
}
|
||||
return uid, nil
|
||||
}
|
||||
func SelectSomeUID(uids []string) ([]string, error) {
|
||||
var uid []string
|
||||
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return uid, err
|
||||
}
|
||||
rows, err := dbConn.Raw("select uid from user where uid in (" + sqlStringHandle(uids) + ")").Rows()
|
||||
if err != nil {
|
||||
return uid, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var strUID string
|
||||
for rows.Next() {
|
||||
rows.Scan(&strUID)
|
||||
uid = append(uid, strUID)
|
||||
}
|
||||
return uid, nil
|
||||
return resultArr, nil
|
||||
}
|
||||
|
||||
func IsExistUser(uid string) bool {
|
||||
func SelectSomeUserID(userIDList []string) ([]string, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return false
|
||||
return nil, err
|
||||
}
|
||||
var number int32
|
||||
err = dbConn.Raw("select count(*) from `user` where uid = ?", uid).Count(&number).Error
|
||||
var userList []User
|
||||
err = dbConn.Table("user").Where("(user_id) IN ? ", userIDList).Find(&userList).Error
|
||||
if err != nil {
|
||||
return false
|
||||
return nil, err
|
||||
}
|
||||
if number != 1 {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func sqlStringHandle(ss []string) (s string) {
|
||||
for i := 0; i < len(ss); i++ {
|
||||
s += "'" + ss[i] + "'"
|
||||
if i < len(ss)-1 {
|
||||
s += ","
|
||||
}
|
||||
}
|
||||
return s
|
||||
return userIDList, nil
|
||||
}
|
||||
|
||||
+121
-112
@@ -6,6 +6,7 @@ package pbAuth // import "./auth"
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import sdk_ws "Open_IM/pkg/proto/sdk_ws"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
@@ -23,25 +24,65 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type UserRegisterReq struct {
|
||||
UID string `protobuf:"bytes,1,opt,name=UID" json:"UID,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"`
|
||||
Icon string `protobuf:"bytes,3,opt,name=Icon" json:"Icon,omitempty"`
|
||||
Gender int32 `protobuf:"varint,4,opt,name=Gender" json:"Gender,omitempty"`
|
||||
Mobile string `protobuf:"bytes,5,opt,name=Mobile" json:"Mobile,omitempty"`
|
||||
Birth string `protobuf:"bytes,6,opt,name=Birth" json:"Birth,omitempty"`
|
||||
Email string `protobuf:"bytes,7,opt,name=Email" json:"Email,omitempty"`
|
||||
Ex string `protobuf:"bytes,8,opt,name=Ex" json:"Ex,omitempty"`
|
||||
type CommonResp struct {
|
||||
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CommonResp) Reset() { *m = CommonResp{} }
|
||||
func (m *CommonResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*CommonResp) ProtoMessage() {}
|
||||
func (*CommonResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_auth_6e5d34ffb6edf37a, []int{0}
|
||||
}
|
||||
func (m *CommonResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CommonResp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CommonResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CommonResp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *CommonResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CommonResp.Merge(dst, src)
|
||||
}
|
||||
func (m *CommonResp) XXX_Size() int {
|
||||
return xxx_messageInfo_CommonResp.Size(m)
|
||||
}
|
||||
func (m *CommonResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CommonResp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CommonResp proto.InternalMessageInfo
|
||||
|
||||
func (m *CommonResp) GetErrCode() int32 {
|
||||
if m != nil {
|
||||
return m.ErrCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *CommonResp) GetErrMsg() string {
|
||||
if m != nil {
|
||||
return m.ErrMsg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UserRegisterReq struct {
|
||||
UserInfo *sdk_ws.UserInfo `protobuf:"bytes,1,opt,name=UserInfo" json:"UserInfo,omitempty"`
|
||||
OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) Reset() { *m = UserRegisterReq{} }
|
||||
func (m *UserRegisterReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserRegisterReq) ProtoMessage() {}
|
||||
func (*UserRegisterReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_auth_d2199f7b1388fd2f, []int{0}
|
||||
return fileDescriptor_auth_6e5d34ffb6edf37a, []int{1}
|
||||
}
|
||||
func (m *UserRegisterReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserRegisterReq.Unmarshal(m, b)
|
||||
@@ -61,74 +102,32 @@ func (m *UserRegisterReq) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_UserRegisterReq proto.InternalMessageInfo
|
||||
|
||||
func (m *UserRegisterReq) GetUID() string {
|
||||
func (m *UserRegisterReq) GetUserInfo() *sdk_ws.UserInfo {
|
||||
if m != nil {
|
||||
return m.UID
|
||||
return m.UserInfo
|
||||
}
|
||||
return ""
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetName() string {
|
||||
func (m *UserRegisterReq) GetOperationID() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetIcon() string {
|
||||
if m != nil {
|
||||
return m.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetGender() int32 {
|
||||
if m != nil {
|
||||
return m.Gender
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetMobile() string {
|
||||
if m != nil {
|
||||
return m.Mobile
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetBirth() string {
|
||||
if m != nil {
|
||||
return m.Birth
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetEmail() string {
|
||||
if m != nil {
|
||||
return m.Email
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserRegisterReq) GetEx() string {
|
||||
if m != nil {
|
||||
return m.Ex
|
||||
return m.OperationID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UserRegisterResp struct {
|
||||
Success bool `protobuf:"varint,1,opt,name=Success" json:"Success,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UserRegisterResp) Reset() { *m = UserRegisterResp{} }
|
||||
func (m *UserRegisterResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserRegisterResp) ProtoMessage() {}
|
||||
func (*UserRegisterResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_auth_d2199f7b1388fd2f, []int{1}
|
||||
return fileDescriptor_auth_6e5d34ffb6edf37a, []int{2}
|
||||
}
|
||||
func (m *UserRegisterResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserRegisterResp.Unmarshal(m, b)
|
||||
@@ -148,16 +147,18 @@ func (m *UserRegisterResp) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_UserRegisterResp proto.InternalMessageInfo
|
||||
|
||||
func (m *UserRegisterResp) GetSuccess() bool {
|
||||
func (m *UserRegisterResp) GetCommonResp() *CommonResp {
|
||||
if m != nil {
|
||||
return m.Success
|
||||
return m.CommonResp
|
||||
}
|
||||
return false
|
||||
return nil
|
||||
}
|
||||
|
||||
type UserTokenReq struct {
|
||||
Platform int32 `protobuf:"varint,1,opt,name=Platform" json:"Platform,omitempty"`
|
||||
UID string `protobuf:"bytes,2,opt,name=UID" json:"UID,omitempty"`
|
||||
FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"`
|
||||
OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,omitempty"`
|
||||
OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@@ -167,7 +168,7 @@ func (m *UserTokenReq) Reset() { *m = UserTokenReq{} }
|
||||
func (m *UserTokenReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserTokenReq) ProtoMessage() {}
|
||||
func (*UserTokenReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_auth_d2199f7b1388fd2f, []int{2}
|
||||
return fileDescriptor_auth_6e5d34ffb6edf37a, []int{3}
|
||||
}
|
||||
func (m *UserTokenReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserTokenReq.Unmarshal(m, b)
|
||||
@@ -194,28 +195,41 @@ func (m *UserTokenReq) GetPlatform() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *UserTokenReq) GetUID() string {
|
||||
func (m *UserTokenReq) GetFromUserID() string {
|
||||
if m != nil {
|
||||
return m.UID
|
||||
return m.FromUserID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserTokenReq) GetOpUserID() string {
|
||||
if m != nil {
|
||||
return m.OpUserID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *UserTokenReq) GetOperationID() string {
|
||||
if m != nil {
|
||||
return m.OperationID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UserTokenResp struct {
|
||||
ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"`
|
||||
ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"`
|
||||
Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"`
|
||||
ExpiredTime int64 `protobuf:"varint,4,opt,name=ExpiredTime" json:"ExpiredTime,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"`
|
||||
Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"`
|
||||
ExpiredTime int64 `protobuf:"varint,3,opt,name=ExpiredTime" json:"ExpiredTime,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UserTokenResp) Reset() { *m = UserTokenResp{} }
|
||||
func (m *UserTokenResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserTokenResp) ProtoMessage() {}
|
||||
func (*UserTokenResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_auth_d2199f7b1388fd2f, []int{3}
|
||||
return fileDescriptor_auth_6e5d34ffb6edf37a, []int{4}
|
||||
}
|
||||
func (m *UserTokenResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UserTokenResp.Unmarshal(m, b)
|
||||
@@ -235,18 +249,11 @@ func (m *UserTokenResp) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_UserTokenResp proto.InternalMessageInfo
|
||||
|
||||
func (m *UserTokenResp) GetErrCode() int32 {
|
||||
func (m *UserTokenResp) GetCommonResp() *CommonResp {
|
||||
if m != nil {
|
||||
return m.ErrCode
|
||||
return m.CommonResp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *UserTokenResp) GetErrMsg() string {
|
||||
if m != nil {
|
||||
return m.ErrMsg
|
||||
}
|
||||
return ""
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UserTokenResp) GetToken() string {
|
||||
@@ -264,6 +271,7 @@ func (m *UserTokenResp) GetExpiredTime() int64 {
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*CommonResp)(nil), "pbAuth.CommonResp")
|
||||
proto.RegisterType((*UserRegisterReq)(nil), "pbAuth.UserRegisterReq")
|
||||
proto.RegisterType((*UserRegisterResp)(nil), "pbAuth.UserRegisterResp")
|
||||
proto.RegisterType((*UserTokenReq)(nil), "pbAuth.UserTokenReq")
|
||||
@@ -375,30 +383,31 @@ var _Auth_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "auth/auth.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_d2199f7b1388fd2f) }
|
||||
func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_6e5d34ffb6edf37a) }
|
||||
|
||||
var fileDescriptor_auth_d2199f7b1388fd2f = []byte{
|
||||
// 348 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x41, 0x4f, 0xf2, 0x40,
|
||||
0x10, 0x86, 0xd3, 0x42, 0x0b, 0xcc, 0xf7, 0x21, 0x64, 0x82, 0xba, 0xe1, 0x44, 0x7a, 0xe2, 0x60,
|
||||
0x6a, 0xa2, 0x17, 0x13, 0xbd, 0x80, 0x36, 0x86, 0x03, 0xc6, 0x54, 0xb8, 0x78, 0x2b, 0xb0, 0x42,
|
||||
0x23, 0x65, 0xeb, 0x6e, 0x49, 0xf0, 0xec, 0x8f, 0xf2, 0xef, 0x99, 0x9d, 0xdd, 0x12, 0x34, 0x5c,
|
||||
0xda, 0x79, 0x9f, 0x9d, 0xc9, 0xee, 0x3b, 0x33, 0xd0, 0x4a, 0xb6, 0xc5, 0xea, 0x52, 0x7f, 0xc2,
|
||||
0x5c, 0x8a, 0x42, 0xa0, 0x9f, 0xcf, 0x06, 0xdb, 0x62, 0x15, 0x7c, 0x3b, 0xd0, 0x9a, 0x2a, 0x2e,
|
||||
0x63, 0xbe, 0x4c, 0x55, 0xa1, 0xff, 0x1f, 0xd8, 0x86, 0xca, 0x74, 0xf4, 0xc0, 0x9c, 0x9e, 0xd3,
|
||||
0x6f, 0xc4, 0x3a, 0x44, 0x84, 0xea, 0x53, 0x92, 0x71, 0xe6, 0x12, 0xa2, 0x58, 0xb3, 0xd1, 0x5c,
|
||||
0x6c, 0x58, 0xc5, 0x30, 0x1d, 0xe3, 0x19, 0xf8, 0x8f, 0x7c, 0xb3, 0xe0, 0x92, 0x55, 0x7b, 0x4e,
|
||||
0xdf, 0x8b, 0xad, 0xd2, 0x7c, 0x2c, 0x66, 0xe9, 0x9a, 0x33, 0x8f, 0xb2, 0xad, 0xc2, 0x0e, 0x78,
|
||||
0xc3, 0x54, 0x16, 0x2b, 0xe6, 0x13, 0x36, 0x42, 0xd3, 0x28, 0x4b, 0xd2, 0x35, 0xab, 0x19, 0x4a,
|
||||
0x02, 0x4f, 0xc0, 0x8d, 0x76, 0xac, 0x4e, 0xc8, 0x8d, 0x76, 0xc1, 0x05, 0xb4, 0x7f, 0x3f, 0x5c,
|
||||
0xe5, 0xc8, 0xa0, 0xf6, 0xb2, 0x9d, 0xcf, 0xb9, 0x52, 0xf4, 0xfa, 0x7a, 0x5c, 0xca, 0xe0, 0x0e,
|
||||
0xfe, 0xeb, 0xec, 0x89, 0x78, 0xe7, 0x1b, 0xed, 0xb1, 0x0b, 0xf5, 0xe7, 0x75, 0x52, 0xbc, 0x09,
|
||||
0x99, 0x51, 0xaa, 0x17, 0xef, 0x75, 0xe9, 0xdf, 0xdd, 0xfb, 0x0f, 0x3e, 0xa1, 0x79, 0x50, 0x6d,
|
||||
0x2e, 0x8a, 0xa4, 0xbc, 0x17, 0x0b, 0x6e, 0xab, 0x4b, 0xa9, 0xad, 0x46, 0x52, 0x8e, 0xd5, 0xd2,
|
||||
0xd6, 0x5b, 0xa5, 0x4d, 0x51, 0xb9, 0xed, 0x97, 0x11, 0xd8, 0x83, 0x7f, 0xd1, 0x2e, 0x4f, 0x25,
|
||||
0x5f, 0x4c, 0xd2, 0x8c, 0x53, 0xd7, 0x2a, 0xf1, 0x21, 0xba, 0xfa, 0x72, 0xa0, 0xaa, 0x27, 0x85,
|
||||
0x03, 0xe3, 0xa0, 0xf4, 0x8b, 0xe7, 0xa1, 0x19, 0x61, 0xf8, 0x67, 0x7c, 0x5d, 0x76, 0xfc, 0x40,
|
||||
0xe5, 0x78, 0x03, 0x8d, 0xbd, 0x0d, 0xec, 0x1c, 0xa6, 0x95, 0x7d, 0xe9, 0x9e, 0x1e, 0xa1, 0x2a,
|
||||
0x1f, 0xb6, 0x5e, 0x9b, 0x21, 0xad, 0xcf, 0xad, 0x39, 0x9e, 0xf9, 0xb4, 0x46, 0xd7, 0x3f, 0x01,
|
||||
0x00, 0x00, 0xff, 0xff, 0x15, 0x5d, 0xc8, 0xb6, 0x59, 0x02, 0x00, 0x00,
|
||||
var fileDescriptor_auth_6e5d34ffb6edf37a = []byte{
|
||||
// 362 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x4f, 0xc2, 0x40,
|
||||
0x14, 0x4c, 0xe5, 0x43, 0x78, 0x48, 0x30, 0x2f, 0xa0, 0x4d, 0x0f, 0x06, 0x7b, 0xe2, 0xd4, 0x46,
|
||||
0xbc, 0x98, 0x98, 0x98, 0x20, 0x4a, 0xc2, 0x81, 0x60, 0x1a, 0xbc, 0x78, 0x21, 0x90, 0x2e, 0xd0,
|
||||
0xd4, 0x76, 0xd7, 0xdd, 0x12, 0x4c, 0x3c, 0x7a, 0xf1, 0x67, 0x9b, 0xdd, 0x7e, 0xb8, 0x22, 0x27,
|
||||
0x2f, 0x6d, 0x66, 0xe6, 0xf5, 0xcd, 0xcc, 0x76, 0xa1, 0xb5, 0xd8, 0x26, 0x1b, 0x57, 0x3e, 0x1c,
|
||||
0xc6, 0x69, 0x42, 0xb1, 0xca, 0x96, 0x83, 0x6d, 0xb2, 0xb1, 0x2e, 0xa7, 0x8c, 0xc4, 0xf3, 0xf1,
|
||||
0xc4, 0x65, 0xe1, 0xda, 0x55, 0x92, 0x2b, 0xfc, 0x70, 0xbe, 0x13, 0xee, 0x4e, 0xa4, 0xa3, 0xf6,
|
||||
0x1d, 0xc0, 0x90, 0x46, 0x11, 0x8d, 0x3d, 0x22, 0x18, 0x9a, 0x70, 0x4c, 0x38, 0x1f, 0x52, 0x9f,
|
||||
0x98, 0x46, 0xd7, 0xe8, 0x55, 0xbc, 0x1c, 0xe2, 0x19, 0x54, 0x09, 0xe7, 0x13, 0xb1, 0x36, 0x8f,
|
||||
0xba, 0x46, 0xaf, 0xee, 0x65, 0xc8, 0x5e, 0x41, 0xeb, 0x59, 0x10, 0xee, 0x91, 0x75, 0x20, 0x12,
|
||||
0xf9, 0x7e, 0xc3, 0x2b, 0xa8, 0x49, 0x6a, 0x1c, 0xaf, 0xa8, 0xda, 0xd2, 0xe8, 0x77, 0x1c, 0x2a,
|
||||
0x83, 0x04, 0xd1, 0x5c, 0xf8, 0xa1, 0x93, 0x8b, 0x5e, 0x31, 0x86, 0x5d, 0x68, 0x4c, 0x19, 0xe1,
|
||||
0x8b, 0x24, 0xa0, 0xf1, 0xf8, 0x21, 0xb3, 0xd0, 0x29, 0x7b, 0x04, 0xa7, 0xbf, 0x7d, 0x04, 0xc3,
|
||||
0xbe, 0x9e, 0x3d, 0xb3, 0x42, 0x27, 0xed, 0xee, 0xfc, 0x28, 0x9e, 0x36, 0x65, 0x7f, 0x19, 0x70,
|
||||
0x22, 0x17, 0xcd, 0x68, 0x48, 0x62, 0x99, 0xd6, 0x82, 0xda, 0xd3, 0xeb, 0x22, 0x59, 0x51, 0x1e,
|
||||
0x65, 0x9d, 0x0b, 0x8c, 0x17, 0x00, 0x23, 0x4e, 0x23, 0x15, 0x33, 0x4f, 0xa5, 0x31, 0xf2, 0xdb,
|
||||
0x29, 0xcb, 0xd4, 0x92, 0x52, 0x0b, 0xbc, 0x5f, 0xa9, 0xfc, 0xb7, 0xd2, 0x07, 0x34, 0xb5, 0x24,
|
||||
0xff, 0xeb, 0x83, 0x6d, 0xa8, 0xa8, 0x05, 0x59, 0xba, 0x14, 0x48, 0xf3, 0xc7, 0x77, 0x16, 0x70,
|
||||
0xe2, 0xcf, 0x82, 0x88, 0xa8, 0x6c, 0x25, 0x4f, 0xa7, 0xfa, 0x9f, 0x06, 0x94, 0xe5, 0x5e, 0x1c,
|
||||
0xa4, 0xe7, 0x91, 0x1f, 0x2c, 0x9e, 0xe7, 0x86, 0x7b, 0xbf, 0xd5, 0x32, 0x0f, 0x0b, 0x82, 0xe1,
|
||||
0x0d, 0xd4, 0x8b, 0x22, 0xd8, 0xd6, 0xc7, 0xf2, 0x53, 0xb6, 0x3a, 0x07, 0x58, 0xc1, 0xee, 0x5b,
|
||||
0x2f, 0x4d, 0x47, 0x5d, 0xdc, 0xdb, 0x54, 0x5e, 0x56, 0xd5, 0xad, 0xbc, 0xfe, 0x0e, 0x00, 0x00,
|
||||
0xff, 0xff, 0x8c, 0xd6, 0x72, 0x1f, 0xd3, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
+19
-18
@@ -1,33 +1,34 @@
|
||||
syntax = "proto3";
|
||||
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
|
||||
package pbAuth;
|
||||
option go_package = "./auth;pbAuth";
|
||||
|
||||
message UserRegisterReq {
|
||||
string UID = 1;
|
||||
string Name = 2;
|
||||
string Icon = 3;
|
||||
int32 Gender = 4;
|
||||
string Mobile = 5;
|
||||
string Birth = 6;
|
||||
string Email = 7;
|
||||
string Ex = 8;
|
||||
message CommonResp{
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
}
|
||||
|
||||
message UserRegisterResp {
|
||||
bool Success = 1;
|
||||
message UserRegisterReq {
|
||||
open_im_sdk.UserInfo UserInfo = 1;
|
||||
string OperationID = 2;
|
||||
}
|
||||
message UserRegisterResp {
|
||||
CommonResp CommonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
message UserTokenReq {
|
||||
int32 Platform = 1;
|
||||
string UID = 2;
|
||||
string FromUserID = 2;
|
||||
string OpUserID = 3;
|
||||
string OperationID = 4;
|
||||
}
|
||||
message UserTokenResp {
|
||||
CommonResp CommonResp = 1;
|
||||
string Token = 2;
|
||||
int64 ExpiredTime = 3;
|
||||
}
|
||||
|
||||
message UserTokenResp {
|
||||
int32 ErrCode = 1;
|
||||
string ErrMsg = 2;
|
||||
string Token = 3;
|
||||
int64 ExpiredTime = 4;
|
||||
}
|
||||
|
||||
service Auth {
|
||||
rpc UserRegister(UserRegisterReq) returns(UserRegisterResp);
|
||||
|
||||
+416
-586
File diff suppressed because it is too large
Load Diff
+61
-77
@@ -1,34 +1,38 @@
|
||||
syntax = "proto3";
|
||||
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
|
||||
option go_package = "./user;user";
|
||||
package user;
|
||||
|
||||
message CommonResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
}
|
||||
message DeleteUsersResp{
|
||||
CommonResp commonResp = 1;
|
||||
repeated string failedUidList = 2;
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
}
|
||||
|
||||
message DeleteUsersReq{
|
||||
repeated string deleteUidList = 2;
|
||||
string token = 3;
|
||||
repeated string DeleteUserIDList = 2;
|
||||
string OpUserID = 3;
|
||||
string OperationID = 4;
|
||||
}
|
||||
message GetAllUsersUidReq{
|
||||
string token = 2;
|
||||
string operationID = 3;
|
||||
|
||||
message DeleteUsersResp{
|
||||
CommonResp CommonResp = 1;
|
||||
repeated string FailedUserIDList = 2;
|
||||
}
|
||||
message GetAllUsersUidResp{
|
||||
CommonResp commonResp = 1;
|
||||
repeated string uidList = 2;
|
||||
|
||||
|
||||
message GetAllUserIDReq{
|
||||
string opUserID = 1;
|
||||
string operationID = 2;
|
||||
}
|
||||
message GetAllUserIDResp{
|
||||
CommonResp CommonResp = 1;
|
||||
repeated string UserIDList = 2;
|
||||
}
|
||||
|
||||
|
||||
message AccountCheckReq{
|
||||
repeated string uidList = 1;
|
||||
string token = 2;
|
||||
string operationID = 3;
|
||||
repeated string CheckUserIDList = 1;
|
||||
string OpUserID = 2;
|
||||
string OperationID = 3;
|
||||
|
||||
}
|
||||
message AccountCheckResp{
|
||||
@@ -37,97 +41,77 @@ message AccountCheckResp{
|
||||
string userID = 1;
|
||||
string accountStatus = 2;
|
||||
}
|
||||
repeated SingleUserStatus result = 2;
|
||||
|
||||
repeated SingleUserStatus ResultList = 2;
|
||||
}
|
||||
|
||||
|
||||
message GetUserInfoReq{
|
||||
repeated string userIDList = 1;
|
||||
string token = 2;
|
||||
string OpUserID = 2;
|
||||
string OperationID = 3;
|
||||
}
|
||||
message GetUserInfoResp{
|
||||
int32 errorCode = 1;
|
||||
string errorMsg = 2;
|
||||
repeated UserInfo Data = 3;
|
||||
}
|
||||
message UserInfo{
|
||||
string uid = 1;
|
||||
string name = 2;
|
||||
string icon = 3;
|
||||
int32 gender = 4;
|
||||
string mobile = 5;
|
||||
string birth = 6;
|
||||
string email = 7;
|
||||
string ex = 8;
|
||||
CommonResp commonResp = 1;
|
||||
repeated open_im_sdk.UserInfo UserInfoList = 3;
|
||||
}
|
||||
|
||||
|
||||
message LogoutReq{
|
||||
string OperationID = 1;
|
||||
string token = 2;
|
||||
}
|
||||
|
||||
message UpdateUserInfoReq{
|
||||
string icon = 1;
|
||||
string name = 2;
|
||||
int32 gender = 3;
|
||||
string mobile = 4;
|
||||
string birth = 5;
|
||||
string email = 6;
|
||||
string ex = 7;
|
||||
string token = 8;
|
||||
string OperationID = 9;
|
||||
string Uid = 10;
|
||||
open_im_sdk.UserInfo UserInfo = 1;
|
||||
string OpUserID = 2;
|
||||
string operationID = 3;
|
||||
}
|
||||
message UpdateUserInfoResp{
|
||||
CommonResp commonResp = 1;
|
||||
}
|
||||
|
||||
|
||||
message SetReceiveMessageOptReq{
|
||||
string uId = 1;
|
||||
int32 opt = 2;
|
||||
repeated string conversationId = 3;
|
||||
string operationID = 4;
|
||||
string FromUserID = 1;
|
||||
int32 opt = 2;
|
||||
repeated string conversationIDList = 3;
|
||||
string operationID = 4;
|
||||
string OpUserID = 5;
|
||||
}
|
||||
message OptResult{
|
||||
string conversationId = 1;
|
||||
int32 result = 2; //-1: failed; 0:default; 1: not receive ; 2: not jpush
|
||||
}
|
||||
|
||||
message SetReceiveMessageOptResp{
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
repeated OptResult optResult = 3;
|
||||
CommonResp commonResp = 1;
|
||||
repeated OptResult optResultList = 2;
|
||||
}
|
||||
|
||||
|
||||
message GetReceiveMessageOptReq{
|
||||
string uId = 1;
|
||||
repeated string conversationId = 2;
|
||||
string operationID = 3;
|
||||
string FromUserID = 1;
|
||||
repeated string conversationId = 2;
|
||||
string operationID = 3;
|
||||
string OpUserID = 4;
|
||||
}
|
||||
|
||||
message OptResult{
|
||||
string conversationId = 1;
|
||||
int32 result = 2; //-1: failed; 0:default; 1: not receive ; 2: not jpush
|
||||
}
|
||||
|
||||
message GetReceiveMessageOptResp{
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
repeated OptResult conversationOptResult = 3;
|
||||
CommonResp commonResp = 1;
|
||||
repeated OptResult conversationOptResultList = 3;
|
||||
}
|
||||
|
||||
|
||||
message GetAllConversationMsgOptReq{
|
||||
string uId = 1;
|
||||
string operationID = 2;
|
||||
string FromUserId = 1;
|
||||
string operationID = 2;
|
||||
string OpUserID = 3;
|
||||
}
|
||||
|
||||
message GetAllConversationMsgOptResp{
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
repeated OptResult conversationOptResult = 3;
|
||||
CommonResp commonResp = 1;
|
||||
repeated OptResult conversationOptResultList = 3;
|
||||
}
|
||||
|
||||
|
||||
service user {
|
||||
rpc getUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
|
||||
rpc UpdateUserInfo(UpdateUserInfoReq) returns(CommonResp);
|
||||
rpc GetUserInfo(GetUserInfoReq) returns(GetUserInfoResp);
|
||||
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
|
||||
rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp);
|
||||
rpc GetAllUsersUid(GetAllUsersUidReq)returns(GetAllUsersUidResp);
|
||||
rpc GetAllUserID(GetAllUserIDReq)returns(GetAllUserIDResp);
|
||||
rpc SetReceiveMessageOpt(SetReceiveMessageOptReq)returns(SetReceiveMessageOptResp);
|
||||
rpc GetReceiveMessageOpt(GetReceiveMessageOptReq)returns(GetReceiveMessageOptResp);
|
||||
rpc GetAllConversationMsgOpt(GetAllConversationMsgOptReq)returns(GetAllConversationMsgOptResp);
|
||||
|
||||
Reference in New Issue
Block a user