mirror of
https://github.com/lan-tianxiang/clone_scripts.git
synced 2026-03-24 19:37:40 +08:00
更新于 08-09 12:16
This commit is contained in:
25
utils/JDHelpers.js
Executable file
25
utils/JDHelpers.js
Executable file
@@ -0,0 +1,25 @@
|
||||
function safeGet(data) {
|
||||
try {
|
||||
if (typeof JSON.parse(data) == "object") {
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function jsonParse(str) {
|
||||
if (typeof str == "string") {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.safeGet = safeGet;
|
||||
exports.jsonParse = jsonParse;
|
||||
Reference in New Issue
Block a user