Skip to content

Commit 570f5d7

Browse files
committed
Java:MultiDataSource 更新 APIAuto
1 parent 10d5e29 commit 570f5d7

File tree

1 file changed

+15
-11
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/js

1 file changed

+15
-11
lines changed

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,11 @@ https://github.com/Tencent/APIJSON/issues
23592359
s += '(PHP):\n\n' + CodeUtil.parsePHPResponse('', res, 0, isSingle)
23602360
break;
23612361
case CodeUtil.LANGUAGE_PYTHON:
2362-
s += '(Python):\n\n' + CodeUtil.parsePythonResponse('', res, 0, isSingle)
2362+
var isML = this.isMLEnabled
2363+
var tr = (this.currentRemoteItem || {}).TestRecord || {}
2364+
var stddObj = isML ? JSONResponse.updateFullStandard(parseJSON(tr.standard), res, isML) : null
2365+
var resObj = isML ? stddObj : (res || parseJSON(tr.response))
2366+
s += '(Python):\n\n' + CodeUtil.parsePythonResponse('', resObj, 0, ! isSingle, isML)
23632367
break;
23642368
default:
23652369
s += ':\n没有生成代码,可能生成代码(封装,解析)的语言配置错误。 \n';
@@ -2916,10 +2920,10 @@ https://github.com/Tencent/APIJSON/issues
29162920
if (isId) {
29172921
config += prefix + (isRand ? 'RANDOM_IN' : 'ORDER_IN') + '(undefined, null, ' + value + ')'
29182922
if (value >= 1000000000) { //PHP 等语言默认精确到秒 1000000000000) {
2919-
config += '\n// 可替代上面的 ' + prefix.substring(1) + 'RANDOM_INT(' + Math.round(0.9 * value) + ', ' + Math.round(1.1 * value) + ')'
2923+
config += '\n// 可替代上面的 ' + prefix + 'RANDOM_INT(' + Math.round(0.9 * value) + ', ' + Math.round(1.1 * value) + ')'
29202924
}
29212925
else {
2922-
config += '\n// 可替代上面的 ' + prefix.substring(1) + 'RANDOM_INT(1, ' + (10 * value) + ')'
2926+
config += '\n// 可替代上面的 ' + prefix + 'RANDOM_INT(1, ' + (10 * value) + ')'
29232927
}
29242928
}
29252929
else {
@@ -2945,16 +2949,16 @@ https://github.com/Tencent/APIJSON/issues
29452949
var hasDot = String(value).indexOf('.') >= 0
29462950

29472951
if (value < 0) {
2948-
config += '\n// 可替代上面的 ' + prefix.substring(1) + (hasDot ? 'RANDOM_NUM' : 'RANDOM_INT') + '(' + (100 * value) + ', 0)'
2952+
config += '\n// 可替代上面的 ' + prefix + (hasDot ? 'RANDOM_NUM' : 'RANDOM_INT') + '(' + (100 * value) + ', 0)'
29492953
}
29502954
else if (value > 0 && value < 1) { // 0-1 比例
2951-
config += '\n// 可替代上面的 ' + prefix.substring(1) + 'RANDOM_NUM(0, 1)'
2955+
config += '\n// 可替代上面的 ' + prefix + 'RANDOM_NUM(0, 1)'
29522956
}
29532957
else if (value >= 0 && value <= 100) { // 10% 百分比
2954-
config += '\n// 可替代上面的 ' + prefix.substring(1) + 'RANDOM_INT(0, 100)'
2958+
config += '\n// 可替代上面的 ' + prefix + 'RANDOM_INT(0, 100)'
29552959
}
29562960
else {
2957-
config += '\n// 可替代上面的 ' + prefix.substring(1) + (hasDot != true && value < 10 ? (isRand ? 'RANDOM_INT' : 'ORDER_INT') + '(0, 9)' : ((hasDot ? 'RANDOM_NUM' : 'RANDOM_INT') + '(0, ' + 100 * value + ')'))
2961+
config += '\n// 可替代上面的 ' + prefix + (hasDot != true && value < 10 ? (isRand ? 'RANDOM_INT' : 'ORDER_INT') + '(0, 9)' : ((hasDot ? 'RANDOM_NUM' : 'RANDOM_INT') + '(0, ' + 100 * value + ')'))
29582962
}
29592963
}
29602964
}
@@ -3687,7 +3691,7 @@ https://github.com/Tencent/APIJSON/issues
36873691
//上传第三方平台的 API 至 APIAuto
36883692
uploadThirdPartyApi: function(method, type, name, url, parameters, json, header, description, creator, rspObj) {
36893693
if (typeof json == 'string') {
3690-
json = JSON.parse(json)
3694+
json = parseJSON(json)
36913695
}
36923696
const reqObj = json || {}
36933697

@@ -9785,13 +9789,13 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
97859789
},
97869790

97879791
toPathValuePairMap: function (json, path, map) {
9788-
if (json == null) {
9789-
return null
9790-
}
97919792

97929793
if (map == null) {
97939794
map = {}
97949795
}
9796+
if (json == null) {
9797+
return map
9798+
}
97959799

97969800
if (json instanceof Array) {
97979801
for (var i = 0; i < json.length; i++) {

0 commit comments

Comments
 (0)