|
|
@ -258,7 +258,7 @@ func CreateGroup(c *gin.Context) {
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//my application 我发出去的
|
|
|
|
// 群主或管理员收到的
|
|
|
|
func GetGroupApplicationList(c *gin.Context) {
|
|
|
|
func GetGroupApplicationList(c *gin.Context) {
|
|
|
|
params := api.GetGroupApplicationListReq{}
|
|
|
|
params := api.GetGroupApplicationListReq{}
|
|
|
|
if err := c.BindJSON(¶ms); err != nil {
|
|
|
|
if err := c.BindJSON(¶ms); err != nil {
|
|
|
@ -279,16 +279,19 @@ func GetGroupApplicationList(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
|
|
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName)
|
|
|
|
client := rpc.NewGroupClient(etcdConn)
|
|
|
|
client := rpc.NewGroupClient(etcdConn)
|
|
|
|
|
|
|
|
|
|
|
|
reply, err := client.GetGroupApplicationList(context.Background(), req)
|
|
|
|
reply, err := client.GetGroupApplicationList(context.Background(), req)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.NewError(req.OperationID, "GetGroupApplicationList failed ", err.Error(), req.String())
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: reply.ErrCode, ErrMsg: reply.ErrMsg}, Data: reply.GroupRequestList}
|
|
|
|
resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: reply.ErrCode, ErrMsg: reply.ErrMsg}, GroupRequestList: reply.GroupRequestList}
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
if len(resp.GroupRequestList) == 0 {
|
|
|
|
|
|
|
|
resp.GroupRequestList = []*open_im_sdk.GroupRequest{}
|
|
|
|
|
|
|
|
}
|
|
|
|
log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp)
|
|
|
|
log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp)
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func GetGroupsInfo(c *gin.Context) {
|
|
|
|
func GetGroupsInfo(c *gin.Context) {
|
|
|
@ -299,7 +302,7 @@ func GetGroupsInfo(c *gin.Context) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
req := &rpc.GetGroupsInfoReq{}
|
|
|
|
req := &rpc.GetGroupsInfoReq{}
|
|
|
|
utils.CopyStructFields(req, params)
|
|
|
|
utils.CopyStructFields(req, ¶ms)
|
|
|
|
var ok bool
|
|
|
|
var ok bool
|
|
|
|
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
|
|
|
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
|
|
|
if !ok {
|
|
|
|
if !ok {
|
|
|
@ -318,9 +321,12 @@ func GetGroupsInfo(c *gin.Context) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp := api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}
|
|
|
|
resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupInfoList}
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
if len(resp.GroupInfoList) == 0 {
|
|
|
|
|
|
|
|
resp.GroupInfoList = []*open_im_sdk.GroupInfo{}
|
|
|
|
|
|
|
|
}
|
|
|
|
log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
|
|
|
log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp)
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//process application
|
|
|
|
//process application
|
|
|
|