update version

This commit is contained in:
yuye
2019-11-07 16:42:17 +08:00
parent e1b3f937cf
commit 5af2adb1d3
2 changed files with 0 additions and 46 deletions
@@ -4,7 +4,6 @@ import com.mars.core.constant.MarsConstant;
import com.mars.mvc.base.BaseInterceptor;
import com.mars.mvc.model.MarsInterModel;
import com.mars.mvc.util.BuildParams;
import com.mars.mvc.util.ResultUtil;
import com.mars.server.server.request.HttpMarsRequest;
import com.mars.server.server.request.HttpMarsResponse;
import com.mars.server.util.RequestUtil;
@@ -1,45 +0,0 @@
package com.mars.mvc.util;
import com.alibaba.fastjson.JSONObject;
import java.lang.reflect.InvocationTargetException;
public class ResultUtil {
/**
* 成功的返回数据结构
* @param obj bean的返回值
* @return json
*/
public static JSONObject getSuccessResult(Object obj){
JSONObject jsonObject = new JSONObject();
jsonObject.put("error_code","success");
jsonObject.put("result",obj);
return jsonObject;
}
/**
* 失败的返回数据结构
* @param obj 错误提示
* @return json
*/
public static JSONObject getFailResult(Object obj){
JSONObject jsonObject = new JSONObject();
jsonObject.put("error_code","fail");
jsonObject.put("error_info",obj);
return jsonObject;
}
/**
* 异常的返回数据结构
* @param e 错误提示
* @return json
*/
public static JSONObject getErrorResult(Throwable e){
if(e instanceof InvocationTargetException){
InvocationTargetException targetException = (InvocationTargetException)e;
return getFailResult(targetException.getTargetException().getMessage());
}
return getFailResult(e.getMessage());
}
}