Refactor code

This commit is contained in:
wenxu12345
2021-12-30 10:35:09 +08:00
parent 7c3e429f22
commit 2936f886a9
3 changed files with 11 additions and 8 deletions
+7 -4
View File
@@ -258,7 +258,7 @@ func CreateGroup(c *gin.Context) {
c.JSON(http.StatusOK, resp)
}
//my application 我发出去的
// 群主或管理员收到的
func GetGroupApplicationList(c *gin.Context) {
params := api.GetGroupApplicationListReq{}
if err := c.BindJSON(&params); 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)
client := rpc.NewGroupClient(etcdConn)
reply, err := client.GetGroupApplicationList(context.Background(), req)
if err != nil {
log.NewError(req.OperationID, "GetGroupApplicationList failed ", err.Error(), req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: reply.ErrCode, ErrMsg: reply.ErrMsg}, Data: reply.GroupRequestList}
c.JSON(http.StatusOK, resp)
resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: reply.ErrCode, ErrMsg: reply.ErrMsg}, GroupRequestList: reply.GroupRequestList}
if len(resp.GroupRequestList) == 0 {
resp.GroupRequestList = []*open_im_sdk.GroupRequest{}
}
log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp)
c.JSON(http.StatusOK, resp)
}
func GetGroupsInfo(c *gin.Context) {