diff --git a/app/src/main/java/kunpeng/controller/ActivityController.java b/app/src/main/java/kunpeng/controller/ActivityController.java index 582d6e8f52aa786f0d80037c8bc409c9e7ca28b2..820df1fc9790ab25bef30ce63ee583135deba359 100644 --- a/app/src/main/java/kunpeng/controller/ActivityController.java +++ b/app/src/main/java/kunpeng/controller/ActivityController.java @@ -91,12 +91,12 @@ public class ActivityController { public Map getAllActivities(){ Map resultMap = new HashMap<>(); try{ - List notices = activityService.getAllActivities(); - resultMap.put("code", notices.size() > 0 ? Result.success(CodeMsg.QUERY_ACTIVITY_SUCCESSFULLY) : Result.error(CodeMsg.QUERY_ACTIVITY_NOT_EXIST)); - resultMap.put("notices",notices); + List activities = activityService.getAllActivities(); + resultMap.put("code", activities.size() > 0 ? Result.success(CodeMsg.QUERY_ACTIVITY_SUCCESSFULLY).getCode() : Result.error(CodeMsg.QUERY_ACTIVITY_NOT_EXIST).getCode()); + resultMap.put("activities",activities); } catch (Exception e){ - resultMap.put("code", CodeMsg.UNKNOWN_ERROR); + resultMap.put("code", CodeMsg.UNKNOWN_ERROR.getCode()); resultMap.put("notices",null); throw e; } diff --git a/app/src/main/java/kunpeng/controller/CommentController.java b/app/src/main/java/kunpeng/controller/CommentController.java index a9cd9697edb57ec807d9f1c29beba702ac7845b9..6232eb715b899117cadfcfe81dc72fa5b1ffad9e 100644 --- a/app/src/main/java/kunpeng/controller/CommentController.java +++ b/app/src/main/java/kunpeng/controller/CommentController.java @@ -95,12 +95,12 @@ public class CommentController { Map resultMap = new HashMap<>(); try { List comments = commentService.getAllComments(); - resultMap.put("code", comments.size() == 0 ? Result.success(CodeMsg.GET_COMMENTS_EMPTY) : Result.success(CodeMsg.GET_COMMENTS_SUCCESSFULLY)); + resultMap.put("code", comments.size() == 0 ? Result.success(CodeMsg.GET_COMMENTS_EMPTY).getCode() : Result.success(CodeMsg.GET_COMMENTS_SUCCESSFULLY).getCode()); resultMap.put("comments",comments); return resultMap; } catch (Exception e){ - resultMap.put("code",Result.error(CodeMsg.GET_COMMENTS_FAILED)); + resultMap.put("code",Result.error(CodeMsg.GET_COMMENTS_FAILED).getCode()); resultMap.put("comments",null); return resultMap; }