Skip to content

Commit f404187

Browse files
committed
Java: MultiDataSource 同步 APIAuto 代码
1 parent 0fc9421 commit f404187

File tree

7 files changed

+233
-66
lines changed

7 files changed

+233
-66
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
/target/
22
/bin/
3+
/src/main/resources/static/api/.npm-cache/
4+
/src/main/resources/static/api/node_modules/
5+
/src/main/resources/static/api/logs/

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ https://github.com/TommyLemon/APIAuto/issues
308308

309309
[UIGO](https://github.com/TommyLemon/UIGO) 📱 零代码快准稳 UI 智能录制回放平台 🚀 3 像素内自动精准定位,2 毫秒内自动精准等待,用户包含腾讯,微信团队邀请分享
310310

311+
[UIGOX](https://github.com/TommyLemon/UIGOX) UIGO 的 AndroidX 版 📱 零代码快准稳 UI 智能录制回放平台 🚀 3 像素内自动精准定位,2 毫秒内自动精准等待
312+
311313
[apijson-doc](https://github.com/vincentCheng/apijson-doc) APIJSON 官方文档,提供排版清晰、搜索方便的文档内容展示,包括设计规范、图文教程等
312314

313315
[APIJSONdocs](https://github.com/ruoranw/APIJSONdocs) APIJSON 英文文档,提供排版清晰的文档内容展示,包括详细介绍、设计规范、使用方式等

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

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,71 @@ function newArrayString(table, json, count, page) {
482482
+ table + "\":" + JSON.stringify(json) + "}}";
483483
}
484484

485+
function getRequestFromURL(url_, tryParse) {
486+
var url = url_ || window.location.search;
487+
488+
var index = url == null ? -1 : url.indexOf("?")
489+
if(index < 0) { //判断是否有参数
490+
return null;
491+
}
492+
493+
var theRequest = null;
494+
var str = url.substring(index + 1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
495+
var arr = str.split("&"); //截除“&”生成一个数组
496+
497+
var len = arr == null ? 0 : arr.length;
498+
for(var i = 0; i < len; i++) {
499+
var part = arr[i];
500+
var ind = part == null ? -1 : part.indexOf("=");
501+
if (ind <= 0) {
502+
continue
503+
}
504+
505+
if (theRequest == null) {
506+
theRequest = {};
507+
}
508+
509+
var v = decodeURIComponent(part.substring(ind+1));
510+
if (tryParse == true) {
511+
try {
512+
v = parseJSON(v)
513+
}
514+
catch (e) {
515+
console.log(e)
516+
}
517+
}
518+
519+
theRequest[part.substring(0, ind)] = v;
520+
}
521+
522+
return theRequest;
523+
}
524+
485525
if (typeof module == 'object') {
486-
module.exports = this;
526+
module.exports = {
527+
JSONRequest: this,
528+
request: request,
529+
encode: encode,
530+
decode: decode,
531+
toFormData: toFormData,
532+
format: format,
533+
log: log,
534+
parseJSON: parseJSON,
535+
alertOfDebug: alertOfDebug,
536+
isEmpty: isEmpty,
537+
getObject: getObject,
538+
getArray: getArray,
539+
postObject: postObject,
540+
putObject: putObject,
541+
deleteObject: deleteObject,
542+
putArray: putArray,
543+
deleteArray: deleteArray,
544+
newSingleJSON: newSingleJSON,
545+
newArrayJSON: newArrayJSON,
546+
newSingleString: newSingleString,
547+
newArrayString: newArrayString,
548+
getRequestFromURL: getRequestFromURL
549+
};
487550
}
488551

489552
//常用请求>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ var StringUtil = {
2222
MAX_NICK_NAME_LENGTH: 20,
2323
MAX_CONST_NAME_LENGTH: 30,
2424

25+
isString: function(s) {
26+
return typeof s == 'string';
27+
},
28+
isNotString: function(s) {
29+
return ! StringUtil.isString(s);
30+
},
31+
2532
/**获取string,为null则返回''
2633
* @param s
2734
* @return

0 commit comments

Comments
 (0)