david 2 лет назад
Родитель
Сommit
505586ff77

+ 0 - 9
src/main/java/com/roma/romaapi/controller/ApiController.java

@@ -46,14 +46,5 @@ public class ApiController {
         Map<String, Object> loginResult = apiService.login(maps);
 
         return CustomResponse.formatResponse(loginResult);
-//        //生成验证码对应的token  以token为key  验证码为value存在redis中
-//        ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
-//        valueOperations.set(key, key);
-//        //设置验证码过期时间
-//        redisTemplate.expire(key, timeout, TimeUnit.MINUTES);
-//        Map<String, Object> map = new HashMap<>();
-//        map.put("token", key);
-//        map.put("expire", timeout);
-
     }
 }

+ 11 - 2
src/main/java/com/roma/romaapi/controller/PageController.java

@@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -26,7 +28,14 @@ public class PageController {
 
     // 获取菜单----系统应用请求
     @RequestMapping("/page/menu")
-    public List menu() {
-        return pageService.menu();
+    public Map menu() {
+        Map<String, Object> ret = new HashMap<>();
+        ret.put("children", pageService.menu());
+        List<Map<String, Object>> pages = new ArrayList<Map<String, Object>>();
+        pages.add(ret);
+        Map lastMap = new HashMap<>();
+        lastMap.put("pages", pages);
+
+        return CustomResponse.formatResponse(lastMap);
     }
 }

+ 5 - 5
src/main/java/com/roma/romaapi/utils/CustomResponse.java

@@ -30,7 +30,7 @@ public class CustomResponse {
     // 格式化响应
     public static Map formatResponse(Map data) {
         Map<String, Object> result = new HashMap<>();
-        String code = "200";
+        String code = "0";
         String message = "success";
         boolean isEmpty = data.containsKey("sysErrorCode");
         if(isEmpty) {
@@ -39,13 +39,13 @@ public class CustomResponse {
             Object errorCode = data.get("sysErrorCode"); // 错误码
             Object errorMessage = data.containsKey("sysErrorMessage") ? data.get("sysErrorMessage")
                     : new String("operation failed!"); // 错误提示信息
-            result.put("code", errorCode.toString());
-            result.put("message", errorMessage.toString());
+            result.put("status", errorCode.toString());
+            result.put("msg", errorMessage.toString());
             result.put("data", !isEmptyData ? data.get("sysErrorData") : new HashMap<>());
         } else {
             // 返回正确信息
-            result.put("code", code);
-            result.put("message", message);
+            result.put("status", code);
+            result.put("msg", message);
             result.put("data", data);
         }