@@ -531,8 +531,9 @@ var JSONResponse = {
531
531
3-对象缺少字段/整数变小数,黄色;
532
532
4-code/值类型 改变,红色;
533
533
*/
534
- compareResponse : function ( res , target , real , folder , isMachineLearning , codeName , exceptKeys , ignoreTrend ) {
535
- var tStatus = ( target || { } ) . status || 200 ;
534
+ compareResponse : function ( res , target , real , folder , isMachineLearning , codeName , exceptKeys , ignoreTrend , noBizCode ) {
535
+ target = target || { }
536
+ var tStatus = target . status || 200 ;
536
537
var rStatus = ( res || { } ) . status ;
537
538
if ( rStatus != null && rStatus != tStatus ) {
538
539
return {
@@ -542,8 +543,8 @@ var JSONResponse = {
542
543
}
543
544
}
544
545
codeName = StringUtil . isEmpty ( codeName , true ) ? JSONResponse . KEY_CODE : codeName ;
545
- var tCode = ( target || { } ) [ codeName ] ;
546
- var rCode = ( real || { } ) [ codeName ] ;
546
+ var tCode = ( isMachineLearning != true && noBizCode ) ? 0 : ( target || { } ) [ codeName ] ;
547
+ var rCode = noBizCode ? tCode : ( real || { } ) [ codeName ] ;
547
548
548
549
//解决了弹窗提示机器学习更新标准异常,但导致所有项测试结果都变成状态码 code 改变
549
550
// if (real == null) {
@@ -587,7 +588,7 @@ var JSONResponse = {
587
588
}
588
589
589
590
var tThrw = target . throw ;
590
- var rThrw = real . throw ;
591
+ var rThrw = noBizCode ? tThrw : real . throw ;
591
592
592
593
var exceptions = target . exceptions || [ ] ;
593
594
if ( rCode != tCode || rThrw != tThrw ) {
@@ -620,11 +621,12 @@ var JSONResponse = {
620
621
} ;
621
622
}
622
623
623
- delete target [ codeName ] ;
624
- delete real [ codeName ] ;
625
-
626
- delete target . throw ;
627
- delete real . throw ;
624
+ if ( noBizCode != true ) {
625
+ delete target [ codeName ] ;
626
+ delete real [ codeName ] ;
627
+ delete target . throw ;
628
+ delete real . throw ;
629
+ }
628
630
629
631
//可能提示语变化,也要提示
630
632
// delete target.msg;
@@ -636,11 +638,14 @@ var JSONResponse = {
636
638
? JSONResponse . compareWithStandard ( target , real , folder , exceptKeys , ignoreTrend )
637
639
: JSONResponse . compareWithBefore ( target , real , folder , exceptKeys ) ;
638
640
} finally {
639
- target [ codeName ] = tCode ;
640
- real [ codeName ] = rCode ;
641
-
642
- target . throw = tThrw ;
643
- real . throw = rThrw ;
641
+ if ( isMachineLearning || noBizCode != true ) {
642
+ target [ codeName ] = tCode ;
643
+ }
644
+ if ( noBizCode != true ) {
645
+ real [ codeName ] = rCode ;
646
+ target . throw = tThrw ;
647
+ real . throw = rThrw ;
648
+ }
644
649
}
645
650
646
651
if ( exceptions . length > 0 && ( target . repeat || 0 ) <= 0 && ( result || { } ) . code < JSONResponse . COMPARE_VALUE_CHANGE ) {
@@ -1257,7 +1262,7 @@ var JSONResponse = {
1257
1262
} ,
1258
1263
1259
1264
1260
- updateFullStandard : function ( standard , currentResponse , isML ) {
1265
+ updateFullStandard : function ( standard , currentResponse , isML , noBizCode ) {
1261
1266
if ( currentResponse == null ) {
1262
1267
return standard ;
1263
1268
}
@@ -1271,7 +1276,7 @@ var JSONResponse = {
1271
1276
var msg = currentResponse . msg ;
1272
1277
1273
1278
var hasCode = standard . code != null ;
1274
- var isCodeChange = standard . code != code ;
1279
+ var isCodeChange = noBizCode != true && standard . code != code ;
1275
1280
var exceptions = standard . exceptions || [ ] ;
1276
1281
1277
1282
delete currentResponse . code ; //code必须一致
@@ -1295,8 +1300,14 @@ var JSONResponse = {
1295
1300
1296
1301
var stddObj = isML ? ( isCodeChange && hasCode ? standard : JSONResponse . updateStandard ( standard , currentResponse ) ) : { } ;
1297
1302
1298
- currentResponse . code = code ;
1299
- currentResponse . throw = thrw ;
1303
+ // if (noBizCode != true) {
1304
+ currentResponse . code = code ;
1305
+ currentResponse . throw = thrw ;
1306
+ // }
1307
+
1308
+ if ( hasCode || isML ) {
1309
+ stddObj . code = code || 0 ;
1310
+ }
1300
1311
1301
1312
if ( isCodeChange ) {
1302
1313
if ( hasCode != true ) { // 走正常分支
0 commit comments