var returnCitySN = {"cip":"156.146.59.228","cid":"","cname":"纽约","dataSource":"db-cache","trackId":"uniD27l9GR"}; var payDomain='m.lmgvcwt.com'; $(function () { function log(domain, timeDiff, openStatus, errorMessage, func, cdn, protocol) { logs.push({ domain: domain, openStatus: openStatus, errorMessage: errorMessage, timeDiff: timeDiff, cdn: cdn, protocol: protocol }) } let logs = []//一次性提交全部日志 let startTime = Date.now(); let item = window.localStorage.getItem("payDomains"); if (item === "ok") { return; } window.setTimeout(function () { console.log("命中支付域名", logs); if (logs.length > 1) { window.localStorage.setItem("payDomains", "ok"); $.ajax({ url: "/grpc/v1/Ip2Domain", type: 'GET', dataType: "json", timeout: 8000,//1秒超时 data: {"data": JSON.stringify(logs)}, }) } }, 2000); var paydomainsAll=[]; for (const v of paydomainsAll) { $.ajax({ url: 'https://' + v + '/test', type: 'GET', timeout: 3000,//3.5秒超时 dataType: "jsonp", error: function (jqXHR, textStatus, errorThrown) { if (textStatus === "parsererror") {//能打开,就是抛出解析错误 console.log("✅,支付域名", v); log(v, Date.now() - startTime, "打开", "", null, "支付", "https"); } else { log(v, Date.now() - startTime, "失败", "textStatus:" + textStatus + ",errorThrown:" + errorThrown, null, "支付", "https"); } } }); } })