@@ -105,8 +105,9 @@ public class DemoController extends APIJSONController {
105105 * @see {@link RequestMethod#GET}
106106 */
107107 @ PostMapping (value = "get" )
108+ @ Override
108109 public String get (@ RequestBody String request , HttpSession session ) {
109- return new DemoParser ( GET ). setSession ( session ). parse ( request );
110+ return super . get ( request , session );
110111 }
111112
112113 /**计数
@@ -116,8 +117,9 @@ public String get(@RequestBody String request, HttpSession session) {
116117 * @see {@link RequestMethod#HEAD}
117118 */
118119 @ PostMapping ("head" )
120+ @ Override
119121 public String head (@ RequestBody String request , HttpSession session ) {
120- return new DemoParser ( HEAD ). setSession ( session ). parse ( request );
122+ return super . head ( request , session );
121123 }
122124
123125 /**限制性GET,request和response都非明文,浏览器看不到,用于对安全性要求高的GET请求
@@ -127,8 +129,9 @@ public String head(@RequestBody String request, HttpSession session) {
127129 * @see {@link RequestMethod#GETS}
128130 */
129131 @ PostMapping ("gets" )
132+ @ Override
130133 public String gets (@ RequestBody String request , HttpSession session ) {
131- return new DemoParser ( GETS ). setSession ( session ). parse ( request );
134+ return super . gets ( request , session );
132135 }
133136
134137 /**限制性HEAD,request和response都非明文,浏览器看不到,用于对安全性要求高的HEAD请求
@@ -138,8 +141,9 @@ public String gets(@RequestBody String request, HttpSession session) {
138141 * @see {@link RequestMethod#HEADS}
139142 */
140143 @ PostMapping ("heads" )
144+ @ Override
141145 public String heads (@ RequestBody String request , HttpSession session ) {
142- return new DemoParser ( HEADS ). setSession ( session ). parse ( request );
146+ return super . heads ( request , session );
143147 }
144148
145149 /**新增
@@ -149,8 +153,9 @@ public String heads(@RequestBody String request, HttpSession session) {
149153 * @see {@link RequestMethod#POST}
150154 */
151155 @ PostMapping ("post" )
156+ @ Override
152157 public String post (@ RequestBody String request , HttpSession session ) {
153- return new DemoParser ( POST ). setSession ( session ). parse ( request );
158+ return super . post ( request , session );
154159 }
155160
156161 /**修改
@@ -160,8 +165,9 @@ public String post(@RequestBody String request, HttpSession session) {
160165 * @see {@link RequestMethod#PUT}
161166 */
162167 @ PostMapping ("put" )
168+ @ Override
163169 public String put (@ RequestBody String request , HttpSession session ) {
164- return new DemoParser ( PUT ). setSession ( session ). parse ( request );
170+ return super . put ( request , session );
165171 }
166172
167173 /**删除
@@ -171,8 +177,9 @@ public String put(@RequestBody String request, HttpSession session) {
171177 * @see {@link RequestMethod#DELETE}
172178 */
173179 @ PostMapping ("delete" )
180+ @ Override
174181 public String delete (@ RequestBody String request , HttpSession session ) {
175- return new DemoParser ( DELETE ). setSession ( session ). parse ( request );
182+ return super . delete ( request , session );
176183 }
177184
178185
@@ -340,9 +347,9 @@ public JSONObject postVerify(@RequestBody String request) {
340347 return DemoParser .extendErrorResult (requestObject , e );
341348 }
342349
343- new DemoParser (DELETE , true ).parse (newVerifyRequest (type , phone , null ));
350+ new DemoParser (DELETE , false ).parse (newVerifyRequest (type , phone , null ));
344351
345- JSONObject response = new DemoParser (POST , true ).parseResponse (
352+ JSONObject response = new DemoParser (POST , false ).parseResponse (
346353 newVerifyRequest (type , phone , "" + (new Random ().nextInt (9999 ) + 1000 ))
347354 );
348355
@@ -352,7 +359,7 @@ public JSONObject postVerify(@RequestBody String request) {
352359 } catch (Exception e ) {}
353360
354361 if (verify == null || JSONResponse .isSuccess (verify .getIntValue (JSONResponse .KEY_CODE )) == false ) {
355- new DemoParser (DELETE , true ).parseResponse (new JSONRequest (new Verify (type , phone )));
362+ new DemoParser (DELETE , false ).parseResponse (new JSONRequest (new Verify (type , phone )));
356363 return response ;
357364 }
358365
@@ -385,7 +392,7 @@ public JSONObject getVerify(@RequestBody String request) {
385392 } catch (Exception e ) {
386393 return DemoParser .extendErrorResult (requestObject , e );
387394 }
388- return new DemoParser (GETS , true ).parseResponse (newVerifyRequest (type , phone , null ));
395+ return new DemoParser (GETS , false ).parseResponse (newVerifyRequest (type , phone , null ));
389396 }
390397
391398 /**校验验证码
@@ -425,7 +432,7 @@ public JSONObject headVerify(@RequestBody String request) {
425432 */
426433 public JSONObject headVerify (int type , String phone , String code ) {
427434 JSONResponse response = new JSONResponse (
428- new DemoParser (GETS , true ).parseResponse (
435+ new DemoParser (GETS , false ).parseResponse (
429436 new JSONRequest (
430437 new Verify (type , phone )
431438 .setVerify (code )
@@ -442,14 +449,14 @@ public JSONObject headVerify(int type, String phone, String code) {
442449 long time = BaseModel .getTimeMillis (verify .getDate ());
443450 long now = System .currentTimeMillis ();
444451 if (now > 60 *1000 + time ) {
445- new DemoParser (DELETE , true ).parseResponse (
452+ new DemoParser (DELETE , false ).parseResponse (
446453 new JSONRequest (new Verify (type , phone )).setTag (VERIFY_ )
447454 );
448455 return DemoParser .newErrorResult (new TimeoutException ("验证码已过期!" ));
449456 }
450457
451458 return new JSONResponse (
452- new DemoParser (HEADS , true ).parseResponse (
459+ new DemoParser (HEADS , false ).parseResponse (
453460 new JSONRequest (new Verify (type , phone ).setVerify (code )).setFormat (true )
454461 )
455462 );
@@ -532,7 +539,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
532539
533540
534541 //手机号是否已注册
535- JSONObject phoneResponse = new DemoParser (HEADS , true ).parseResponse (
542+ JSONObject phoneResponse = new DemoParser (HEADS , false ).parseResponse (
536543 new JSONRequest (
537544 new Privacy ().setPhone (phone )
538545 )
@@ -546,7 +553,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
546553 }
547554
548555 //根据phone获取User
549- JSONObject privacyResponse = new DemoParser (GETS , true ).parseResponse (
556+ JSONObject privacyResponse = new DemoParser (GETS , false ).parseResponse (
550557 new JSONRequest (
551558 new Privacy ().setPhone (phone )
552559 ).setFormat (true )
@@ -562,7 +569,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
562569 //校验凭证
563570 if (isPassword ) {//password密码登录
564571 response = new JSONResponse (
565- new DemoParser (HEADS , true ).parseResponse (
572+ new DemoParser (HEADS , false ).parseResponse (
566573 new JSONRequest (new Privacy (userId ).setPassword (password ))
567574 )
568575 );
@@ -578,7 +585,7 @@ public JSONObject login(@RequestBody String request, HttpSession session) {
578585 }
579586
580587 response = new JSONResponse (
581- new DemoParser (GETS , true ).parseResponse (
588+ new DemoParser (GETS , false ).parseResponse (
582589 new JSONRequest (new User (userId )).setFormat (true )
583590 )
584591 );
@@ -693,7 +700,7 @@ public JSONObject register(@RequestBody String request) {
693700 }
694701 requestObject .put (JSONRequest .KEY_FORMAT , true );
695702 response = new JSONResponse (
696- new DemoParser (POST ).setNoVerifyLogin ( true ).parseResponse (requestObject )
703+ new DemoParser (POST ).setNeedVerifyLogin ( false ).parseResponse (requestObject )
697704 );
698705
699706 //验证User和Privacy
@@ -707,10 +714,10 @@ public JSONObject register(@RequestBody String request) {
707714 }
708715
709716 if (e != null ) { //出现错误,回退
710- new DemoParser (DELETE , true ).parseResponse (
717+ new DemoParser (DELETE , false ).parseResponse (
711718 new JSONRequest (new User (userId ))
712719 );
713- new DemoParser (DELETE , true ).parseResponse (
720+ new DemoParser (DELETE , false ).parseResponse (
714721 new JSONRequest (new Privacy (userId2 ))
715722 );
716723 }
@@ -822,7 +829,7 @@ public JSONObject putPassword(@RequestBody String request){
822829 privacy .setPayPassword (oldPassword );
823830 }
824831 JSONResponse response = new JSONResponse (
825- new DemoParser (HEAD , true ).parseResponse (
832+ new DemoParser (HEAD , false ).parseResponse (
826833 new JSONRequest (privacy ).setFormat (true )
827834 )
828835 );
@@ -839,7 +846,7 @@ else if (StringUtil.isPhone(phone) && StringUtil.isVerify(verify)) {
839846 return DemoParser .extendErrorResult (response , new ConditionErrorException ("手机号或验证码错误!" ));
840847 }
841848 response = new JSONResponse (
842- new DemoParser (GET , true ).parseResponse (
849+ new DemoParser (GET , false ).parseResponse (
843850 new JSONRequest (
844851 new Privacy ().setPhone (phone )
845852 )
@@ -860,7 +867,7 @@ else if (StringUtil.isPhone(phone) && StringUtil.isVerify(verify)) {
860867 // requestObject.put(JSONRequest.KEY_TAG, "Password");
861868 requestObject .put (JSONRequest .KEY_FORMAT , true );
862869 //修改密码
863- return new DemoParser (PUT , true ).parseResponse (requestObject );
870+ return new DemoParser (PUT , false ).parseResponse (requestObject );
864871 }
865872
866873
@@ -913,7 +920,7 @@ public JSONObject putBalance(@RequestBody String request, HttpSession session) {
913920
914921 privacyObj .remove ("balance+" );
915922 JSONResponse response = new JSONResponse (
916- new DemoParser (HEADS , true ).setSession (session ).parseResponse (
923+ new DemoParser (HEADS , false ).setSession (session ).parseResponse (
917924 new JSONRequest (PRIVACY_ , privacyObj )
918925 )
919926 );
@@ -938,7 +945,7 @@ public JSONObject putBalance(@RequestBody String request, HttpSession session) {
938945
939946 if (change < 0 ) {//提现
940947 response = new JSONResponse (
941- new DemoParser (GETS , true ).parseResponse (
948+ new DemoParser (GETS , false ).parseResponse (
942949 new JSONRequest (
943950 new Privacy (userId )
944951 )
0 commit comments