添加myJavaScript.js文件
This commit is contained in:
parent
0e294f2afd
commit
6083594c27
37
myJavaScript.js
Normal file
37
myJavaScript.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
async function longStringSplit(string) {
|
||||||
|
let strExcerpt = string.replaceAll("'", "''");
|
||||||
|
let uuid = getCurrentDateTime() + " " + generateUUID();
|
||||||
|
let i = 1;
|
||||||
|
while (strExcerpt.length > 0) {
|
||||||
|
let res = await $.post(`/api/esb/oa/execute?eventkey=LongStringSplit¶ms={"uuid":"${uuid}","excerpt":"${strExcerpt.slice(0, 500)}","order":${i},"maxRunNum":3}`);
|
||||||
|
strExcerpt = strExcerpt.slice(500);
|
||||||
|
i++;
|
||||||
|
if (JSON.parse(res).flag == 0) {
|
||||||
|
alert("LongStringSplit接口有误,请联系管理员!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateUUID() {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
|
const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentDateTime() {
|
||||||
|
const now = new Date();
|
||||||
|
const pad = num => String(num).padStart(2, '0');
|
||||||
|
const formattedDateTime = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
|
||||||
|
return formattedDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
function detailresFromESBFormat(str, attr_name) {
|
||||||
|
let res = [];
|
||||||
|
JSON.parse(str)[attr_name].forEach(res_i => {
|
||||||
|
res.push(JSON.parse(res_i));
|
||||||
|
});
|
||||||
|
return res;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user