Merge branch 'v2.3.0release' of github.com:OpenIMSDK/Open-IM-Server into v2.3.0release

pull/351/head
wangchuxiao 2 years ago
commit 46b1803086

@ -54,7 +54,7 @@ func main() {
{
userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1
userRouterGroup.POST("/set_global_msg_recv_opt", user.SetGlobalRecvMessageOpt)
userRouterGroup.POST("/get_users_info", user.GetUsersInfo) //1
userRouterGroup.POST("/get_users_info", user.GetUsersPublicInfo) //1
userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1
userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) //1
userRouterGroup.POST("/get_users_info_from_cache", user.GetUsersInfoFromCache)
@ -95,9 +95,9 @@ func main() {
groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1
groupRouterGroup.POST("/get_recv_group_applicationList", group.GetRecvGroupApplicationList) //1
groupRouterGroup.POST("/get_user_req_group_applicationList", group.GetUserReqGroupApplicationList)
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use
groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1
groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1
// groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use
groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1
groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1
groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1

@ -320,12 +320,7 @@ func InviteUserToGroup(c *gin.Context) {
}
req := &rpc.InviteUserToGroupReq{}
utils.CopyStructFields(req, &params)
if len(req.InvitedUserIDList) > constant.MaxNotificationNum {
errMsg := req.OperationID + " too many, Limit: " + utils.IntToString(constant.MaxNotificationNum)
log.NewError(req.OperationID, errMsg, len(req.InvitedUserIDList))
c.JSON(http.StatusRequestEntityTooLarge, gin.H{"errCode": 400, "errMsg": errMsg})
return
}
var ok bool
var errInfo string
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
@ -385,7 +380,13 @@ func CreateGroup(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
//
if len(params.MemberList) > constant.MaxNotificationNum {
errMsg := params.OperationID + " too many members " + utils.Int32ToString(int32(len(params.MemberList)))
log.Error(params.OperationID, errMsg)
c.JSON(http.StatusOK, gin.H{"errCode": 400, "errMsg": errMsg})
return
}
req := &rpc.CreateGroupReq{GroupInfo: &open_im_sdk.GroupInfo{}}
utils.CopyStructFields(req.GroupInfo, &params)

@ -160,7 +160,7 @@ func GetBlackIDListFromCache(c *gin.Context) {
// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误"
// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等"
// @Router /user/get_users_info [post]
func GetUsersInfo(c *gin.Context) {
func GetUsersPublicInfo(c *gin.Context) {
params := api.GetUsersInfoReq{}
if err := c.BindJSON(&params); err != nil {
log.NewError("0", "BindJSON failed ", err.Error())

@ -16,7 +16,7 @@ type CommDataResp struct {
type KickGroupMemberReq struct {
GroupID string `json:"groupID" binding:"required"`
KickedUserIDList []string `json:"kickedUserIDList" binding:"required"`
KickedUserIDList []string `json:"kickedUserIDList" binding:"required, min=1, max=100"`
Reason string `json:"reason"`
OperationID string `json:"operationID" binding:"required"`
}
@ -38,7 +38,7 @@ type GetGroupMembersInfoResp struct {
type InviteUserToGroupReq struct {
GroupID string `json:"groupID" binding:"required"`
InvitedUserIDList []string `json:"invitedUserIDList" binding:"required"`
InvitedUserIDList []string `json:"invitedUserIDList" binding:"required, min=1, max=100"`
Reason string `json:"reason"`
OperationID string `json:"operationID" binding:"required"`
}

@ -35,8 +35,6 @@ func InsertIntoGroupMember(toInsertInfo db.GroupMember) error {
}
func BatchInsertIntoGroupMember(toInsertInfoList []*db.GroupMember) error {
//MessageList []*model_struct.LocalChatLog
//return utils.Wrap(d.conn.Create(MessageList).Error, "BatchInsertMessageList failed")
for _, toInsertInfo := range toInsertInfoList {
toInsertInfo.JoinTime = time.Now()
if toInsertInfo.RoleLevel == 0 {

@ -107,3 +107,15 @@ func int64ToString(i int64) string {
func Int64ToString(i int64) string {
return strconv.FormatInt(i, 10)
}
func RemoveDuplicateElement(idList []string) []string {
result := make([]string, 0, len(idList))
temp := map[string]struct{}{}
for _, item := range idList {
if _, ok := temp[item]; !ok {
temp[item] = struct{}{}
result = append(result, item)
}
}
return result
}

Loading…
Cancel
Save