mirror of
https://github.com/lan-tianxiang/clone_scripts.git
synced 2026-03-24 19:37:40 +08:00
25 lines
584 B
JavaScript
Executable File
25 lines
584 B
JavaScript
Executable File
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; |