@@ -224,7 +224,7 @@ public String openHead(@PathVariable String request, HttpSession session) {
224224 public static final String VERIFY = "verify" ;
225225
226226 public static final String TYPE = "type" ;
227-
227+
228228
229229
230230 /**生成验证码,修改为post请求
@@ -247,13 +247,14 @@ public JSONObject postVerify(@RequestBody String request) {
247247 new DemoParser (DELETE , true ).parse (newVerifyRequest (type , phone , null ));
248248
249249 JSONObject response = new DemoParser (POST , true ).parseResponse (
250- newVerifyRequest (type , phone , "" + (new Random ().nextInt (9999 ) + 1000 )));
250+ newVerifyRequest (type , phone , "" + (new Random ().nextInt (9999 ) + 1000 ))
251+ );
251252
252253 JSONObject verify = null ;
253254 try {
254- verify = response .getJSONObject (VERIFY_ );
255+ verify = response .getJSONObject (StringUtil . firstCase ( VERIFY_ ) );
255256 } catch (Exception e ) {}
256-
257+
257258 if (verify == null || JSONResponse .isSuccess (verify .getIntValue (JSONResponse .KEY_CODE )) == false ) {
258259 new DemoParser (DELETE , true ).parseResponse (new JSONRequest (new Verify (type , phone )));
259260 return response ;
@@ -340,7 +341,7 @@ public JSONObject headVerify(int type, String phone, String code) {
340341
341342 return new JSONResponse (
342343 new DemoParser (HEADS , true ).parseResponse (
343- new JSONRequest (new Verify (type , phone ).setVerify (code ))
344+ new JSONRequest (new Verify (type , phone ).setVerify (code )). setFormat ( true )
344345 )
345346 );
346347 }
@@ -352,8 +353,8 @@ public JSONObject headVerify(int type, String phone, String code) {
352353 * @param verify
353354 * @return
354355 */
355- private JSONObject newVerifyRequest (int type , String phone , String verify ) {
356- return new JSONRequest (new Verify (type , phone ).setVerify (verify )).setTag (VERIFY_ );
356+ private zuo . biao . apijson . JSONRequest newVerifyRequest (int type , String phone , String verify ) {
357+ return new JSONRequest (new Verify (type , phone ).setVerify (verify )).setTag (VERIFY_ ). setFormat ( true ) ;
357358 }
358359
359360
@@ -402,7 +403,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
402403 throw new IllegalArgumentException ("验证码不合法!" );
403404 }
404405 }
405-
406+
406407 //全局版本号,是否格式化
407408 version = requestObject .getIntValue (VERSION );
408409 format = requestObject .getBoolean (FORMAT );
@@ -432,7 +433,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
432433 JSONObject privacyResponse = new DemoParser (GETS , true ).parseResponse (
433434 new JSONRequest (
434435 new Privacy ().setPhone (phone )
435- )
436+ ). setFormat ( true )
436437 );
437438 response = new JSONResponse (privacyResponse );
438439
@@ -462,7 +463,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
462463
463464 response = new JSONResponse (
464465 new DemoParser (GETS , true ).parseResponse (
465- new JSONRequest (new User (userId ))
466+ new JSONRequest (new User (userId )). setFormat ( true )
466467 )
467468 );
468469 User user = response .getObject (User .class );
@@ -501,7 +502,7 @@ public JSONObject logout(HttpSession session) {
501502 JSONObject user = DemoParser .newSuccessResult ();
502503 user .put (ID , userId );
503504 user .put (COUNT , 1 );
504- result .put (USER_ , user );
505+ result .put (StringUtil . firstCase ( USER_ ) , user );
505506
506507 return result ;
507508 }
@@ -571,6 +572,7 @@ public JSONObject register(@RequestBody String request) {
571572 if (StringUtil .isEmpty (requestObject .getString (JSONRequest .KEY_TAG ), true )) {
572573 requestObject .put (JSONRequest .KEY_TAG , REGISTER );
573574 }
575+ requestObject .put (JSONRequest .KEY_FORMAT , true );
574576 response = new JSONResponse (
575577 new DemoParser (POST ).setNoVerifyLogin (true ).parseResponse (requestObject )
576578 );
@@ -668,7 +670,7 @@ public JSONObject putPassword(@RequestBody String request){
668670 userId = privacyObj .getLongValue (ID );
669671 phone = privacyObj .getString (PHONE );
670672 password = privacyObj .getString (_PASSWORD );
671-
673+
672674 if (StringUtil .isEmpty (password , true )) { //支付密码
673675 type = Verify .TYPE_PAY_PASSWORD ;
674676 password = privacyObj .getString (_PAY_PASSWORD );
@@ -702,7 +704,7 @@ public JSONObject putPassword(@RequestBody String request){
702704 }
703705 JSONResponse response = new JSONResponse (
704706 new DemoParser (HEAD , true ).parseResponse (
705- new JSONRequest (privacy )
707+ new JSONRequest (privacy ). setFormat ( true )
706708 )
707709 );
708710 if (JSONResponse .isExist (response .getJSONResponse (PRIVACY_ )) == false ) {
@@ -737,6 +739,7 @@ else if (StringUtil.isPhone(phone) && StringUtil.isVerify(verify)) {
737739
738740
739741 // requestObject.put(JSONRequest.KEY_TAG, "Password");
742+ requestObject .put (JSONRequest .KEY_FORMAT , true );
740743 //修改密码
741744 return new DemoParser (PUT , true ).parseResponse (requestObject );
742745 }
@@ -838,6 +841,7 @@ public JSONObject putBalance(@RequestBody String request, HttpSession session) {
838841 privacyObj .put ("balance+" , change );
839842 requestObject .put (PRIVACY_ , privacyObj );
840843 requestObject .put (JSONRequest .KEY_TAG , PRIVACY_ );
844+ requestObject .put (JSONRequest .KEY_FORMAT , true );
841845 //不免验证,里面会验证身份
842846 return new DemoParser (PUT ).setSession (session ).parseResponse (requestObject );
843847 }
0 commit comments