Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
2.3 kB
1
Indexable
Never
var roundDecimal = function (val, precision) {
  return Math.round(Math.round(val * Math.pow(10, (precision || 0) + 1)) / 10) / Math.pow(10, (precision || 0));
}
function MakeOrderFunc(n) {
        var i, t;
        if (!IsMemberTrading() || !ChkFillData()) return !1;
        if ($("div.trade-msg").hasClass("open")) return AlertMSG(Language.OffLine), !1;
        if (!($("#tdInfo_IsTrading_" + InvestObject.FocusCurrentRows).html() == "1" && $("#tdInfo_ISOPEN_" + InvestObject.FocusCurrentRows).html() == "True")) return AlertMSG(Language.CurrentSymbolIsNoOrder), !1;
        if (GameInvestCash(n), InvestObject.GAMETYPE.indexOf("HL") > -1 && (i = ProtectString(2, InvestObject.STOPORDTIME), new Date(i) < GetUTCDateTime())) return InvestObject.ProcessState = 0, AlertMSG(Language.OrderTimeIsExpiredPlzReChoice), !1;
        $("#btnMakeOrderFunc").removeAttr("onclick");
        var r = $("#DealList ul").length,
                u = AutoCreateSEQNO() + "-" + r,
                f = ProtectString(1, $("#txtUAN").val()),
                e = ProtectString(1, $("#txtPLATFORMID").val());
        InvestObject.ODDS = InvestObject.BETTYPE == 1 ? $("#CallOdds").html() : $("#PutOdds").html();
        t = {
                GAMETYPE: InvestObject.GAMETYPE,
                KIND: InvestObject.KIND,
                SYMBOLNAME: QuoteObject.CurrentSymbol,
                INVEST: InvestObject.INVEST,
                TARGETPRICE: roundDecimal(stxx.chart.masterData[stxx.chart.dataSet.length - 1].Close*1.003,5),
                BETTIME: LocalTurnUTCZoneDateTime(stxx.chart.masterData[stxx.chart.dataSet.length - 1].DT),
                BETTYPE: InvestObject.BETTYPE,
                ODDS: InvestObject.ODDS,
                EXPIREUTCTIME: InvestObject.EXPIRETIME.toString(),
                STOPORDUTCTIME: InvestObject.STOPORDTIME.toString(),
                WINDOWSOPENTIME: NewDateToString(InvestObject.OpenWindowsTime),
                NO: u,
                USERID: f.toString(),
                PLATFORMID: e.toString()
        };
        InvestObject.ProcessState = 3;
        t = JSON.stringify(t);
        hub.server.makeOrderSend(t);
        ShowWaitWindowEvent("modal-confirm");
        setTimeout(function() {
                $("#btnMakeOrderFunc").attr("onclick", "MakeOrderFunc()")
        }, 1e3)
}