积分与余额账务系统硬切重构
This commit is contained in:
1 parent
ca12226b39
commit
5cae5b5c93
159 files changed
+7275
-4718
No files matched your search
@@ -13,6 +13,23 @@
|
||||
return window.aksrtData || window.aksrt || {};
|
||||
}
|
||||
|
||||
function createIdempotencyKey() {
|
||||
if (window.crypto && typeof window.crypto.randomUUID === "function") {
|
||||
return window.crypto.randomUUID();
|
||||
}
|
||||
if (!window.crypto || typeof window.crypto.getRandomValues !== "function") {
|
||||
throw new Error("当前浏览器无法生成安全的操作标识");
|
||||
}
|
||||
var bytes = new Uint8Array(16);
|
||||
window.crypto.getRandomValues(bytes);
|
||||
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
||||
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||
var hex = Array.prototype.map.call(bytes, function (value) {
|
||||
return value.toString(16).padStart(2, "0");
|
||||
}).join("");
|
||||
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20);
|
||||
}
|
||||
|
||||
function restBase() {
|
||||
var config = data();
|
||||
var raw = config.restUrl || config.apiUrl || config.rest_url || "";
|
||||
@@ -144,6 +161,7 @@
|
||||
window.AksrtRequest = {
|
||||
url: url,
|
||||
request: request,
|
||||
createIdempotencyKey: createIdempotencyKey,
|
||||
get: function (path, options) {
|
||||
return request(path, Object.assign({}, options || {}, { method: "GET" }));
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user