Update QingLong.js

This commit is contained in:
Sliverkiss
2025-01-03 16:39:31 +08:00
committed by GitHub
parent 234665a268
commit 5bb2503d61

View File

@@ -151,11 +151,11 @@ function QingLong(HOST, Client_ID, Client_Secret) {
throw message || `Failed to obtain the environment variable.`;
}
} catch (e) {
throw e
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.";
: "Network Error.");
}
}
@@ -210,11 +210,11 @@ function QingLong(HOST, Client_ID, Client_Secret) {
throw message || "Failed to add the environment variable.";
}
} catch (e) {
throw e
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.";
: "Network Error.");
}
}
/**
@@ -240,11 +240,11 @@ function QingLong(HOST, Client_ID, Client_Secret) {
throw message || "Failed to update the environment variable.";
}
} catch (e) {
throw e
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.";
: "Network Error.");
}
}
/**
@@ -269,11 +269,11 @@ function QingLong(HOST, Client_ID, Client_Secret) {
throw message || "Failed to delete the environment variable.";
}
} catch (e) {
throw e
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.";
: "Network Error.");
}
}
/**
@@ -298,11 +298,41 @@ function QingLong(HOST, Client_ID, Client_Secret) {
throw message || "Failed to enable the environment variable.";
}
} catch (e) {
throw e
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.";
: "Network Error.");
}
}
/**
* 关闭环境变量
* @param {*} ids [0,1,2] -> id数组
*/
async disableEnv(ids) {
const options = {
url: `${this.host}open/envs/disable`,
method: "put",
headers: {
Authorization: `${this.token}`,
"Content-Type": "application/json;charset=UTF-8",
},
body: JSON.stringify(ids),
};
try {
const { code, message } = await Request(options, "post");
if (code === 200) {
$.log(`✅The environment variable was disable successfully.`);
} else {
throw message || "Failed to enable the environment variable.";
}
} catch (e) {
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.");
}
}
/**
@@ -325,11 +355,11 @@ function QingLong(HOST, Client_ID, Client_Secret) {
throw message || `Failed to get the environment variable.`;
}
} catch (e) {
throw e
$.log(e
? typeof e === "object"
? JSON.stringify(e)
: e
: "Network Error.";
: "Network Error.");
}
}
})(HOST, Client_ID, Client_Secret);