| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e482237 commit 4cd9e7e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -213,6 +213,7 @@ public String openHead(@PathVariable String request, HttpSession session) { | |||
| 213 | 213 | } | |
| 214 | 214 | ||
| 215 | 215 | public static final String VERSION = JSONRequest.KEY_VERSION; | |
| 216 | + public static final String FORMAT = JSONRequest.KEY_FORMAT; | ||
| 216 | 217 | public static final String COUNT = JSONResponse.KEY_COUNT; | |
| 217 | 218 | public static final String TOTAL = JSONResponse.KEY_TOTAL; | |
| 218 | 219 | ||
@@ -419,6 +420,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) { | |||
| 419 | 420 | String phone; | |
| 420 | 421 | String password; | |
| 421 | 422 | int version; | |
| 423 | + Boolean format; | ||
| 422 | 424 | try { | |
| 423 | 425 | requestObject = DemoParser.parseRequest(request); | |
| 424 | 426 | ||
@@ -440,9 +442,11 @@ public JSONObject login(@RequestBody String request, HttpSession session) { | |||
| 440 | 442 | } | |
| 441 | 443 | } | |
| 442 | 444 | ||
| 443 | - //全局版本号 | ||
| 445 | + //全局版本号,是否格式化 | ||
| 444 | 446 | version = requestObject.getIntValue(VERSION); | |
| 447 | + format = requestObject.getBoolean(FORMAT); | ||
| 445 | 448 | requestObject.remove(VERSION); | |
| 449 | + requestObject.remove(FORMAT); | ||
| 446 | 450 | } catch (Exception e) { | |
| 447 | 451 | return DemoParser.extendErrorResult(requestObject, e); | |
| 448 | 452 | } | |
@@ -511,6 +515,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) { | |||
| 511 | 515 | session.setAttribute(USER_, user);//用户 | |
| 512 | 516 | session.setAttribute(PRIVACY_, privacy);//用户隐私信息 | |
| 513 | 517 | session.setAttribute(VERSION, version);//全局默认版本号 | |
| 518 | + session.setAttribute(FORMAT, format);//全局默认格式化配置 | ||
| 514 | 519 | // session.setMaxInactiveInterval(1*60);//设置session过期时间 | |
| 515 | 520 | ||
| 516 | 521 | return response; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,9 +67,17 @@ public SQLConfig createSQLConfig() { | |||
| 67 | 67 | public SQLExecutor createSQLExecutor() { | |
| 68 | 68 | return new DemoSQLExecutor(); | |
| 69 | 69 | } | |
| 70 | - | ||
| 71 | - | ||
| 72 | - | ||
| 70 | + | ||
| 71 | + @Override | ||
| 72 | + public JSONObject parseResponse(JSONObject request) { | ||
| 73 | + //补充format | ||
| 74 | + if (session != null && request != null && request.get(JSONRequest.KEY_FORMAT) == null) { | ||
| 75 | + request.put(JSONRequest.KEY_FORMAT, session.getAttribute(JSONRequest.KEY_FORMAT)); | ||
| 76 | + } | ||
| 77 | + return super.parseResponse(request); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + | ||
| 73 | 81 | @Override | |
| 74 | 82 | public DemoObjectParser createObjectParser(JSONObject request, String parentPath, String name, SQLConfig arrayConfig) throws Exception { | |
| 75 | 83 | ||
@@ -106,12 +114,12 @@ public JSONObject parseResponse(JSONRequest request) throws Exception { | |||
| 106 | 114 | }.setMethod(requestMethod).setParser(this); | |
| 107 | 115 | } | |
| 108 | 116 | ||
| 109 | - | ||
| 110 | - | ||
| 117 | + | ||
| 118 | + | ||
| 111 | 119 | @Override | |
| 112 | 120 | protected void onVerifyContent() throws Exception { | |
| 113 | - //补充全局缺省版本号 | ||
| 114 | - if (session != null && requestObject.getIntValue(JSONRequest.KEY_VERSION) <= 0) { | ||
| 121 | + //补充全局缺省版本号 //可能在默认为1的前提下这个请求version就需要为0 requestObject.getIntValue(JSONRequest.KEY_VERSION) <= 0) { | ||
| 122 | + if (session != null && requestObject.get(JSONRequest.KEY_VERSION) == null) { | ||
| 115 | 123 | requestObject.put(JSONRequest.KEY_VERSION, session.getAttribute(JSONRequest.KEY_VERSION)); | |
| 116 | 124 | } | |
| 117 | 125 | super.onVerifyContent(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments