| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a907f71 commit 20464b2
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -211,6 +211,7 @@ public String open_head(@PathVariable String request, HttpSession session) { | |||
| 211 | 211 | VERIFY_ = Verify.class.getSimpleName(); | |
| 212 | 212 | } | |
| 213 | 213 | ||
| 214 | + public static final String VERSION = JSONRequest.KEY_VERSION; | ||
| 214 | 215 | public static final String COUNT = JSONResponse.KEY_COUNT; | |
| 215 | 216 | public static final String TOTAL = JSONResponse.KEY_TOTAL; | |
| 216 | 217 | ||
@@ -232,6 +233,7 @@ public String open_head(@PathVariable String request, HttpSession session) { | |||
| 232 | 233 | public static final String TYPE = "type"; | |
| 233 | 234 | public static final String WAY = "way"; | |
| 234 | 235 | public static final String CONTENT = "content"; | |
| 236 | + | ||
| 235 | 237 | ||
| 236 | 238 | ||
| 237 | 239 | ||
@@ -400,9 +402,10 @@ private JSONObject newVerifyRequest(int type, String phone, String verify) { | |||
| 400 | 402 | * @see | |
| 401 | 403 | * <pre> | |
| 402 | 404 | { | |
| 403 | - "type": 0, | ||
| 405 | + "type": 0, //登录方式,非必须 0-密码 2-验证码 | ||
| 404 | 406 | "phone": "13000082001", | |
| 405 | - "password": "1234567" | ||
| 407 | + "password": "1234567", | ||
| 408 | + "version": 1 //全局版本号,非必须 | ||
| 406 | 409 | } | |
| 407 | 410 | * </pre> | |
| 408 | 411 | */ | |
@@ -412,6 +415,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) { | |||
| 412 | 415 | boolean isPassword; | |
| 413 | 416 | String phone; | |
| 414 | 417 | String password; | |
| 418 | + int version; | ||
| 415 | 419 | try { | |
| 416 | 420 | requestObject = Parser.parseRequest(request, POST); | |
| 417 | 421 | ||
@@ -432,6 +436,8 @@ public JSONObject login(@RequestBody String request, HttpSession session) { | |||
| 432 | 436 | throw new IllegalArgumentException("验证码不合法!"); | |
| 433 | 437 | } | |
| 434 | 438 | } | |
| 439 | + | ||
| 440 | + version = requestObject.getIntValue(VERSION); | ||
| 435 | 441 | } catch (Exception e) { | |
| 436 | 442 | return Parser.extendErrorResult(requestObject, e); | |
| 437 | 443 | } | |
@@ -499,6 +505,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) { | |||
| 499 | 505 | session.setAttribute(TYPE, isPassword ? LOGIN_TYPE_PASSWORD : LOGIN_TYPE_VERIFY);//登录方式 | |
| 500 | 506 | session.setAttribute(USER_, user);//用户 | |
| 501 | 507 | session.setAttribute(PRIVACY_, privacy);//用户隐私信息 | |
| 508 | + session.setAttribute(VERSION, version);//用户隐私信息 | ||
| 502 | 509 | // session.setMaxInactiveInterval(1*60);//设置session过期时间 | |
| 503 | 510 | ||
| 504 | 511 | return response; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ | |||
| 30 | 30 | import com.alibaba.fastjson.JSONObject; | |
| 31 | 31 | ||
| 32 | 32 | import apijson.demo.server.Verifier; | |
| 33 | + import apijson.demo.server.model.BaseModel; | ||
| 33 | 34 | import apijson.demo.server.model.User; | |
| 34 | 35 | import zuo.biao.apijson.JSON; | |
| 35 | 36 | import zuo.biao.apijson.JSONResponse; | |
@@ -172,6 +173,11 @@ public JSONObject parseResponse(JSONObject request) { | |||
| 172 | 173 | // Verifier.verifyLogin(session); | |
| 173 | 174 | // } | |
| 174 | 175 | if (noVerifyRequest == false) { | |
| 176 | + //补充全局缺省版本号 | ||
| 177 | + if (requestObject.getIntValue(JSONRequest.KEY_VERSION) <= 0) { | ||
| 178 | + requestObject.put(JSONRequest.KEY_VERSION, session.getAttribute(JSONRequest.KEY_VERSION)); | ||
| 179 | + } | ||
| 180 | + | ||
| 175 | 181 | requestObject = getCorrectRequest(requestMethod, requestObject); | |
| 176 | 182 | } | |
| 177 | 183 | } catch (Exception e) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments