订单中心+营销活动:完善部分 TODO 提到的问题

This commit is contained in:
puhui999
2023-09-06 11:29:51 +08:00
parent c25bf38f50
commit 2591ab5d36
18 changed files with 97 additions and 152 deletions

View File

@ -41,7 +41,7 @@ public class CommonResult<T> implements Serializable {
* 因为 A 方法返回的 CommonResult 对象,不满足调用其的 B 方法的返回,所以需要进行转换。
*
* @param result 传入的 result 对象
* @param <T> 返回的泛型
* @param <T> 返回的泛型
* @return 新的 CommonResult 对象
*/
public static <T> CommonResult<T> error(CommonResult<?> result) {
@ -68,6 +68,14 @@ public class CommonResult<T> implements Serializable {
return result;
}
public static <T> CommonResult<T> success(T data, String msg) {
CommonResult<T> result = new CommonResult<>();
result.code = GlobalErrorCodeConstants.SUCCESS.getCode();
result.data = data;
result.msg = msg;
return result;
}
public static boolean isSuccess(Integer code) {
return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
}