发布返回结果对象中添加冒泡结果字段

 

1、返回结果中使用单独的PublishResult对象,而不是使用CommonResult对象,方便添加扩展。

2、发布操作中需要调用其他接口,使用try{}catch包裹,这样不会影响主操作发布的结果。

3、将调用其他接口的结果存放到发布返回结果中,方便前端显示。

 

//发送冒泡
boolean bubbleSuccess = false;
try {
  bubbleSuccess = MsgUtil.sendBubble(groupBlog.getGroupId(), groupBlog.getPluginId() + "");
} catch (Exception e) {
  LOGGER.error(e);
}
publishResult.setBubbleSuccess(bubbleSuccess);   
public class PublishResult {
    private String returnCode;    // 返回码
    private String returnMessage;    // 返回信息
    private boolean returnStatus;//返回状态 true 正确 false 错误

    private boolean bubbleSuccess; //发送冒泡成功

    //setter & getter    
}
原文地址:https://www.cnblogs.com/wangdapeng/p/5157320.html