mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 19:02:31 +08:00
Merge branch 'OpenIMSDK:superGroup' into superGroup
This commit is contained in:
commit
019f416d01
@ -1 +1 @@
|
||||
Subproject commit 6fc6be9eb996aec24781a3905aeb2c9550a5a041
|
||||
Subproject commit 588c9bb77b9bd89a9261964006568b8655233cb6
|
||||
@ -32,6 +32,14 @@ func main() {
|
||||
authRouterGroup.POST("/login", register.Login)
|
||||
authRouterGroup.POST("/reset_password", register.ResetPassword)
|
||||
}
|
||||
demoRouterGroup := r.Group("/auth")
|
||||
{
|
||||
demoRouterGroup.POST("/code", register.SendVerificationCode)
|
||||
demoRouterGroup.POST("/verify", register.Verify)
|
||||
demoRouterGroup.POST("/password", register.SetPassword)
|
||||
demoRouterGroup.POST("/login", register.Login)
|
||||
demoRouterGroup.POST("/reset_password", register.ResetPassword)
|
||||
}
|
||||
defaultPorts := config.Config.Demo.Port
|
||||
ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 42233 as port")
|
||||
flag.Parse()
|
||||
|
||||
@ -423,8 +423,8 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
|
||||
}
|
||||
log.NewInfo(req.OperationID, RpcResp)
|
||||
resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, GroupRequestList: RpcResp.GroupRequestList}
|
||||
log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp)
|
||||
resp.Data = jsonData.JsonDataList(resp.GroupRequestList)
|
||||
log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
@ -464,12 +464,25 @@ func GetGroupsInfo(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupInfoList}
|
||||
resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: transferGroupInfo(RpcResp.GroupInfoList)}
|
||||
resp.Data = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func transferGroupInfo(input []*open_im_sdk.GroupInfo) []*api.GroupInfoAlias {
|
||||
var result []*api.GroupInfoAlias
|
||||
for _, v := range input {
|
||||
t := &api.GroupInfoAlias{}
|
||||
utils.CopyStructFields(t, &v)
|
||||
if v.NeedVerification != nil {
|
||||
t.NeedVerification = v.NeedVerification.Value
|
||||
}
|
||||
result = append(result, t)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
//process application
|
||||
func ApplicationGroupResponse(c *gin.Context) {
|
||||
params := api.ApplicationGroupResponseReq{}
|
||||
@ -608,6 +621,7 @@ func SetGroupInfo(c *gin.Context) {
|
||||
|
||||
if params.NeedVerification != nil {
|
||||
req.GroupInfo.NeedVerification = &wrappers.Int32Value{Value: *params.NeedVerification}
|
||||
log.NewInfo(req.OperationID, "NeedVerification ", req.GroupInfo.NeedVerification)
|
||||
}
|
||||
|
||||
var ok bool
|
||||
|
||||
@ -81,7 +81,8 @@ func GetSuperGroupsInfo(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp := api.GetSuperGroupsInfoResp{GetGroupInfoResp: api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: rpcResp.GroupInfoList}}
|
||||
|
||||
resp := api.GetSuperGroupsInfoResp{GetGroupInfoResp: api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, GroupInfoList: transferGroupInfo(rpcResp.GroupInfoList)}}
|
||||
resp.Data = jsonData.JsonDataList(resp.GroupInfoList)
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
@ -18,6 +18,7 @@ import (
|
||||
pbUser "Open_IM/pkg/proto/user"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
"github.com/golang/protobuf/ptypes/wrappers"
|
||||
"google.golang.org/grpc"
|
||||
"math/big"
|
||||
"net"
|
||||
@ -737,11 +738,13 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI
|
||||
}
|
||||
var groupInfo open_im_sdk.GroupInfo
|
||||
cp.GroupDBCopyOpenIM(&groupInfo, groupInfoFromMysql)
|
||||
//groupInfo.NeedVerification
|
||||
groupInfo.NeedVerification = &wrappers.Int32Value{Value: groupInfoFromMysql.NeedVerification}
|
||||
groupsInfoList = append(groupsInfoList, &groupInfo)
|
||||
}
|
||||
|
||||
resp := pbGroup.GetGroupsInfoResp{GroupInfoList: groupsInfoList}
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo rpc return ", resp.String())
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo rpc return ", resp.String())
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
|
||||
@ -124,9 +124,24 @@ type GetGroupInfoReq struct {
|
||||
}
|
||||
type GetGroupInfoResp struct {
|
||||
CommResp
|
||||
GroupInfoList []*open_im_sdk.GroupInfo `json:"-"`
|
||||
GroupInfoList []*GroupInfoAlias `json:"-"`
|
||||
Data []map[string]interface{} `json:"data"`
|
||||
}
|
||||
type GroupInfoAlias struct {
|
||||
GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"`
|
||||
GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"`
|
||||
Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"`
|
||||
Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"`
|
||||
FaceURL string `protobuf:"bytes,5,opt,name=faceURL" json:"faceURL,omitempty"`
|
||||
OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID" json:"ownerUserID,omitempty"`
|
||||
CreateTime uint32 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"`
|
||||
MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"`
|
||||
Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"`
|
||||
Status int32 `protobuf:"varint,10,opt,name=status" json:"status,omitempty"`
|
||||
CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID" json:"creatorUserID,omitempty"`
|
||||
GroupType int32 `protobuf:"varint,12,opt,name=groupType" json:"groupType,omitempty"`
|
||||
NeedVerification int32 `protobuf:"bytes,13,opt,name=needVerification" json:"needVerification,omitempty"`
|
||||
}
|
||||
|
||||
type ApplicationGroupResponseReq struct {
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user