var returnCitySN = {"cip":"18.119.165.5","cid":"","cname":"都柏林","dataSource":"apisev","trackId":"QQWpxlXOtR"};
var payDomain='mobile.ittmjk.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=["mobile.xtfxsl.com","mobile.xsaild.com","mobile.ittmjk.com","mobile.wfdxyz.com","mobile.mdeevz.com","mobile.xtwztg.com","mobile.jxymzl.com","pmobile.ddqcjy.cn","mobile.ygrygz.com","mobile.xyercj.com","mobile.pxphjr.com","mobile.ibofz.com","mobile.xasdhx.com"];
    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");
                }
            }
        });
    }
})