Skip to content

Commit bed3c1e

Browse files
committed
APIAuto: 解决参数注入 RANDOM_DB, ORDER_DB 不兼容 - Header
1 parent 6ab903e commit bed3c1e

File tree

1 file changed

+5
-4
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js

1 file changed

+5
-4
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10782,9 +10782,11 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1078210782
continue;
1078310783
}
1078410784

10785+
const isHead = line.startsWith('- ');
10786+
const line2 = isHead ? line.substring(2) : line;
1078510787
// path User/id key id@
10786-
const index = line.indexOf(': '); //APIJSON Table:alias 前面不会有空格 //致后面就接 { 'a': 1} 报错 Unexpected token ':' lastIndexOf(': '); // indexOf(': '); 可能会有 Comment:to
10787-
const p_k = line.substring(0, index);
10788+
const index = line2.indexOf(': '); //APIJSON Table:alias 前面不会有空格 //致后面就接 { 'a': 1} 报错 Unexpected token ':' lastIndexOf(': '); // indexOf(': '); 可能会有 Comment:to
10789+
const p_k = line2.substring(0, index);
1078810790
const bi = -1; //没必要支持,用 before: undefined, after: .. 同样支持替换,反而这样导致不兼容包含空格的 key p_k.indexOf(' ');
1078910791
const path = decodeURI(bi < 0 ? p_k : p_k.substring(0, bi)); // User/id
1079010792

@@ -10809,7 +10811,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1080910811
}
1081010812

1081110813
// value RANDOM_DB
10812-
const value = line.substring(index + ': '.length);
10814+
const value = line2.substring(index + ': '.length);
1081310815

1081410816
var invoke = function (val, which, p_k, pathKeys, key, lastKeyInPath) {
1081510817
try {
@@ -10849,7 +10851,6 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
1084910851
if (generateJSON) {
1085010852
//先按照单行简单实现
1085110853
//替换 JSON 里的键值对 key: value
10852-
var isHead = key.startsWith('- ');
1085310854
var targetObj = isHead ? head : json;
1085410855
var parent = targetObj;
1085510856
var current = null;

0 commit comments

Comments
 (0)