nil return modify

This commit is contained in:
Gordon
2021-12-29 12:22:10 +08:00
parent 447ccdf042
commit c4fca3b23d
2 changed files with 26 additions and 20 deletions
+12 -6
View File
@@ -39,8 +39,10 @@ func GetAllConversationMessageOpt(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()})
return
}
resp := api.GetAllConversationMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
resp.ConversationOptResultList = RpcResp.ConversationOptResultList
resp := api.GetAllConversationMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: RpcResp.ConversationOptResultList}
if len(RpcResp.ConversationOptResultList) == 0 {
resp.ConversationOptResultList = []*user.OptResult{}
}
log.NewInfo(req.OperationID, "GetAllConversationMsgOpt api return: ", resp)
c.JSON(http.StatusOK, resp)
}
@@ -69,8 +71,10 @@ func GetReceiveMessageOpt(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetReceiveMessageOpt rpc failed, " + err.Error()})
return
}
resp := api.GetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
resp.ConversationOptResultList = RpcResp.ConversationOptResultList
resp := api.GetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: RpcResp.ConversationOptResultList}
if len(RpcResp.ConversationOptResultList) == 0 {
resp.ConversationOptResultList = []*user.OptResult{}
}
log.NewInfo(req.OperationID, "GetReceiveMessageOpt api return: ", resp)
c.JSON(http.StatusOK, resp)
}
@@ -99,8 +103,10 @@ func SetReceiveMessageOpt(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "SetReceiveMessageOpt rpc failed, " + err.Error()})
return
}
resp := api.SetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}}
resp.OptResultList = RpcResp.OptResultList
resp := api.SetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, OptResultList: RpcResp.OptResultList}
if len(RpcResp.OptResultList) == 0 {
resp.OptResultList = []*user.OptResult{}
}
log.NewInfo(req.OperationID, "SetReceiveMessageOpt api return: ", resp)
c.JSON(http.StatusOK, resp)
}