Skip to content

Commit 5f1cfb1

Browse files
committed
Java:MultiDataSource 更新 AutoUI
1 parent b246627 commit 5f1cfb1

7 files changed

Lines changed: 1197 additions & 439 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ var JSONResponse = {
190190
* @return
191191
*/
192192
isSuccess: function(obj) {
193-
// if (obj == null) {
194-
// return false
195-
// }
193+
if (obj == null) {
194+
return false
195+
}
196196

197197
if (obj instanceof Array == false && obj instanceof Object) {
198198
obj = obj[JSONResponse.KEY_CODE];

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/au/apijson/InputUtil.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,14 @@ const InputUtil = {
378378
var isReq = action >= 0 && action != InputUtil.HTTP_ACTION_RESPONSE;
379379
var format = obj.format
380380
format = StringUtil.isNumber(format) ? '' : format
381+
var host = StringUtil.trim(obj.host);
382+
var url = StringUtil.trim(obj.url);
383+
var query = StringUtil.trim(obj.query);
381384
return timeStr + ' ' + InputUtil.getHTTPActionName(action)
382-
+ "\nURL: " + StringUtil.trim(obj.url)
385+
+ "\nURL: " + (StringUtil.isEmpty(host) || url.includes("://") || url.startsWith(host) ? url : host + url)
386+
+ (StringUtil.isEmpty(query) || url.endsWith(query) ? "" : (url.includes("?") ? "&" : "?") + query)
383387
+ "\n\nREQUEST: " + StringUtil.trim(format) + '\n' + StringUtil.trim(obj.request)
384-
+ (isReq ? "" : "\n\n\nRESPONSE: " + StringUtil.trim(obj.status) + '\n' + + StringUtil.trim(obj.response))
388+
+ (isReq ? "" : "\n\n\nRESPONSE: " + StringUtil.trim(obj.status) + '\n' + StringUtil.trim(obj.response))
385389
+ "\n\n"
386390
}
387391

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/au/apijson/JSONRequest.js‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,49 @@ function newArrayString(table, json, count, page) {
482482
+ table + "\":" + JSON.stringify(json) + "}}";
483483
}
484484

485+
486+
487+
function getRequestFromURL(url_, tryParse) {
488+
var url = url_ || window.location.search;
489+
490+
var index = url == null ? -1 : url.indexOf("?")
491+
if(index < 0) { //判断是否有参数
492+
return null;
493+
}
494+
495+
var theRequest = null;
496+
var str = url.substring(index + 1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
497+
var arr = str.split("&"); //截除“&”生成一个数组
498+
499+
var len = arr == null ? 0 : arr.length;
500+
for(var i = 0; i < len; i++) {
501+
var part = arr[i];
502+
var ind = part == null ? -1 : part.indexOf("=");
503+
if (ind <= 0) {
504+
continue
505+
}
506+
507+
if (theRequest == null) {
508+
theRequest = {};
509+
}
510+
511+
var v = decodeURIComponent(part.substring(ind+1));
512+
if (tryParse == true) {
513+
try {
514+
v = parseJSON(v)
515+
}
516+
catch (e) {
517+
console.log(e)
518+
}
519+
}
520+
521+
theRequest[part.substring(0, ind)] = v;
522+
}
523+
524+
return theRequest;
525+
}
526+
527+
485528
if (typeof module == 'object') {
486529
module.exports = this;
487530
}

0 commit comments

Comments
 (0)