mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
Conflicts: internal/push/sdk/tpns-server-sdk-go/go/auth/auth.go pkg/proto/group/group.proto
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/tokenverify"
|
||||
"Open_IM/pkg/getcdv3"
|
||||
rpc "Open_IM/pkg/proto/auth"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdkws"
|
||||
"Open_IM/pkg/utils"
|
||||
@@ -149,7 +148,7 @@ func UserToken(c *gin.Context) {
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.ParseTokenReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段<br>platform为平台ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.ParseTokenResp{Data=api.ExpireTime}
|
||||
// @Success 0 {object} api.ParseTokenResp{Map=api.ExpireTime}
|
||||
// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /auth/parse_token [post]
|
||||
|
||||
@@ -343,7 +343,7 @@ package friend
|
||||
// utils.CopyStructFields(&black, v)
|
||||
// resp.BlackUserInfoList = append(resp.BlackUserInfoList, &black)
|
||||
// }
|
||||
// resp.Data = jsonData.JsonDataList(resp.BlackUserInfoList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.BlackUserInfoList)
|
||||
// log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
//}
|
||||
@@ -561,7 +561,7 @@ package friend
|
||||
// }
|
||||
//
|
||||
// resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList}
|
||||
// resp.Data = jsonData.JsonDataList(resp.FriendInfoList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.FriendInfoList)
|
||||
// log.NewInfo(req.CommID.OperationID, "GetFriendList api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
// //c.JSON(http.StatusOK, resp)
|
||||
@@ -618,7 +618,7 @@ package friend
|
||||
// }
|
||||
//
|
||||
// resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList}
|
||||
// resp.Data = jsonData.JsonDataList(resp.FriendRequestList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.FriendRequestList)
|
||||
// log.NewInfo(req.CommID.OperationID, "GetFriendApplyList api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
//}
|
||||
@@ -672,7 +672,7 @@ package friend
|
||||
// return
|
||||
// }
|
||||
// resp := api.GetSelfApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList}
|
||||
// resp.Data = jsonData.JsonDataList(resp.FriendRequestList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.FriendRequestList)
|
||||
// log.NewInfo(req.CommID.OperationID, "GetSelfApplyList api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
//}
|
||||
|
||||
@@ -142,7 +142,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// memberListResp := api.GetGroupMembersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, MemberList: RpcResp.MemberList}
|
||||
// memberListResp.Data = jsonData.JsonDataList(RpcResp.MemberList)
|
||||
// memberListResp.Map = jsonData.JsonDataList(RpcResp.MemberList)
|
||||
// log.NewInfo(req.OperationID, "GetGroupMembersInfo api return ", memberListResp)
|
||||
// c.JSON(http.StatusOK, memberListResp)
|
||||
//}
|
||||
@@ -186,7 +186,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// memberListResp := api.GetGroupMemberListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, MemberList: RpcResp.MemberList, NextSeq: RpcResp.NextSeq}
|
||||
// memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
|
||||
// memberListResp.Map = jsonData.JsonDataList(memberListResp.MemberList)
|
||||
//
|
||||
// log.NewInfo(req.OperationID, "FindGroupMemberAll api return ", memberListResp)
|
||||
// c.JSON(http.StatusOK, memberListResp)
|
||||
@@ -243,7 +243,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, MemberList: RpcResp.MemberList}
|
||||
// memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList)
|
||||
// memberListResp.Map = jsonData.JsonDataList(memberListResp.MemberList)
|
||||
// log.NewInfo(req.OperationID, "GetGroupAllMember api return ", len(memberListResp.MemberList))
|
||||
// c.JSON(http.StatusOK, memberListResp)
|
||||
//}
|
||||
@@ -298,7 +298,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, GroupInfoList: RpcResp.GroupList}
|
||||
// GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||
// GroupListResp.Map = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||
// log.NewInfo(req.OperationID, "FindJoinedGroup api return ", GroupListResp)
|
||||
// c.JSON(http.StatusOK, GroupListResp)
|
||||
//}
|
||||
@@ -437,7 +437,7 @@ package group
|
||||
//// resp := api.CreateGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
//// if RpcResp.ErrCode == 0 {
|
||||
//// utils.CopyStructFields(&resp.GroupInfo, RpcResp.GroupInfo)
|
||||
//// resp.Data = jsonData.JsonDataOne(&resp.GroupInfo)
|
||||
//// resp.Map = jsonData.JsonDataOne(&resp.GroupInfo)
|
||||
//// }
|
||||
//// log.NewInfo(req.OperationID, "CreateGroup api return ", resp)
|
||||
//// c.JSON(http.StatusOK, resp)
|
||||
@@ -496,7 +496,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}, GroupRequestList: reply.GroupRequestList}
|
||||
// resp.Data = jsonData.JsonDataList(resp.GroupRequestList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.GroupRequestList)
|
||||
// log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
//}
|
||||
@@ -567,7 +567,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, GroupInfoList: RpcResp.GroupInfoList}
|
||||
// resp.Data = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
// log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
//}
|
||||
|
||||
@@ -4,8 +4,10 @@ import (
|
||||
"Open_IM/pkg/api_struct"
|
||||
"Open_IM/pkg/proto/group"
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"google.golang.org/grpc"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -67,7 +69,8 @@ func KickGroupMember(c *gin.Context) {
|
||||
// 默认 全部自动
|
||||
NewRpc(NewApiBind[apistruct.KickGroupMemberReq, apistruct.KickGroupMemberResp](c), "", group.NewGroupClient, group.GroupClient.KickGroupMember).Execute()
|
||||
// 可以自定义编辑请求和响应
|
||||
NewRpc(NewApiBind[api_struct.KickGroupMemberReq, api_struct.KickGroupMemberResp](c), "", group.NewGroupClient, group.GroupClient.KickGroupMember).Before(func(apiReq *api_struct.KickGroupMemberReq, rpcReq *group.KickGroupMemberReq, bind func() error) error {
|
||||
a := NewRpc(NewApiBind[api_struct.KickGroupMemberReq, api_struct.KickGroupMemberResp](c), "", group.NewGroupClient, group.GroupClient.KickGroupMember)
|
||||
a.Before(func(apiReq *api_struct.KickGroupMemberReq, rpcReq *group.KickGroupMemberReq, bind func() error) error {
|
||||
return bind()
|
||||
}).After(func(rpcResp *group.KickGroupMemberResp, apiResp *api_struct.KickGroupMemberResp, bind func() error) error {
|
||||
return bind()
|
||||
@@ -102,6 +105,22 @@ func (a *RpcRun[A, B, C, D, Z]) After(fn func(rpcResp D, apiResp *B, bind func()
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *RpcRun[A, B, C, D, Z]) execute() (*B, error) {
|
||||
userID, err := a.bind.OpUserID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opID := a.bind.OperationID()
|
||||
var rpcReq C // C type => *Struct
|
||||
rpcReq = reflect.New(reflect.TypeOf(rpcReq).Elem()).Interface().(C)
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (a *RpcRun[A, B, C, D, Z]) Execute() {
|
||||
|
||||
}
|
||||
|
||||
func GetGrpcConn(name string) (*grpc.ClientConn, error) {
|
||||
return nil, errors.New("todo")
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ package group
|
||||
// return
|
||||
// }
|
||||
// GroupListResp := api.GetJoinedSuperGroupListResp{GetJoinedGroupListResp: api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupList}}
|
||||
// GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||
// GroupListResp.Map = jsonData.JsonDataList(GroupListResp.GroupInfoList)
|
||||
// log.NewInfo(req.OperationID, "GetJoinedSuperGroupList api return ", GroupListResp)
|
||||
// c.JSON(http.StatusOK, GroupListResp)
|
||||
//}
|
||||
@@ -83,7 +83,7 @@ package group
|
||||
// }
|
||||
//
|
||||
// resp := api.GetSuperGroupsInfoResp{GetGroupInfoResp: api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupInfoList}}
|
||||
// resp.Data = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
// resp.Map = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
// log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
||||
// c.JSON(http.StatusOK, resp)
|
||||
//}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/tokenverify"
|
||||
"Open_IM/pkg/getcdv3"
|
||||
pbChat "Open_IM/pkg/proto/msg"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdkws"
|
||||
"Open_IM/pkg/utils"
|
||||
@@ -165,7 +164,7 @@ func ManagementSendMsg(c *gin.Context) {
|
||||
}
|
||||
if err := mapstructure.WeakDecode(params.Content, &data); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "content to Data struct err", err.Error())
|
||||
log.Error(c.PostForm("operationID"), "content to Map struct err", err.Error())
|
||||
return
|
||||
} else if err := validate.Struct(data); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 403, "errMsg": err.Error()})
|
||||
@@ -298,7 +297,7 @@ func ManagementBatchSendMsg(c *gin.Context) {
|
||||
}
|
||||
if err := mapstructure.WeakDecode(params.Content, &data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()})
|
||||
log.Error(c.PostForm("operationID"), "content to Data struct err", err.Error())
|
||||
log.Error(c.PostForm("operationID"), "content to Map struct err", err.Error())
|
||||
return
|
||||
} else if err := validate.Struct(data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 403, "errMsg": err.Error()})
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/tokenverify"
|
||||
"Open_IM/pkg/getcdv3"
|
||||
pbOffice "Open_IM/pkg/proto/office"
|
||||
pbCommon "Open_IM/pkg/proto/sdkws"
|
||||
"Open_IM/pkg/utils"
|
||||
@@ -565,7 +564,7 @@ func GetUserFriendWorkMoments(c *gin.Context) {
|
||||
if err := utils.CopyStructFields(&resp, respPb.CommonResp); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
}
|
||||
//if err := utils.CopyStructFields(&resp.Data.WorkMoments, respPb.WorkMoments); err != nil {
|
||||
//if err := utils.CopyStructFields(&resp.Map.WorkMoments, respPb.WorkMoments); err != nil {
|
||||
// log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error())
|
||||
//}
|
||||
resp.Data.WorkMoments = []*api.WorkMoment{}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/tokenverify"
|
||||
"Open_IM/pkg/getcdv3"
|
||||
cacheRpc "Open_IM/pkg/proto/cache"
|
||||
pbRelay "Open_IM/pkg/proto/relay"
|
||||
open_im_sdk "Open_IM/pkg/proto/sdkws"
|
||||
@@ -156,7 +155,7 @@ func GetBlackIDListFromCache(c *gin.Context) {
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetUsersInfoReq true "请求体"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetUsersInfoResp{Data=[]open_im_sdk.PublicUserInfo}
|
||||
// @Success 0 {object} api.GetUsersInfoResp{Map=[]open_im_sdk.PublicUserInfo}
|
||||
// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /user/get_users_info [post]
|
||||
|
||||
Reference in New Issue
Block a user